2,383 questions
4 votes
2 answers
141 views
avr-g++ - Undefined reference to register Y upon linking
I have a weird problem when doing inline asm and compiling/linking with avr-g++ (version 16, fresh from the Git). I think this might be a bug of the tool chain, but I wanted second opinions in case I ...
0 votes
0 answers
60 views
ATMega328 gets stuck after initial keypress on a keypad (using interrupt)
I successfully implemented a keypad matrix in an atmega328 through polling in the main loop and now my goal is to do it only on key press (using pin change interrupt). I'm using PORTB[3...0] for rows ...
0 votes
1 answer
49 views
AVR 8-bit: Reusability vs. Efficiency?
My implementation of an API function doing a simple SPI transfer, offering a void *intfPtr parameter to pass a "device descriptor" which I am using to pass the I/O port and pin for SPI chip ...
3 votes
2 answers
220 views
Why we use PIN & (1<<PBx) to check if PIN is high?
I'm a beginner working on AVR programming on the ATmega328P. I am trying to get input from a button and then control an LED. void setup() { DDRB |= (1<<PB5); DDRB &= ~(1<<PB4); ...
0 votes
1 answer
106 views
“avrdude: verification error; content mismatch” error when programming AVR based microcontrollers
When programming for an AVR compatible micro controller, such as the Atmega328p, you're facing an error after successfully building and uploading a first time, but all subsequent times result in an ...
0 votes
1 answer
79 views
Unexplained build error in IAR Embedded Workbench for Microchip AVR 7.30.5
I am experiencing a very strange behavior of IAR Embedded Workbench for Microchip AVR 7.30.5. When attempting to build a project I get the following output at the end of the build: When done from GUI: ...
0 votes
0 answers
63 views
yl-69 sensor - adc conversion does not change adch and adcl - avr assembly
The YL-69 sensor(for soil moisture using a comparator circuit LM-393) is functional. When tested with C code on the Arduino IDE, it prints the correct values on the serial monitor. However, when ...
1 vote
1 answer
79 views
Why does AVR-GCC show the line "text+data+bootloader" when compiling the simple LED blinker?
Avr-gcc 7.1, Win10. When compiling a simple LED blinker C code using avr-gcc, it outputs: Invoking the avr-gcc is done by hand using: avr-gcc -g -Os -mmcu=attiny13a -c "Attiny_blink_01.c" ...
0 votes
1 answer
76 views
Switching on 10 LEDs using push button
#define __SFR_OFFSET 0 #include <avr/io.h> .global main main: ldi R16, 0xFD ; Set PD1–PD6 as outputs, PD0 as input out DDRD, R16 ldi R16, 0x01 ; Enable pull-up resistor on ...
2 votes
1 answer
125 views
Arduino Nano not reading Data from UART Shell properly
Recently I've been getting into bare-metal programming with the Arduino-Nano, and wanted to play around with the UART protocool. I made a simple "shell" using rust on my host machine that ...
-1 votes
1 answer
49 views
I was working with this 7-segs led timer i encountered this error "Invalid opcode 0xFFFF at PC=0x0014" in proteus
.include "m8def.inc" .org 0x0000 rjmp RESET .org 0x0020 rjmp TIMER0_OVF_ISR RESET: ldi r16, low(RAMEND) out SPL, r16 ldi r16, high(RAMEND) out SPH, r16 ldi ...
1 vote
0 answers
106 views
Simavr - ATmega328P timer flags behaving oddly
I am using Simavr to simulate an AVR ATmega328P chip, so I dont know if this is a problem in the simulation or if it happens in the MCU too. When using the timer0 in CTC mode the TOV0 flag seems to be ...
1 vote
1 answer
117 views
Is there a way to create a static array in the .data section, where its length is calculated by the size of the .bss section on the Arduino?
I'm just wondering if there is a way I can tell the compiler that I want to create a static array inside the .data section of the Arduino's SRAM, where the array's size is calculated using the size of ...
0 votes
1 answer
105 views
AVR Embedded question (rstack and cstack)
I have a project in college where the main in asm has to call a function in c, but I don't know how to initialize the stack (rstack and cstack). I mention that the project is on an atmega16. Main asm ...
0 votes
2 answers
174 views
Binary size bloats 20x if moved from src/main.rs to examples/
I'm making a library for Arduino Uno in Rust from scratch. Currently, there's a basic Serial.write print example in the src/main.rs, which on compilation is around 500 bytes (cargo b --release). $ avr-...