24 votes
Accepted

Why does compiler optimization flag cause function definitions other than main() to break program in AVR ATMega C code?

These are not bugs that you are encountering. The problem goes deeper than just compiler optimization flags. It is a pure coincidence it happens to work at all. The code isn't compiled properly ...
Justme's user avatar
  • 149k
13 votes

AVRDUDE does not recognize USBasp device

Found the solution, which is of course dead simple once you know... In Zadig, you can select the driver. Default selected is (in my case) the WinUSB driver. When I select the libusb driver, and ...
bas's user avatar
  • 581
13 votes

Why does compiler optimization flag cause function definitions other than main() to break program in AVR ATMega C code?

You know that something goes really wrong when at address 0 there is no vector table, which would be an array of RJMPs or ...
emacs drives me nuts's user avatar
11 votes

Why does compiler optimization flag cause function definitions other than main() to break program in AVR ATMega C code?

Thank you for providing the dump output! You've captured the smoking gun: See ATmega8515 Datasheet | Microchip page 54: The first instruction must be rjmp .init (...
Tim Williams's user avatar
  • 34.3k
7 votes
Accepted

LED- Resistor, does the position matter?

No, it does not matter. There are several cases: The LED works: in this case the resistor will limit the current flow, and does not matter if it is before or after, since it is connected serial. The ...
Michel Keijzers's user avatar
6 votes
Accepted

AVRDUDE does not recognize USBasp device

I'm a bit late to the game, but I just experienced the same error (albeit with different causes). on most places on the internet you will be instructed to install the ...
E. van Putten's user avatar
5 votes

LED- Resistor, does the position matter?

To light the LED, using the resistor to define the current, it doesn't matter which order they go in. There may be some other non-electrical reasons for preferring one over the other in specific ...
Neil_UK's user avatar
  • 167k
5 votes
Accepted

Burn Micronucleus bootloader to use ATtiny85 via USB (AVRDUDE)

You probably found a solution by now, but for others: in order to use an ATTiny85 with micronucleus via USB, you need a micronucleus driver installed, then you can use Arduino IDE if you want - simply ...
Eisen Faust's user avatar
5 votes

i'm using atmega32 to do an automatic railway gate project i wrote the code ,but i have a problem with it that it doesn't give me the required output?

when i burn it on the kit it doesn't work . what is the wrong with this code ?? Who knows? Could be anything. You haven't told us how you know it doesn't work. But that is not relevant, I will tell ...
pipe's user avatar
  • 14.3k
4 votes
Accepted

ATmega328P firmware flashing interrupted - is it fixable?

It seems likely that you have inadvertently changes the fuses to one of: Disable /RESET Different clock speed or clock source Disable SPI programming To recover this you need to use a "high-voltage" ...
Nick Gammon's user avatar
4 votes
Accepted

Unusually long programming times with ATmega328p

There seems to be a common problem with the Atmel ICE being very slow to program using avrdude. It's to do with the programmer seemingly defaulting to a low clock rate for programming. The problem can ...
Tom Carpenter's user avatar
3 votes
Accepted

Clone ATtiny13A flash memory using USB ASP programmer

Fuse bits need to be set correctly for the program to run as intended, which includes correct clock settings, clock speed, and BOD levels if used. Without correct settings the software will not even ...
Justme's user avatar
  • 149k
3 votes

How to do a factory-reset on an AVR micro-controller?

The data sheet shows for each register its initial value. A power cycle is enough to reset all concerned registers to these values. Note that a valid pulse at the reset pin or a watchdog reset do the ...
the busybee's user avatar
  • 3,034
2 votes

ATmega1284 behaving erratically

First off, your statement I've also tried change the value of F_CPU several times makes me suspect you are misunderstanding F_CPU. To ensure sane operation, <...
uint128_t's user avatar
  • 8,724
2 votes

Unable to ISP program my ATtiny85 with Atmel ICE

Common causes for this: Atmel ICE doesn't supply power to the microcontroller (as Tom mentioned in comments). It has a green LED that indicates target power, but you need to supply power separately. ...
JYelton's user avatar
  • 34.1k
