Questions tagged [avr]

AVR is a 8- and 32-bit microcontroller core developed by Atmel. AVR was chosen as microcontroller for the popular Arduino SBCs.

Filter by
Sorted by
Tagged with
0
votes
1answer
51 views

What is best sources for learning and practising AVR microcontrollers? [on hold]

I am computers and systems engineering student and I am very interested in microcontrollers so What is best sources for learning and practising AVR microcontrollers ?
0
votes
1answer
72 views

Thread-Style Operation on Microprocessor

This is a general question about designing firmware for AVR microcontrollers, say, the AtMega16. I have a routine that I am running through several thousand times per second. The routine is entirely ...
0
votes
2answers
77 views

Atmel AVR cutting down the power

This might be a straight forward question: An AVR gets its power from a regulator which can be turned off with a digital low level input. However on a spike (digital high followed by digital low) the ...
5
votes
5answers
857 views

What's the maximum time an interrupt service routine can take to execute on ATmega328P?

I have an ATmega328P that checks if a button was pressed via pin change interrupts. Now, I want to turn on an LED for 200 ms. Can I just turn the LED on, wait 200 ms and turn it back off in ...
1
vote
1answer
55 views

serial monitor error/crash

After typing C, microcontroller responds with # Next, I type k, microcontroller responds with #INFO: TWI master enabled Next, I type !, microcontroller responds with C after typing in the next ...
0
votes
0answers
57 views

Switch Like Microcontroller or Integrated circuit

I'm somewhat new to this, and just wondering what the best approach would be. I'm trying to make a device that would be put in the middle of 2 connectors with about 20 wires. Essentially I am ...
0
votes
1answer
40 views

Making UART between ATmega32A and the PC :

I used PL2303hx to connect my pc to the chip and I did the correct connections and installed the driver of the IC and the program I wrote was simulated succesfully on proteus : but when I do it on ...
0
votes
2answers
37 views

Common resistor for pulling up unused pins of ATmega2560

I am designing a PCB with ATmega2560 MCU. I have 50 unused pins in my design. I was wondering if I can pull up these 50 pins using 5 resistors such that 10 pins have a common pull up resistor. Is that ...
1
vote
0answers
29 views

AVR - Timer0 is not firing if INT5 is enabled in EIMSK

I'm using an ATMEGA2560. Compiler: avr-gcc (AVR_8_bit_GNU_Toolchain_3.4.5_1522) 4.8.1 I have setup TIMER0 for periodic tasks: ...
1
vote
2answers
53 views

ATMEGA328 Serial input via ISR to buffer - buffer messed on printout

Using an ISR on the atmega328 to read a string ended by a \r from UART and echo back the readout string afterwards ...
2
votes
1answer
42 views

How to include paths for the C compiler in atmel studio?

I have a folder project and it consists of multiple folder and .c and .h files what is the best way to include them all without including the individual folders?
0
votes
0answers
37 views

MEGA2560 only starts program after pressing RESET button multiple times

I am working on a program where I am controlling an MP3 player by using UART between my MEGA2560 and the MP3 player. The MEGA2560 sends serial commands to the MP3 player when external interrupts are ...
0
votes
2answers
76 views

Why SS pin must be set to OUTPUT for SPI master?

In SPI, SS pin is used as latch, which means that it must be set as OUTPUT. The matter is that on arduino micro a LED is attached to the SS pin (aka PB0), so I cannot use it for the latch in SPI. ...
0
votes
1answer
72 views

(Noob question) Placing parts of a byte in different (parts of) registers

Background: I'm trying to get a gLCD working with an Atmega328p. I got it to work quite easily, but there was one catch: the library that I found, used portB for the datapins. This was unacceptable, ...
0
votes
1answer
82 views

SPI and UART of atmega32 were not working when atmega32 was interfaced with ad7705

I was trying to read 16bit ADC ad7705 by atmega32 and send the value read through SPI communication of atmega32 to real-term software by using UART of atmega32. I found that there was no transmission ...
2
votes
0answers
45 views

How to upload code to AtMega2560 using JTAG ICE 2.0

Background : I'm used to code in Arduino(Uno, Mega, Esp32, Esp8266). But this time i have to code directly on AVR Atmega 2560 Chip. I have AVR JTAG ICE 2.0 (like this one) and download several ...
0
votes
0answers
23 views

Voltage drop on system activation

My question is generic in nature about electronics system design. I am trying to put together an RC car which is powered by an AVR Atmega168 chip. It communicates through an HC-12 module and has a ...
0
votes
1answer
46 views

