Category Archives: AVR

AVR Board Works Only After Reset

As a not-so-new-but-still-a-novice electronic enthusiast, I recently have my second version ATTINY84 board in my hands and have everything soldered on, program burned.

What this custom AVR board does is collect signal from 1 or 2 piezo sensors, translate that signal into a C structure, and transmit that structure wireless via a cheap NRF24L01 module I bought from the ubiquitous site:淘宝). I have another NRF24L01 module, which receives the structure and decomposes it if it is valid, then sends via SPI interface the decomposed data to an Arduino UNO, which is turned into a class-compliant USB MIDI device. This Arduino uses this data to compose a standard MIDI message and send it to a Mac via USB cable.

Everything seems to work well, except one little glitch: the microcontroller freezes after the first sensed signal and never goes on. I solder an extra 47uH capacitor between Vraw and GND to ease out the sudden voltage rise, but nothing changes. Luckily I have a friend Google(well, not a so friendly friend because I live in China). After a few hours of googling, I get some hint from this post, then I burn another bootloader with attiny addon inside Arduino IDE to use the internal 8 MHz oscillator as the clock source, then the freezing goes away. As per my understanding, wrong fuses must be the cause. After searching for the correct fuse values, I get this advice: Always go with the longest setting 14CK + 65ms unless you know for a fact your clock source needs less time and 65ms is too long to wait. I take this advice and re-calculate fuses with this utility: Engbedded Atmel AVR® Fuse Calculator, then write the result to the ATTINY84

Voila! The 20 MHz external crystal oscillator works, too, and the indicator LED blinks as expected, so I can move on to improve my code.