Hi,
I want to write a bootloader to fresh Atmega328-pau chips. It took me quite a time to get to this level (at least make it perform the bootloader flashing), but now I only can't upload sketches. Let me explain the process, if anyone has an idea please let me know.
1. Get fuse settings from working mini pro
I used: How do I read the fuse bits from within my sketch? - Arduino Stack Exchange
The fuses I got back:
Low: 0xFF
High: 0xDA
Ext: 0xFD
Lock: 0xCF
2. Flash Atmega-chip
I used the setup as below. I soldered every wire to make sure that there are no connection problems.. It is an Arduino Nano with ArduinoISP to it communicating with the chip (over SPI)
The command:
C:\Program Files (x86)\Arduino\hardware\tools\avr\bin>avrdude -P COM4 -c avrisp -b 19200 -e -p m328p -v -u -U lfuse:w:0xff:m -U hfuse:w:0xda:m -U efuse:w:0xfd:m -U lock:w:0xCF:m -C "C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf"
See the attached log.
3. Testing
Scenario 1
- I take a good working Arduino Mini Pro and remove the Atmega328p-au chip (call this chip; Chip1) from it
- I take a fresh Atmega328p-au chip (Chip2), flash it like above, then soldered back to an Arduino Mini Pro board (doesnt work)
- Upload Blink example sketch: Doesnt work: avrdude: stk500_getsync() attempt 1 of 10: not in sync
Scenario 2
- I remove the flashed chip (Chip2) and re-installed the original chip which was on the Arduino Mini pro (Chip1)
- Upload blink example sketch: Works (so my soldering is not the problem)
Scenario 3
- I remove the original chip which was on the Arduino Mini pro (Chip1)
- I flash the chip as above and reinstall it
- Upload Blink example sketch: Doesnt work: avrdude: stk500_getsync() attempt 1 of 10: not in sync
Own idea's :
-
The flasher has a 16MHz oscillator, the arduino mini pro 8mhz I think,maybe this causes problems?
-
I use the -p avrisp option to program (Programmer Type : STK500 Description : Atmel AVR ISP), however I'm doing it with the ArduinoISP (however setting that makes writing impossible)
-
Lock-writing has an error perhaps?
avrdude: writing lock (1 bytes):
Writing | | 0% 0.00s ***failed; [b]<--- failed? Why failed?[/b]
Writing | ################################################## | 100% 0.06s
avrdude: 1 bytes of lock written
AVRLog.txt (5.31 KB)