AVR ISP not working, strange signal level [closed]

I can't read the chip ID of the ATMega16m1 MCU using a AVRISP mkII programmer. The ISP pins are connected directly to the MCU, the reset line has a 10k pullup to Vcc (3.3V). When measuring the ISP ...
0
votes
1answer
120 views

What could cause a microcontroller on a board not to accept programming?

EDIT: To summarise - when I take the microcontroller off the board, it works. But when I leave it on the board and try to program it, I cannot. I have designed a PCB and had it fabricated. This PCB ...
1
vote
0answers
47 views

AVR SPI stops clocking if the main loop contains a delay

I have a weird issue here using an ATMega48: ...
0
votes
0answers
50 views

Display sine wave on oscilloscope with avr atmega164

I want to display a sine wave on oscilloscope using AVR Atmega164, but when I put the oscilloscope on the pin OCR0A, it takes me an rectangular pulse. How can I display a sine wave? I will put my code ...
-1
votes
1answer
31 views

Issue with timer_func() and delay_func() in generic library for R551 Fingerprint Sensor - ATMega328p

Apologies for the long-winded question. I've recently stepped outside of the Arduino realm for hardware programming. I'm working on a project that interfaces a R551 Fingerprint Sensor with an ...
0
votes
1answer
61 views

Atmega32u4 constant `1023` reading on ADC Channel

I can't share the schematics as they are not mine, I'm trying to add an analog thumbstick (4 pins, Vcc/GND/x/y) to my atmega32u4 powered keyboard. The thumbstick pins are connected to pins PB4 (ADC11)...
0
votes
0answers
41 views

Cannot Disable AVR ATmega32 Watchdog

I'm writing a code to enable and disable the watchdog timer in ATmega32. I'm using the function in the datasheet that disables the wdt. Also, I'm toggling led in the beginning of the code to know if ...
0
votes
3answers
80 views

Transmission from atmega32 to PC using max232 not working

Transmission from atmega32 to PC using max232 not working. When I checked the data from the Tx pin (in the realterm software) of atmega32 it was fine. But there was no output data from max232, when I ...
0
votes
1answer
74 views

How to detect the phase sequence of a 3-phase ac (R-Y-B or R-B-Y) using Atmega32?

I am using an 8-bit AVR microcontroller in my project to detect the phase sequence of a 3-phase AC supply. Which method shall I use to do the work with the least number of components required along ...
0
votes
2answers
96 views

HCPL3700 - 220V sensing circuit

I want to use HCPL3700 optocoupler for sensing 220V (line). I design a circuit but I want to ask some questions. HCPL3700 is an open-collector output so I pull-up Vout. In AC voltage sensing some ...
6
votes
1answer
278 views

Why is the AVR GCC compiler using a full `CALL` even though I have set the `-mshort-calls` flag?

I have set the -mshort-calls flag which is documented to replace the 4 byte long CALL instruction with the 2 byte long ...
0
votes
2answers
77 views

Can I use one pin as I2C clock or data AND as GPIO?

It happened to be that I run out of pins on ATmega48PA. So I have a pull-down buttons on the pins dedicated for I2C: And now I need to add I2C bus to this device with as much backward compatibility ...
0
votes
0answers
26 views

atmega128 doesnt return from function even if Extended.M103 fuse bit is disabled

Hi I know i should n't be using atmega128 but it will take some time to replace besides there are 100's of PCB already in making. my problem is, if you look at the main() i have declared each function ...
0
votes
0answers
56 views

using multiple shift registers

I am using Atmega128 and 8 shift registers 6D595 the ser_out of each register is connected to the next shift register's ser_in so they form a chain. There is no issue with the hardware it has been ...
0
votes
1answer
31 views

ATMega328P Timer Problem in Proteus

I have an ATMega328P microcontroller, and I'm learning how it is programmed. I wrote an example for Timer0 and uploaded it into the microcontroller. It works and a led blinks once a second in while. ...
0
votes
2answers
33 views

Which pins should i use to connect watch crystal for powering Low Frequency Crystal Oscillator in ATmega328p?

If i want use a watch crystal(32KHz) with Low Frequency Crystal Oscillator of ATmega328p,Which pin should i connect the crystal to? Should i connect the crystal to XTAL1,XTAL2 pins of ATmega328p or ...
6
votes
2answers
223 views

ATmega328p sine wave generator, frequency capping at 1200Hz

