Go Down

Topic: ATMega328P programmed with Arduino Pro Mini 8 MHz/3v3 settings (Read 406 times) previous topic - next topic

andreas_vitikan

I have an ATMega 328P-PU microcontroller which I am programming using a Pololu 2.1 AVR programmer (based on the STK500v2) and which works ok. I wanted the microcontroller to run at 3.3V and without a XTAL so at first I uploaded the Blink sketch with the target board set as "ATMega328P 8 MHz on a breadboard" from the arduino website and everything worked at expected. The LED blinked without a XTAL but the chip only ran at 5V. After some googling I figured out the problem were the fuses for the brownout detector and on this forum someone suggested using the target board as "Arduino Pro Mini 3.3V 8 MHz". I uploaded the Blink sketch once more with this target board and using "Upload using programmer" and all is well, the MCU works without a XTAL and blinks at 3.3V.

This is where my problem comes in. I can no longer talk to the MCU in any way. I've tried setting the programmer in 3.3V output, 5V output, nothing. Avrdude can't read anything from the board (I tried using the same programmer on a known good Genuino board with a 328P and all works well) and the IDE won't upload anything, not even the bootloader in any way shape or form using the Arduino Breadboard, normal 328p or Arduino Pro Mini target settings. The MCU is still ok and the Blink sketch works when I power it but I can't talk to it in anyway or program it. How can I recover it and avoid this happening in the future?

Code: [Select]
avrdude -p m328p -P COM7 -c stk500v2

avrdude: stk500v2_command(): command failed
avrdude: stk500v2_command(): unknown status 0xc9
avrdude: stk500v2_program_enable(): cannot get connection status
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.


Using the Arduino IDE with the "Upload using Progammer" option with the board set to STK500v2 and on the same port COM7 I also get the rc=-1 error.

pert

The problem is that the "Arduino Pro Mini 3.3V 8 MHz" board selection configures the fuses for an external clock source. Since you don't have any external clock source, the CPU doesn't run and so there is no way to reprogram it. You will need to connect a crystal or other clock source to the ATmega328P long enough to change the fuses back to using the internal oscillator.

I recommend using MiniCore:
https://github.com/MCUdude/MiniCore
After installing MiniCore and selecting Tools > Board > ATmega328, you will see a Tools > BOD menu that allows you to select the BOD voltage you want and a Tools > Clock menu that allows you to select "8 MHz internal".

Go Up