So… i’m trying to set up this board of mine using the exact same schematics
as the Pololu A-Star 328PB 16MHz micro. the wiring is all done and i’m trying to
burn the boot-loader on to my MCU. note: I’m using the exact same MCU
ATMEGA328PB-MUR.
So, i have followed the instructions on Pololu - 5. The A-Star 328PB Serial Bootloader
but i’m getting a timeout… from the arduino IDE during the burning process…
Please, see images below…
I even tried burning boot-loader to the original A-star 328PB 16MHz
and i got the same timeout message.
I took the time to check the MCU datasheet, making sure i’ve connected
the wires to the write pin etc etc… which is good… same value capacitors, resisters, inductors as the original A-Star micro. anything i’ve missed in the burning process ?
Need i an original Arduino UNO 3 ?? doesn’t make any mention of any other components required…
Can someone help ?
kind regards,
The error messages indicate that AVRDUDE is having trouble talking to the programmer. That is happening because you have configured the Arduino IDE to connect to the programmer’s TTL Port. Instead you should connect to the Programming Port, which is the port where the programmer accepts programming commands.
–David
Thanks for your reply, Greyson.
I have taken the screenshot way after i’ve tried the Programming port
which was in the instruction. my mistake.
Regardless, that hadn’t worked either.
I tried to redo the process right after i’ve received your reply
on my PC and this is what i got:
Based on the information generated in the AVR programmer,
I have to modify the frequency…
But which frequencies should i modify it to ?
So far i have used the AVRDUDE itself via the terminal
played around with the fuse bits and locks and i’ve also tried using some tiny software called AVRDUDESS.
Finally i followed some instructions via sparkfun which pretty much were given me the same errors or that the sdk500 wasn’t responding or unrecognized.
So, can you help ? based on the errors i’ve got ?
Kind regards
If you are actually able to read or write a fuse or lock bit from the AVR without getting errors, that would prove that your connections and chip are working, which would help narrow down the problem a lot.
Unfortunately, the “Initial SPI command failed.” error can happen for many reasons. I recommend reading the " Troubleshooting AVR programming issues" section of the Pololu USB AVR Programmer v2 User’s Guide. In particular, you should read the “If the programmer has problems connecting to the target AVR” subsection. An ISP frequency of 114 kHz should be fine.
–David
Hello Grayson,
So, I have done some little bit of progress
with avrdude via terminal.
I have been able to read and write the fuse bits
with the help of old posts in this forum and the datasheet
but i’m having a minor issues burning the bootloader or uploading a code to the board.
Look at this:
(base) woots-MacBook:bin woot$ ./avrdude -C /opt/local/etc/avrdude.conf -c stk500v2 -P /dev/cu.usbmodem00307652 -p m328pb -B 5 -Ulock:w:0xCF:m -Uefuse:w:0xF5:m -Uhfuse:w:0xDE:m -Ulfuse:w:0xFF:m
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x1e9516 (probably m328pb)
avrdude: reading input file "0xCF"
avrdude: writing lock (1 bytes):
Writing | ################################################## | 100% 0.01s
avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0xCF:
Reading | ################################################## | 100% 0.00s
avrdude: 1 bytes of lock verified
avrdude: reading input file "0xF5"
avrdude: writing efuse (1 bytes):
Writing | ################################################## | 100% 0.01s
avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0xF5:
Reading | ################################################## | 100% 0.00s
avrdude: 1 bytes of efuse verified
avrdude: reading input file "0xDE"
avrdude: writing hfuse (1 bytes):
Writing | ################################################## | 100% 0.01s
avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xDE:
Reading | ################################################## | 100% 0.00s
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xFF"
avrdude: writing lfuse (1 bytes):
Writing | ################################################## | 100% 0.01s
avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xFF:
Reading | ################################################## | 100% 0.00s
avrdude: 1 bytes of lfuse verified
avrdude done. Thank you.
(base) woots-MacBook:bin woot$
I believe the fuses setting are the problem.
I have previously used a usbtiny avr programmer in setting the
fuses and then burning the optiboot_atmega328pb_8mhz.hex
to the mcu which i believed worked because the D13 led was on after i’ve powered my custom board but i got errors from arduino saying the programmer wasn’t responding when i tried to upload blink code using the Pololu USB AVR Programmer v2.1.
crystal clock I’m using is 8MHz with 2 x 22pF capacitors
This is what i get when i try to burn the bootloader with the arduino.
***failed;
avrdude: WARNING: invalid value for unused bits in fuse "lock", should be set to 1 according to datasheet
This behaviour is deprecated and will result in an error in future version
You probably want to use 0x3f instead of 0xff (double check with your datasheet first).
***failed;
avrdude: WARNING: invalid value for unused bits in fuse "lock", should be set to 1 according to datasheet
This behaviour is deprecated and will result in an error in future version
You probably want to use 0x0f instead of 0xcf (double check with your datasheet first).
I believe it is complaining about the -Ulock:w:0xCF:m
I initially start with a -Ulock:w:0xFF:m
but avrdude complained about something 0xCF != 0xFF
thus i assumed -Ulock needed to be 0xCF which it didn’t complained about
but arduino is complaining about. I have tried -Ulock:w:0x3F:m
which also resulted in 0xCF != 0x3F
At this point, i know i’m pretty close to resolving this issue.
Care to help ??
Kind regards,
The upper two bits of the lock byte are unimplemented. Since this version of AVRDUDE is saying you must set those bits to 1, then the value you specify for the lock byte must be between 0xC0 and 0xFF.
I’m not convinced that is why your bootloader programming is failing though. If you can post the entire AVRDUDE command that was executed and its entire output, then that might provide a clue.
You should also compare that failing AVRDUDE command carefully to the working AVRDUDE command you used to write the fuse bytes.
–David
David, I’ve done it!
Thanks a lot for your help!
Weirdly enough, this was a simple trial & error…
The arduino compiler was still complaining about
***failed;
avrdude: WARNING: invalid value for unused bits in fuse "lock", should be set to 1 .....
i decided check out other bootloaders online
I came across minicore and then in the arduino board i chose minicore atmega328p
then i burned the bootloader.
there was no problem, no complaints. it was a success
then for trial sakes purposes i burned the pololu board and voila!
it worked, no complaints!
/Users/woot/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/bin/avrdude -C/Users/woot/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf -v -patmega328pb -cstk500 -P/dev/cu.usbmodem00307652 -e -Ulock:w:0xFF:m -Uefuse:w:0xF5:m -Uhfuse:w:0xDE:m -Ulfuse:w:0xFF:m
avrdude: Version 6.3-20190619
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "/Users/woot/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf"
User configuration file is "/Users/woot/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : /dev/cu.usbmodem00307652
Using Programmer : stk500
AVR Part : ATmega328PB
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff
flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : STK500V2
Description : Atmel STK500
Programmer Model: STK500
Hardware Version: 15
Firmware Version Master : 2.10
Topcard : Unknown
Vtarget : 4.7 V
SCK period : 0.5 us
Varef : 0.0 V
Oscillator : Off
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x1e9516 (probably m328pb)
avrdude: erasing chip
avrdude: reading input file "0xFF"
avrdude: writing lock (1 bytes):
/Users/woot/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/bin/avrdude -C/Users/woot/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf -v -patmega328pb -cstk500 -P/dev/cu.usbmodem00307652 -Uflash:w:/Users/woot/Library/Arduino15/packages/pololu-a-star/hardware/avr/5.1.0/bootloaders/optiboot/optiboot_atmega328pb_8mhz.hex:i -Ulock:w:0xCF:m
Writing | ***failed;
################################################## | 100% 0.04s
avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0xFF:
avrdude: load data lock data from input file 0xFF:
avrdude: input file 0xFF contains 1 bytes
avrdude: reading on-chip lock data:
Reading | ################################################## | 100% 0.00s
avrdude: verifying ...
avrdude: WARNING: invalid value for unused bits in fuse "lock", should be set to 1 according to datasheet
This behaviour is deprecated and will result in an error in future version
You probably want to use 0x3f instead of 0xff (double check with your datasheet first).
avrdude: 1 bytes of lock verified
avrdude: reading input file "0xF5"
avrdude: writing efuse (1 bytes):
Writing | ################################################## | 100% 0.00s
avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0xF5:
avrdude: load data efuse data from input file 0xF5:
avrdude: input file 0xF5 contains 1 bytes
avrdude: reading on-chip efuse data:
Reading | ################################################## | 100% 0.00s
avrdude: verifying ...
avrdude: 1 bytes of efuse verified
avrdude: reading input file "0xDE"
avrdude: writing hfuse (1 bytes):
Writing | ################################################## | 100% 0.01s
avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xDE:
avrdude: load data hfuse data from input file 0xDE:
avrdude: input file 0xDE contains 1 bytes
avrdude: reading on-chip hfuse data:
Reading | ################################################## | 100% 0.00s
avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xFF"
avrdude: writing lfuse (1 bytes):
Writing | ################################################## | 100% 0.00s
avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xFF:
avrdude: load data lfuse data from input file 0xFF:
avrdude: input file 0xFF contains 1 bytes
avrdude: reading on-chip lfuse data:
Reading | ################################################## | 100% 0.00s
avrdude: verifying ...
avrdude: 1 bytes of lfuse verified
avrdude done. Thank you.
avrdude: Version 6.3-20190619
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "/Users/woot/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf"
User configuration file is "/Users/woot/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : /dev/cu.usbmodem00307652
Using Programmer : stk500
AVR Part : ATmega328PB
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff
flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : STK500V2
Description : Atmel STK500
Programmer Model: STK500
Hardware Version: 15
Firmware Version Master : 2.10
Topcard : Unknown
Vtarget : 4.7 V
SCK period : 0.5 us
Varef : 0.0 V
Oscillator : Off
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x1e9516 (probably m328pb)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "/Users/woot/Library/Arduino15/packages/pololu-a-star/hardware/avr/5.1.0/bootloaders/optiboot/optiboot_atmega328pb_8mhz.hex"
avrdude: writing flash (32768 bytes):
Writing | ################################################## | 100% 0.00s
avrdude: 32768 bytes of flash written
avrdude: verifying flash memory against /Users/woot/Library/Arduino15/packages/pololu-a-star/hardware/avr/5.1.0/bootloaders/optiboot/optiboot_atmega328pb_8mhz.hex:
avrdude: load data flash data from input file /Users/woot/Library/Arduino15/packages/pololu-a-star/hardware/avr/5.1.0/bootloaders/optiboot/optiboot_atmega328pb_8mhz.hex:
avrdude: input file /Users/woot/Library/Arduino15/packages/pololu-a-star/hardware/avr/5.1.0/bootloaders/optiboot/optiboot_atmega328pb_8mhz.hex contains 32768 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 0.00s
avrdude: verifying ...
avrdude: 32768 bytes of flash verified
avrdude: reading input file "0xCF"
avrdude: writing lock (1 bytes):
Writing | ***failed;
################################################## | 100% 0.03s
avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0xCF:
avrdude: load data lock data from input file 0xCF:
avrdude: input file 0xCF contains 1 bytes
avrdude: reading on-chip lock data:
Reading | ################################################## | 100% 0.00s
avrdude: verifying ...
avrdude: WARNING: invalid value for unused bits in fuse "lock", should be set to 1 according to datasheet
This behaviour is deprecated and will result in an error in future version
You probably want to use 0x0f instead of 0xcf (double check with your datasheet first).
avrdude: 1 bytes of lock verified
avrdude done. Thank you.
Thanks alot!
Griffin