I'm currently implementing sinewave generator on ATmega328p (16MHz). My project is mostly based on this article https://makezine.com/projects/make-35/advanced-arduino-sound-synthesis/. In brief, I ...
0
votes
1answer
131 views

How to control brightness of high power LED with PWM microcontroller (ATMEGA16)

Hi I am entirely new to the PWM concept. I have an AVR based ATMEGA16 microcontroller (https://robokits.co.in/control-boards/rhino-robot-control-board/rhino-robot-control-board-avr-based-with-quick-c-...
0
votes
2answers
66 views

Is my simple atmega2560 based product exempt from EMC testing?

I have designed a product that is essentially a USB HID device for a computer game. It consists of several on off switches and 5v servos run by an atmega2560, all sealed and enclosed in a plastic case....
0
votes
2answers
155 views

Garbage data when using UART on atmega2560

(updates at bottom) I am using an Arduino Mega with the SoftwareSerialExample sketch on it to send and receive bytes through UART on my ATmega2560 (which is actually on a Arduino Mega Board). ...
0
votes
1answer
60 views

AVR NRF24L01+ No Communication, No IRQ Activity

I've been scratching my head for a few days over getting the NRF24L01+ modules to work on AVRs (ATMega328/p). I followed Gizmosnack's tutorial, not changing very much at all from his code. I've also ...
12
votes
3answers
3k views

Is it safe to abruptly remove Arduino power? [closed]

If I have an Arduino, can I abruptly turn the power on and off without corrupting it? If I am designing a product that has an on/off switch, do I need to incorporate a delay before turning off the ...
0
votes
2answers
188 views

Using Arduino Mega as Atmega2560 AVR development board with Atmel Studio 7

(updates at end) Qualifier: I am posting this here and not on the Arduino Stack Exchange because my question is about firmware development and not Arduino development. Project: I am designing a PCB ...
2
votes
5answers
152 views

Are the AVR GPIO registers used by AVRGCC?

Most (all?) of the AVR family controllers provide some special GPIO registers. 4.8.1 General Purpose I/O Registers The lowest 16 I/O Memory addresses is reserved for General Purpose I/O Registers....
0
votes
0answers
44 views

I have tried serial communication code.İt is working in arduino ide but it doesn't working in atmel studio

I have found code of serial communication for attiny84.https://electronut.in/serial-communications-with-the-attiny84/ If I compile this code in Arduino Ide then this code is running.I see hello world ...
0
votes
3answers
97 views

Disable RC oscillator in ATmega328 for FCC compliance

With respect to the topic below, I was trying to find where in the AVR documentation does it say the 8 MHz RC internal oscillator is "disabled" when CKSEL is selected to a different source? I am ...
0
votes
0answers
58 views

Issue with programming Atmega32u4 (lfuse memory not accessible using FLIP)

From my last question, I've managed to connect my Atmega32u4 to my computer. Now, when attempted to initialise the bootloader using avrdude, I get the following error message: ...
2
votes
2answers
255 views

How can I program an Atmega32u4 over USB with this schematic?

This is my first time trying to program an Atmega32u4. I made a PCB with the following schematic: Now I've soldered all the parts onto the PCB, and I've plugged a micro usb cable from my computer ...
0
votes
1answer
70 views

Avrisp mkii not recognizing atmega 328p chips

I have three different sets of chips, the attiny85, 328p, 328p-au. Initially, the avrisp mkii, was programming the atmega328p, however now it is not recognizing this chip (i.e. 328p) or the 328p-au. ...
0
votes
1answer
63 views

Sending data over UART when data has been received over I2C on AVR

So I'm receiving data from an ESP module via I2C. I then need to send this data immediately over the UART. Not sure how I should do this. Would it be ok to place the UART sending inside the i2c ...
1
vote
1answer
122 views

Regulate an RGB LED via PWM, both in brightness and in hue

I am looking to regulate programmatically an RGB LED both in terms of brightness and in terms of hue. So far I have learned that I can use PWM to do this, but I am unsure as to what the details are. I ...
10
votes
2answers
1k views

Is there a way to not have to poll the UART of an AVR?

I'm receiving data over UART from another AVR. However I'm doing other stuff so don't want to have constantly keep polling the UART. I know there are interrupts but I can only see one for receive ...
2
votes
1answer
143 views

Bricked ATMEGA328PB by setting low fuse to 0xF5 - How to recover?

While programming an ATMEGA328PB via ISP, I wanted to set the efuse to 0xF5. By accident, I didn't write the efuse but the lfuse instead. Since then, I cannot communicate with the chip via ISP ...