Questions tagged [avr]
AVR is a 8- and 32-bit microcontroller core developed by Atmel. AVR was chosen as microcontroller for the first generations of the popular Arduino SBCs.
1,889
questions
4
votes
2
answers
919
views
Transmitting from PC via USART to MCU working but very slow
I am sending a small 16-Bit RGB BMP image file from my Linux PC via USART (with a loosely wired USB to serial converter) to an AVR ATmega MCU sitting on a breadboard, running at 8 MHz with the ...
0
votes
0
answers
46
views
Graphical LCD With Atmega64
I have ATMEGA64 and LCM240128, The wiring is as below:
And my code is ( I'm using codevision):
...
2
votes
1
answer
260
views
ATmega64 custom board is not programming
I have designed a custom board for ATmega64 as below:
It's the first time I want to program it, and I get a "chip enable program error". I can program ATmega16 and ATmega8, but for ATmega64 ...
1
vote
1
answer
68
views
ATMega328p wakes immediately after sleep
I'm having issues with my current AVR-C project that runs on an ATMega328p. After issuing the sleep command the chip wakes up again immediately.
I want to wakeup with an external interrupt, but while ...
1
vote
2
answers
152
views
Assembly: AVR Studio alternatives for Linux [closed]
I had been using using AVR Studio on Windows to write assembly code for my MCUs (mainly for atmega8515) for a couple years. However, recently I transitioned to Linux and turns out there aren't any ...
4
votes
1
answer
610
views
AVR code disassembly - what is this code doing?
I have read and disassembled the code from an Atmel8 microcontroller from a faulty oscilloscope.
This is the start routine:
...
1
vote
2
answers
110
views
Dual Slope integrator voltmeter improvement in Design
So, I'm attempting to design a dual-slope integrator voltmeter. I have the following block diagram so far.
Now an AVR microcontroller will have an ADC pin in the range of 0-5 Volts . So negative ...
0
votes
0
answers
30
views
Regulating multiple +5V sources to one output to increase current, but avoid interference/noise
I'm designing a circuit with 4 USB 2.0 upstream ports that each connect to their own AVR (ATMEGA32U4), 1 master and 3 slave connected via I2C, master then communicates with a USB controller via SPI, ...
2
votes
3
answers
330
views
AVR code - where is Z register pointing to?
I am disassembling AVR code from a bit of hardware. The processor is an Atmel-8.
On restart, after setting the stack pointer, the program calls a subroutine that starts with:
...
2
votes
2
answers
347
views
3V oscillator to 5V µC with an 74HCT inverter (12.8 MHz) - bad idea?
I'd like to use an AVR (ATmega328P-AU to be precise) in combination with a fairly accurate oscillator for timing purposes. I stumbled upon the fact that oscillators which have greater accuracy mostly ...
0
votes
0
answers
120
views
Implementation Of I2C Slave Using AVR USI Module
I've been reading about implementation of I2C (TWI) slave on AVR using USI module.
As the data sheet suggests there exists two application notes on implementing I2C using USI module, here is the one ...
0
votes
0
answers
42
views
avr debugWIRE On chip debug system
I am new into avr and am working on atmega328p. I am not able to understand the avr debugwire system. What is this and how it works. I am seen the datasheet but am not getting a good clear ...
0
votes
1
answer
60
views
Multiplexed keyboard based on MOSFET for AVR gives sometimes wrong reading
I made simple example for multiplexed keyboard 2x2 on AVR. Like schematic below:
And Source code:
...
0
votes
0
answers
51
views
AT90USB1286 bricks after disabling clock divider
I have an AT90USB1286 which is connected to a 16MHz external crystal oscillator. It is my understanding that by default from the factory the CKDIV fuse is enabled which makes the chip run at an ...
0
votes
0
answers
35
views
Switching reference voltage with capacitor on AREF
I do two conversions (ratiometric measurement) with AREF = AVCC = VCC = 3 x AAA battery. AVCC is connected to VCC via an LC network as recommended in the data sheet of the ATmega328P. I would like ...
0
votes
1
answer
116
views
Why is nothing happening on my CLKOUT pin, despite the RTC working fine? [closed]
I apologize for the (probably) trivial question -- I'm just starting to get back into coding for MCUs after a long hiatus, so please be patient with me.
I'll preface this by acknowledging that there ...
0
votes
2
answers
64
views
ATMega32U4 USB design considerations
I'm desigining a board with ATMega32U4 microcontroller.
The board will be minimal, and will feed the microcontroller from USB of an M.2 socket (E type) on a PC mainboard:
Now, checking Leonardo's ...
4
votes
2
answers
798
views
How can I do immediate addition in the Atmel AVR instruction set?
I've been doing some AVR assembly programming for a university course, and I recently happened upon a situation where I would have wanted an "add immediate" instruction. However, no such ...
0
votes
2
answers
213
views
Schematic design for CJMCU Beetle?
I have this bare ATMEGA32U4 breakout:
There are no components on the backside, and I need to redesign this for my own purposes.
I'm looking for the schematic design of this. Although I can reverse ...
1
vote
1
answer
56
views
Cannot stop Microcontroller's Hardware Timer from running
I'm using an Atmel ATMega8 microcontroller to control a stepper motor. (Datasheet).
Timer1 (a 16-bit hardware counter) is used in CTC mode to modulate an IO pin to provide the stepping signal to the ...
0
votes
2
answers
57
views
Driving 10ch outputs with 5V AVR
I use a 5V AVR (ATmega1284p) to measure some data. Depending on the data I would like to switch one of 10 outputs.
Each of these outputs should have a LED (as an indicator and for debugging purposes) ...
0
votes
1
answer
44
views
How to make a circuit which can give divided voltage to ADC and can send a trigger pulse to INT0 when I press a button?
I connected 4 buttons to the ADC module of AVR-ATMega328p with different resistor values,
To know which button is pressed this ...
3
votes
0
answers
44
views
PID H-bridge random current spikes
My H-bridge consists of 4 n-channel MOSFETs. The high side is driven by a basic bootstrap circuit, and the low side is directly driven from the MCU.
Using a PID function to control the motor by its ...
1
vote
1
answer
200
views
How do I measure distance of Ultrasonic Sensor HC-SR04 using the ATmega328P Timer Input Capture?
I am using an ATmega328P MCU with an 16 MHz external oscillator. I need to measure distance of Ultrasonic Sensor HC-SR04 using the ATmega328P Timer 1 Input Capture interrupt. I have to measure the ...
0
votes
1
answer
77
views
Software serial not sending the first byte correctly
I implemented the following program to send data to a serial monitor.When I run it, I expect to see abcd but I always see ⸮bcd:
<...
4
votes
3
answers
338
views
Are ATmega48/168/328 suitable for automotive applications?
I'm trying to figure out if it's ok to use ATmega48 in a homemade project involving some safety-related aspects with moving vehicles. (the project will be a control board for excavator joysticks)
...
0
votes
1
answer
130
views
ESP8266 responds with gibberish and 'ready' to AT commands from C program
I have gotten the ESP8266 working by sending commands manually from the TTY. Now, I'm trying to connect to wifi using the following C program:
...
6
votes
1
answer
442
views
How does USART know which port to use for IO?
I'm trying to learn to use USART on an ATmega328P. I'm using this datasheet.
I'm using the following code to echo characters I type on my terminal:
...
1
vote
1
answer
123
views
avr-gcc optimization deleting register writes on ATTiny402
I'm using avr-gcc (12.1.0, built with this script: https://github.com/ZakKemble/avr-gcc-build) to compile for the ATtiny402 and encountering problems with code optimization. Specifically, the compiler ...
0
votes
3
answers
144
views
What is the GPIO voltage level of a ATMega32U4 when powered from USB?
I found a nice little device that utilizes the ATMega32U4.
Although I tried to find this particular information in the datasheet, I couldn't (more than 400 pages):
When this tiny chip is powered ...
2
votes
1
answer
115
views
E-Ink with Atmega and avr-libc
I am trying to understand how to drive an E-Ink display like the Adafruit 4196 with i.e. an Atmega328 with avr-libc.
From what I could learn so far, I would write the image/text to a frame buffer and ...
0
votes
0
answers
103
views
ATTiny1616 ADC - issue with input channel switching
I am trying to configure Analog-to-Digital converter in ATTiny1616 to switch its input source between internal voltage reference and external input signal. My issue is that when ADC1 is adequately ...
0
votes
0
answers
88
views
What are the control lines in the ATmega328P for?
I'm trying to understand the block diagram for AVR architecture in the datasheet for ATmega328P on page 9. In it, I see that instruction decoder is connected to control lines. What are they in terms ...
1
vote
1
answer
294
views
Understanding assembly code for LED blink with ATmega328P
I wrote the following program to turn an LED on and off at 1-second intervals:
...
0
votes
2
answers
99
views
How do I get started with ATWINC-IC from Microchip?
I want to get started with ATWINC-IC from Microchip. It's a WiFi IC that I'm going to implement onto a PCB.
I have installed Microchip Studio and now I'm looking for how to start a project with that ...
0
votes
1
answer
98
views
Proteus ATTiny85/ATMega328P CLKOUT not sending any signal at all - Why?
I set all the fuse bits correctly according to the datasheet, It seems like I just need to set the CLKOUT bits correctly, and I should get a signal of some sort. I can still send signals to the GPIO ...
1
vote
1
answer
44
views
Could an AVR ISP connector be reused to add SPI-Interfaced memories without programing the controller?
I have no previous experience designing AVR-Compatible hardware.
I have a board which uses an ATMega 2560 and has a SPI bus which is already used by a SD adapter. After some datasheet reading, I ...
0
votes
0
answers
177
views
ESP32 UART TX slow response rate
I`m having issue with UART communication between AVR and ESP32. Issue is with TX response rate.
Here is what I`m sending with AVR, first 2 bytes are command, last 3 are data:
...
0
votes
0
answers
51
views
AT90USB1286 as a potential storage device for a few kilobytes of data
I have a few trays of AT90USB1286 microcontrollers leftover from a previous project that I would like to make use of.
Is it possible to make this chip act as a block device when connected to a PC? I ...
0
votes
0
answers
78
views
Can't read RGBC data from TCS34725 RGB Sensor using AVR and Atmega16
For my project, I need to read the RGBC data from a TCS34725 RGB Sensor using the Atmega16 and AVR. It should be able to classify between the colors Red, Green, Blue and Clear light. Therefore I made ...
1
vote
1
answer
554
views
AVRDUDE verification error
I've been working with AVR microcontrollers (specifically with ATmega328p's) for a bit and I got an ATmega32u4 that I wanted to program it to be used as a USB peripheral. However there is one problem: ...
0
votes
1
answer
147
views
AVR Port pins: read and write
As the ports are connected to pull-up resistors; the port pin values should be at level 1 when not connected to the outside world.I wrote the below code to set the lower half of PORTA as input and the ...
0
votes
1
answer
45
views
Powering AT90USB162 microcontroller from USB
I have a new AT90USB162 (docs). I would like to use my USB 2.0 socket and USB cable as a power supply for the microcontroller. I have two questions:
How to adjust the current flow? In the ...
0
votes
0
answers
61
views
ATmega8 answers and is programmed, but the program doesn't work
I'm having trouble with ATmega8 programming. I'm using the USBasp programmer and the PlatformIO IDE and everything goes smoothly, AVRDUDE doesn't show any errors, but the program doesn't work on the ...
0
votes
0
answers
52
views
Changing External Crystal of ATMEGA2560
In new project I'm working on I changed 8MHz external crystal of ATMEGA2560 to 16MHz Now UART and I2C are not working. What all changes needs to be done to make this work?
0
votes
1
answer
87
views
How does the ATMega32 know that the incoming SPI data signals are the program to be burnt?
From my understanding, in order to burn a C program to the ATMega32's flash memory, the program is first compiled and converted into a hex file which is then uploaded using a computer program such as ...
0
votes
0
answers
78
views
AVR adc multichannel isn't reading properly
this is a code I made to get reading of 3 ADC channels , I am using the ADC interrupt auto trigger , the first channel works well but after that the readings are weird , I am using potentiometer , so ...
0
votes
2
answers
256
views
Atmel Studio: Compiler error when adding external SRAM
I have board wired up to use ATMega1281's Eternal Memory Interface with a BSI, BS62LV4006STIP55, 512Kx8 SDRAM connected. I am trying to do something similar to this (ATMega128), except my memory is ...
0
votes
0
answers
102
views
Why is my code working in proteus but not when burned into chip?
I am using atmel chip and I have a problem with the code, I guess. Trying to make automatic light system. I am working with two IR sensors that should detect a person entering and leaving the room. I ...
3
votes
0
answers
54
views
Minimum circuitry for robust operation of the "new" ATtinys (1614) with Optiboot
I have spent hours now trying to catch up on the replacements for the old ATtiny's, there does not seem to be a robust (meaning, with protections that we could find in an UNO or Mega for example) ...