Questions tagged [avr]
AVR is the family of microcontrollers used in Arduino boards.
259
questions
0
votes
0
answers
36
views
Error downloading arduino:avr:1.8.6 in Arduino IDE with Network Proxy
With Arduino IDE v2.2.1, I've connected Arduino UNO board and it automatically tries download the avr board - however it repeatedly throws errors while downloading the boards.
As the PC that I'm ...
1
vote
1
answer
29
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 ...
0
votes
0
answers
28
views
How can I upload a sketch to atmega328 using FT231XS-R?
I have found several posts detailing exactly what I'm trying to do, and I am at my wits end. Below is a picture of the schematic I am using:
I know for a fact that the USB-UART controller is working ...
2
votes
2
answers
262
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
212
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
335
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
147
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
157
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
93
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
100
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
34
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
229
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
154
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
118
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
259
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
212
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
77
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
923
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
vote
1
answer
222
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 ...
0
votes
1
answer
296
views
Working with two analog sensors, ATmega16
I want to work with two analog sensors connected to ATmega16. The first one is the temperature sensor (LM35), connected to PA0. The LED should be ON when the temperature goes high. The second one is ...
1
vote
1
answer
788
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
668
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
578
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
478
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
57
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
234
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
190
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
720
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
2k
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
51
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
341
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
45
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
824
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
82
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
3k
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
95
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
222
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
102
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 ...
3
votes
2
answers
2k
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
144
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
1k
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
30
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
73
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
54
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
1k
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
295
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) ...
-1
votes
3
answers
2k
views
Why are embedded C codes are ending with "while(1)"?
I always see while(1); at the end of the C codes such as:
#include <stdio.h>
int main(void)
{
//Some code here...
while(1);
}
If I'm not wrong that it always exists, what is the ...
0
votes
1
answer
241
views
C++ State Machine / Wpmf-convesion
I'm quite a newbie using C ++. I am trying to implement in C ++, the state machine described in this link for C language:
https://barrgroup.com/Embedded-Systems/How-To/Coding-State-Machines.
I have ...
1
vote
0
answers
38
views
Custom bootloader for battery level indicator
For a project I need to be able to read the battery level of the device regardless of the sketch currently running.
For this I plan on adding a custom routine in the Arduino bootloader that reads the ...