Questions tagged [avr]
AVR is the family of microcontrollers used in Arduino boards.
262 questions
0
votes
1
answer
106
views
PS4 not recognizing Leonardo as a controller
I have created a modified AVR core based on ArduinoXInput's custom core but for PlayStation instead, to emulate a DS4 controller on HID-capable boards like the Leonardo. Using USBTreeView and online ...
0
votes
1
answer
87
views
How to modify the Leonardo's HID descriptor
I'm trying to make an Arduino Leonardo work with a PS4 following a similar approach as ArduinoXInput with its modified AVR core. However, even though I managed to add the device and configuration ...
-1
votes
2
answers
106
views
ATtiny402-SSNR minimum hardware requirement
I am using an ATtiny402-SSNR in a project. I have never used AVR MCUs before, so I need a minimum hardware requirement schematic for this chip. I could not find a schematic for this on the internet.
...
0
votes
2
answers
83
views
I need help with code with two IR sensors using ATMega16
I'm working on a ball-counting project using two IR sensors to detect balls entering and exiting a room, but I'm currently stuck. I need help refining the logic in my while loop. Here's how I want it ...
0
votes
1
answer
73
views
Why does the ADC report 0 in this sketch?
This sketch always reports 0 for the ADC reading.
I think this is going to turn out to be something silly, but I cannot find the source. I've reviewed the sketch ADC lines carefully and they seem ...
1
vote
0
answers
610
views
I just downloaded the Arduino IDE and it doesn't compile any code
FQBN: arduino:avr:uno
Using board 'uno' from platform in folder: C:\Users\Kareem\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6
Using core 'arduino' from platform in folder: C:\Users\...
1
vote
1
answer
495
views
Need Digistump library for QWERTY keyboard and Fixes for my issues!
Hello there🖐 I am trying to install Digistump library to support ATTiny85 by digispark. But I am encountering a problem when trying to install Digistump AVR boards after adding an additional board ...
2
votes
2
answers
553
views
How .data + .text section can be = How much flash the final program will consume
I could not understand one point related with Arduino code.
Let's say i have following code
void setup()
{
Serial.begin(9600);
Serial.println("foo");
}
void loop()
{
}
When i ...
5
votes
1
answer
345
views
Pin Change Interrupt Flag timing on 1284P
I want to ask about pin change interrupts on a 1284P chip using MightyCore. I have a question about the timing of multiple interrupts on one port. Specifically, if I am servicing a PCINT vector and ...
3
votes
1
answer
681
views
Arduino Uno R3 assembly code to push a button and turn on a LED
I've been trying this for days without success...
I need to turn on a LED on portb when a button in portd is pushed. Cabling works, I've tested it with Arduino IDE and it works like a charm.
This is ...
2
votes
2
answers
537
views
Barebones AVR - Connecting RESET pin to Vcc
I want to build my first barebones AVR circuit.
I plan on NOT having a RESET button. For this reason, is it valid if I connect the ATMEGA's RESET pin to Vcc directly?
What I mean by this, is that in ...
1
vote
0
answers
385
views
fatal error: avr/io.h: No such file or directory (on Windows 11)
So I'm using arduino 1.8.18 installed on zip file. I am using the HardWire library. The project is the STM32 quadcopter by joop brokking. http://www.brokking.net/ymfc-32_downloads.html
complete error -...
1
vote
2
answers
255
views
What's Memory Allocation technique in Arduino
I am currently working on an assignment for my embedded systems course, and my professor has asked us to determine the memory allocation technique employed in Arduino. Specifically, I need to identify ...
1
vote
1
answer
199
views
Checking a thing about interrupts
If I disable interrupts (for example noInterrupts or cli) and enable them (interrupts or sei for example) later, would interrupts which would have executed in the window in between fire by the ...
1
vote
0
answers
61
views
Atmega328P constantly restarting when defining a function
I wanted to make a simple led on/off program using USART interface. When the code doesn't have any functions other than main it runs fine, however Arduino keeps resetting when one is included. At this ...
1
vote
2
answers
630
views
Timer 1 "Set on Compare Match" in Normal Mode - Not working
I'm using the hardware timers on the 328 for phase angle control of a triac with zero-crossing detection. I am encountering some strange behavior with the "Set on Compare Match" feature not ...
0
votes
2
answers
318
views
slower clock frequency than expected on attiny202
I am programming an attiny202 which as per datasheet can run up to 20Mhz, but after compiling/uploading this simple code to the attiny202 and watch the PA2 pin on the oscilloscope, I see that the pin ...
2
votes
1
answer
210
views
Issues Uploading Code to ATTiny84 with Sparkfun AVR Pocket Programmer and ATTinyCore
I am getting back into programming with Arduino and built a POV fidget spinner inspired by an instructable by MakersBox. I am using the SparkFun AVR Pocket Programmer and an ATTiny84 (8MHz internal ...
-1
votes
1
answer
633
views
How to correctly set PWM to control servo angle in AVR?
I've stumbled upon timer configuration to handle my sg-90 servo and my Arduino UNO.
What I did:
Set the prescaler to 64 and mode to fast PWM of 16-bit timer.
The frequency is 50hz so the ICR1 is set ...
-1
votes
2
answers
627
views
Upload to board with no USB connection
I have a Spark Fun Pro Micro (ATmega32U4) without a USB connection (it was broken off at an earlier point) that I want to use to duplicate a prototype running on another Pro Micro.
How can I upload a ...
2
votes
0
answers
125
views
STK8231 accelerometer, getting two axis (x & y data) but not z, also in 0-255
Here is the datasheet I followed: https://lcsc.com/product-detail/Motion-Sensors-Accelerometers_SENSORTEK-STK8321_C966924.html
We are trying the following code:
#include <Wire.h>
int ...
0
votes
2
answers
2k
views
How does erasing the EEPROM work?
The datasheet for the ATmega328P contains this table, which describes bits 4 and 5 of EECR:
EEPM1
EEPM0
Programming Time
Operation
0
0
3.4ms
Erase and write in one operation (atomic operation)
0
1
1....
1
vote
1
answer
386
views
How do I build and upload a C++ program without the Arduino Library or IDE?
Note: This is a reference question (but feel free to write answers of your own!)
I want to use the AVR tools directly -- no arduino-builder or arduino-cli. I would also like compilation and uploading ...
1
vote
1
answer
1k
views
How to pass non-static class member to callback on avr platforms?
I am using the PubSubClient library in my own Arduino library. I'm having trouble with trying to assign a class member as the client library setCallback callback function.
MyClass.cpp:
#include <...
1
vote
0
answers
1k
views
I2C / TWI: set up atmega328p as slave
I try to run an atmega328p as a i2c slave. even with the bare minimum the slave acts as its not wired at all: NACK is transmitted after request (see logic analyzer).
The master should read a constant ...
1
vote
0
answers
860
views
ESP32 + Attiny85 AC Dimmer
I am working on an AC Dimmer project using ESP32 and Attiny85.
Note : I know ATtiny85 is overkill for this project, And it can be done without Attiny85, I have already done this using ESP32 alone. ...
2
votes
0
answers
751
views
Attiny85 uploading error
I am getting an error while trying to upload programs to the Attiny85 through a USBTinyISP programmer, found here. Unfortunately, it isn't working. Following this tutorial for connecting the board and ...
1
vote
0
answers
73
views
Fresh install getting Assembler Error
I am using Raspberry Pi 4 to connect via usb to program ardino Nano, I intend to communicate with the nano via i2c, but this is irrelivant.
With a fresh install of Arduino for ARM 32 bit I get this ...
1
vote
1
answer
362
views
Why do I get different results when compiling the same code with different ide?
I have a basic code about reading true rms.I compiled the same code with arduino ide and atmel studio, then ran it in a proteus simulation.I'm trying to measure how long the read_rms() function takes.
...
1
vote
1
answer
281
views
ISP Programmer with Serial and 5v/3.3v power
I currently use a Pololu USB AVR Programmer v2.1 for programming 328p chips and I really like it. The ability to have ISP and Serial in one physical device, enumerating as two separate COM ports on ...
1
vote
1
answer
900
views
How to add two assembly arrays in arduino
Hey guys what I'm trying to do is to sum two arrays and return a new array; for example if given
uint8_t a[] = {2, 4, 6};
uint8_t b[] = {1, 2, 3};
I should get { 3, 6, 9} What I'm trying to do is ...
1
vote
1
answer
5k
views
Assign an interrupt to any pin of the atmega328 microcontroller
I need to record the appearance of a signal from the sensor on the PD0 pin. This is the first time in my life that I want to use an interrupt for this.
With your help, I configured the sketch for my ...
1
vote
1
answer
84
views
Is it possible my ATMega is burnt due to bad wiring?
While working on a project I tried sending data from my Arduino NANO to ATMega64 placed on AREXX Robot arm PCB via TXD/RXD. After plugging in VCC, GND, TXD and RXD to UART socket it didn't work so I ...
1
vote
1
answer
386
views
Problem with programming digispark ATtiny85 board with Arduino IDE
I have bought a Digispark ATtiny85 board to learn about that microcontroller. So I tried using internal register names in the code rather than using Arduino in built functions. I can get the board to ...
1
vote
1
answer
88
views
About maximum length of matrix can be use for matrix invertsion on atmega32
what is the maximum length for matrix can be used for matrix inversion on atmega32,for example,can we implement matrix inversion for 15x15 matrix on atmega32? And if it can be done on atmega32..does ...
1
vote
0
answers
1k
views
Digispark green led being the only one to turn on
I was doing some tests with an ATtiny85 Digispark module using Arduino IDE on my Windows PC. I was testing some stuff with the DigiKeyboard library from Digistump.
Everything was going fine until ...
1
vote
0
answers
102
views
Is it possible to implement old AVR library onto arduino (specifically, NodeMCU esp8266)
I am a Computer Engineering Undergrad, currently in a cryptography(computer security) course, and I was assigned to do projects about implementing µNaCl library onto Arduino. I currently own a nodemcu ...
1
vote
2
answers
5k
views
Attiny85 microcontroller programming without arduino
I have decided to make a simple project so thinked about arduino but that seems very worthy so i decided to use attiny85 ic for my project,but i don't have arduino or avr to program it. Is there any ...
2
votes
1
answer
144
views
3-instruction remote machine coding Arduino Atmel chip over a serial line from a tethered (host) PC
I'm trying to write a program for AVR Atmel 328 chip on Arduino Nano board that will allow me to send machine code instructions to the chip over a serial line, run/execute them on the chip, and ...
5
votes
4
answers
1k
views
How can a function/method determine if a const array passed in is PROGMEM (flash) or not (RAM)?
Is it possible for a function/method to know if a constant array that has been passed in is in flash or RAM?
If I have a method or function that receives a constant array that is in RAM, the array is ...
0
votes
0
answers
285
views
how do i convert to assembly code (AVR assembly) from arduino
i have code in the Arduino ide for a temperature sensor that shows the temperature on three 7 segment displays, it shows the temperature to one decimal point. using an arduino uno. I am struggling to ...
1
vote
0
answers
147
views
Trying to use Timer0 on Arduino Mega
I've recently been looking at Timers and I'm trying to generate a PWM frequency at 250000Hz using Timer0 on PIN 4. When I set OCR0A = 63 I get nothing from the light however when I set OCR0A = 125 it ...
4
votes
2
answers
3k
views
AVR & PIC 8-bit Microcontrollers - Can you add: external flash memory, external RAM, video & audio output, more address busses?
so I was planning on creating a mini PC out of basic ICs and 8-bit microcontrollers such as ATTinys and/or PICs and I have several questions regarding those:
Can you add external RAM, say with SRAM, ...
-2
votes
1
answer
198
views
Reading PROGMEM results in an incorrect hex value [closed]
I'm sure I'm doing something stupid here, but the code below is supposed to write the test hex values to a I2C EEPROM, however when I attempt to read the EEPROM it has the wrong values. Directly ...
0
votes
1
answer
2k
views
Use of progmem in ESP8266 vs AVR and also how to handle large dynamic strings
This is a somewhat tricky question dealing with implementation and best-practices of the ESP8266. I'd ideally hope that it's answered by people with in-depth knowledge on the problem.
As you are ...
1
vote
0
answers
49
views
about receiving float on Atmega32 from matlab
I want to receive a float on Atmega32 from matlab. I display the output on an lcd, but i receive 0.000, can any one help me? Please ...
matlab code
s=serial('COM1','BaudRate',9600);
fopen(s)
fwrite(...
1
vote
2
answers
91
views
about receiving float on matlab from ATmega32 Avr
****i am using ATmega32 to send float and want to receive it on matlab,i send 4.85 from ATmega32 but on matlab i receive 4.260233679216239e-31...can any one help me..thanks in advance**
**
//...
1
vote
0
answers
84
views
default in switch doesn't appear to execute
I have a situation where the default case in my switch statement doesn't appear to execute as expected. I wonder if there is some subtlety I'm missing here?
Given the following enum:
enum ...
0
votes
1
answer
2k
views
Cannot write to HID USB device (Arduino, V-USB, HidSharp)
I am currently prototyping an HID USB device using Arduino Nano and V-USB library. The problem is that although I can read from the device I cannot write to it.
Here is the schema:
As for the ...
1
vote
1
answer
371
views
Atmega328p Uploads via ISP but not bootloader
I'm trying to upload a bootloader to my atmega328p on a custom pcb containing external oscillator at 16MHz. It is possible to upload program via ICSP pins using Arduino as ISP (Official Arduino Uno) ...