2 votes
Accepted

avrdude - how to only write to device?

According to AVRDUDE documentation, 2.1 Option Descriptions, the command-line option "-V" disables automatic verify check when uploading data. ...
MarkU's user avatar
  • 14.7k
2 votes
Accepted

Arduino Nano ISP turns into the target program (as well as target MCU)

I'd add a comment but can only add an answer, sorry. You need to add a capacitor between reset and ground on the 'programmer' Arduino. 10uF, make sure that you get the polarity right. This prevents ...
user3190797's user avatar
2 votes

AVRDUDE does not recognize USBasp device

There are two parts to solving this. First the correct USB driver, as noted in the other answer, libusbk installed using the Zadig tool solves this part. The second part is getting AVRDude to ...
rszemeti's user avatar
2 votes

AVRDUDE does not recognize USBasp device

For avrdude to correctly work with USBAsp, I found the best to install the libusbK driver, at least under Windows 7. This way it works with both - the official avrdude build, and the one from the ...
TzOk's user avatar
  • 21
2 votes
Accepted

Have I bricked my ATMEGA3328p by setting

Programming clock speed is limited by the MCUs clock. If the MCU runs on a clock too slow programming at default speed will fail (as you see). You can lower the programming clock speed by using the <...
filo's user avatar
  • 8,951
2 votes

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

Bricking a chip is never fun. If you really want to learn how to fix it, you certainly can, but it is usually not time efficient or cost effective unless you really want to learn. Diagnosing the ...
Kurt E. Clothier's user avatar
2 votes

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

You first need to program a USB bootloader onto the microcontroller using the ISP interface and a programmer. Only then will it understand how to load programs over USB. AVRs don't ship with a ...
vicatcu's user avatar
  • 22.7k
2 votes
Accepted

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

From the datasheet: Your schematic doesn't have a bypass capacitor on VCC. Adding one might help. To maximize its effectiveness, solder it on as close to a pair of VCC/GND pins on the chip as ...
crj11's user avatar
  • 5,576
2 votes

ATMEL STUDIO: avrdude.exe: ser_open(): can't open device

I set the arguments line to COM3 like this: ...
Chris Stratton's user avatar
2 votes
Accepted

AVR ATtiny1634 - Programming Issue

You are not using an external "Crystal Oscillator", you have an external crystal. An external oscillator is an active device that produces a signal by itself, a crystal (or a resonator) is a passive ...
Kevin White's user avatar
  • 33.2k
2 votes
Accepted

ATTiny1616 writing the SUT fuse in SYSCFG1 with AVRDude Command Line

I have discovered in the boards text for the board defintion in the Arduino IDE the following line: atxy6.bootloader.SYSCFG1=0x03 So I have been able to amend ...
John's user avatar
  • 131
2 votes
Accepted

Avrdude Does not Read What it Wrote Correctly

The read back file is likely completely fine (I did not compare the actual bytes). The first two hex digits is the record size, and the address is in the next 4 hex digits (2 bytes). Avrdude chooses a ...
A.K.'s user avatar
  • 352
2 votes
Accepted

Attiny13 affects USBtiny programmer logic voltage levels

Well, after around 6 or 7 hours of dealing with this I finally solved it when I started playing around with a high voltage programmer. I hope this can help someone in the future. The problem was that ...
jjpprr's user avatar
  • 163
2 votes
Accepted

External RC oscillator fuse programmed instead of external crystal fuse

In the external RC oscillator mode, the oscillator block onboard the chip will not work with a crystal. You would need to connect a resistor and a capacitor as shown in app note AVR051: If it's hard ...
nanofarad's user avatar
  • 20k
2 votes

External RC oscillator fuse programmed instead of external crystal fuse

You can override the crystal with an external 1..4MHz square wave generator at XTAL1. An Arduino output with a fast set_bit/clear_bit loop can provide this if you don't have a function generator at ...
Jens's user avatar
  • 6,942

Only top scored, non community-wiki answers of a minimum length are eligible