Ardrino Dock2 request reflash recovery proceedure
-
for some reason my onion2+ cannot flash the ardrino dock2. Seems like the atmega328p boot block now has the wrong code. When flashing from IDE 1.8.5, or flashing manually using /usr/bin/ardrino-dock,
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0xffff03
avrdude: Expected signature for ATmega328P is 1E 95 0F
Double check chip, or use -F to override this check.avrdude done. Thank you.
ERROR, flash NOT successful
The Device signature changes every attempt! Grr....
This is a common problem with atmega chips yet searching the net gives garbage answers and does not help at all with the onion version.
Can the devs please write a recovery procedure to fix this problem and add it to the wiki...I am sure it will help allot of users out there. Also can the devs patch the ardrino-dock script to add the -F option?
-
@C-G said in Ardrino Dock2 request reflash recovery proceedure:
for some reason my onion2+ cannot flash the ardrino dock2. Seems like the atmega328p boot block now has the wrong code.
Presumably you are talking about the Boot Loader Section of the flash. Omgega2(+) with Arduino Dock 2 operates as an ISP programmer - so it doesn't use / doesn't need any bootloader program by default.
The Signature Bytes are stored in another memory space and this special memory space is accessible through special undocumented programming instructions only.The Device signature changes every attempt! Grr....
This is a common problem with atmega chips yet searching the net gives garbage answers and does not help at all with the onion version.
Can the devs please write a recovery procedure to fix this problem and add it to the wiki...I am sure it will help allot of users out there. Also can the devs patch the ardrino-dock script to add the -F option?
("This is a common problem with atmega chips ..." - there are lots of misinformation / fake info on the Internet.
If your hardware, firmware, the installed programs, the Arduino IDE on the host PC and all settings are OK then Omega2(+) with Arduino Dock 2 can identify the ATmega328P always correctly (Device signature = 0x1e950f).You should check your on-board AVR chip in a clean state again (after a Factory Reset).
About the -F option:
BusyBox v1.26.2 () built-in shell (ash) ____ _ ____ / __ \___ (_)__ ___ / __ \__ _ ___ ___ ____ _ / /_/ / _ \/ / _ \/ _ \ / /_/ / ' \/ -_) _ `/ _ `/ \____/_//_/_/\___/_//_/ \____/_/_/_/\__/\_, /\_,_/ W H A T W I L L Y O U I N V E N T ? /___/ ----------------------------------------------------- Ω-ware: 0.1.10 b160 ----------------------------------------------------- root@Omega-99A5:~# avrdude Usage: avrdude [options] Options: -p <partno> Required. Specify AVR device. -b <baudrate> Override RS-232 baud rate. -B <bitclock> Specify JTAG/STK500v2 bit clock period (us). -C <config-file> Specify location of configuration file. -c <programmer> Specify programmer type. -D Disable auto erase for flash memory -i <delay> ISP Clock Delay [in microseconds] -P <port> Specify connection port. -F Override invalid signature check. -e Perform a chip erase. -O Perform RC oscillator calibration (see AVR053). -U <memtype>:r|w|v:<filename>[:format] Memory operation specification. Multiple -U options are allowed, each request is performed in the order specified. -n Do not write anything to the device. -V Do not verify. -u Disable safemode, default when running from a script. -s Silent safemode operation, will not ask you if fuses should be changed back. -t Enter terminal mode. -E <exitspec>[,<exitspec>] List programmer exit specifications. -x <extended_param> Pass <extended_param> to programmer. -y Count # erase cycles in EEPROM. -Y <number> Initialize erase cycle # in EEPROM. -v Verbose output. -v -v for more. -q Quell progress output. -q -q for less. -l logfile Use logfile rather than stderr for diagnostics. -? Display this usage. avrdude version 6.1, URL: <http://savannah.nongnu.org/projects/avrdude/>
-
thanks can you expand on
@György-Farkas said in Ardrino Dock2 request reflash recovery proceedure:
If your hardware, firmware, the installed programs, the Arduino IDE on the host PC and all settings are OK then Omega2(+) with Arduino Dock 2 can identify the ATmega328P always correctly (Device signature = 0x1e950f).
You should check your on-board AVR chip in a clean state again (after a Factory Reset).could you explain how to do a factory reset?
and the avrdude command line switches for the omega2(+) with the ardrino dock2 (to reset it or manually program it)
I've tried different combinations of
root@Omega-:~#avrdude -c avrispmkII [and others] -p m328p -P /dev/ttyS1 /tmp/sketch.hex
which errors out with:
avrdude: stk500v2_ReceiveMessage(): timeout
Thanks
-
@C-G If I were you I'd do this on the CLI - for example with these commands:
firstboot -y
reboot
...
ssh root@192.168.3.1
...
wifisetup
...
opkg update
opkg install arduino-dock-2
avrdude -C /usr/share/arduino-dock/avrdude.conf -p atmega328p -c linuxgpio -P gpio -n -v
This is my config: Omega2+ 0.1.10 b160 with Arduino Dock 2
root@Omega-99A5:~# avrdude -C /usr/share/arduino-dock/avrdude.conf -p atmega328p -c linuxgpio -P gpio -n -v avrdude: Version 6.1, compiled on Mar 27 2018 at 01:00:08 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/ Copyright (c) 2007-2014 Joerg Wunsch System wide configuration file is "/usr/share/arduino-dock/avrdude.conf" User configuration file is "/root/.avrduderc" User configuration file does not exist or is not a regular file, skipping Using Port : gpio Using Programmer : linuxgpio AVR Part : ATmega328P 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 : linuxgpio Description : Use the Linux sysfs interface to bitbang GPIO lines Pin assignment : /sys/class/gpio/gpio{n} RESET = ~19 SCK = 15 MOSI = 16 MISO = 17 avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.00s avrdude: Device signature = 0x1e950f avrdude: safemode: lfuse reads as FF avrdude: safemode: hfuse reads as DA avrdude: safemode: efuse reads as 5 avrdude: safemode: lfuse reads as FF avrdude: safemode: hfuse reads as DA avrdude: safemode: efuse reads as 5 avrdude: safemode: Fuses OK (E:05, H:DA, L:FF) avrdude done. Thank you.
Good luck!
-
root@Omega-:~# avrdude -C /usr/share/arduino-dock/avrdude.conf -p atmega328p -c
linuxgpio -P gpio -n -vavrdude: Version 6.1, compiled on Mar 27 2018 at 01:00:08
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg WunschSystem wide configuration file is "/usr/share/arduino-dock/avrdude.conf" User configuration file is "/root/.avrduderc" User configuration file does not exist or is not a regular file, skipping Using Port : gpio Using Programmer : linuxgpio AVR Part : ATmega328P 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 : linuxgpio Description : Use the Linux sysfs interface to bitbang GPIO lines Pin assignment : /sys/class/gpio/gpio{n} RESET = ~19 SCK = 15 MOSI = 16 MISO = 17
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0xff8dff
avrdude: Expected signature for ATmega328P is 1E 95 0F
Double check chip, or use -F to override this check.avrdude done. Thank you.
-
@C-G Bad news. Is the signature 0xff8dff on each attempt - or does it change to a different value with every attempt?
-
it changes:
executing avrdude -C /usr/share/arduino-dock/avrdude.conf -p atmega328p -c linuxgpio -P gpio -n -v
3x gives:
1st run: avrdude: Device signature = 0xfff1ff
next run: avrdude: Device signature = 0x318f7a
final run: avrdude: Device signature = 0xffc840
-
@C-G (If I were you) Before I'd say that your ATmega chip (or your Dock or both) is corrupted I'd check it in another way too - for example with an USB ISP programmer or with another Arduino (as ISP programmer). Perhaps I'd try to read the signature of another ATmega328P with the Dock.
I'm afraid the signature bytes on an ATmega328P (on any ATmega) are not writable with normal programming instructions. Please correct me if I'm wrong.
I haven't tested the next speculative command - if you think you can try it on your own risk :
avrdude -C /usr/share/arduino-dock/avrdude.conf -p atmega328p -c linuxgpio -P gpio -v -U signature:w:0x1E,0x95,0x0F:m
Most probably it'll fail:
avrdude: writing signature (3 bytes)
avrdude: verification errorI'm very sorry - I have no more idea.
Maybe one of our @administrators will say some cleverness to you.Good luck.
-
I added the -F switch:
root@Omega-:~# avrdude -C /usr/share/arduino-dock/avrdude.conf -p atmega328p -c
linuxgpio -P gpio -v -F -U signature:w:0x1E,0x95,0x0F:mavrdude: Version 6.1, compiled on Mar 27 2018 at 01:00:08
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg WunschSystem wide configuration file is "/usr/share/arduino-dock/avrdude.conf" User configuration file is "/root/.avrduderc" User configuration file does not exist or is not a regular file, skipping Using Port : gpio Using Programmer : linuxgpio AVR Part : ATmega328P 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 : linuxgpio Description : Use the Linux sysfs interface to bitbang GPIO lines Pin assignment : /sys/class/gpio/gpio{n} RESET = ~19 SCK = 15 MOSI = 16 MISO = 17
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0xff6323
avrdude: Expected signature for ATmega328P is 1E 95 0F
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as 5
avrdude: reading input file "0x1E,0x95,0x0F"
avrdude: writing signature (3 bytes):Writing | ################################################## | 100% 0.00s
avrdude: 3 bytes of signature written
avrdude: verifying signature memory against 0x1E,0x95,0x0F:
avrdude: load data signature data from input file 0x1E,0x95,0x0F:
avrdude: input file 0x1E contains 3 bytes
avrdude: reading on-chip signature data:Reading | ################################################## | 100% 0.00s
avrdude: verifying ...
avrdude: 3 bytes of signature verifiedavrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as 5
avrdude: safemode: Fuses OK (E:05, H:DA, L:FF)avrdude done. Thank you.
BUT, it didn't change anything:
root@Omega-:~# avrdude -C /usr/share/arduino-dock/avrdude.conf -p atmega328p -c
linuxgpio -P gpio -v(output muted for brevity)
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0xe01cff
avrdude: Expected signature for ATmega328P is 1E 95 0F
Double check chip, or use -F to override this check.avrdude done. Thank you.
Seems like i need to burn a new boot loader, by using a 2nd ardrino as an "Ardino as ISP" programmer.
https://learn.sparkfun.com/tutorials/installing-an-arduino-bootloader.
The correct bootloader code is required for the atmega328p to accept programming from the serial port.
I wonder if the omega has access to the ICSP port. If not, i have a spare uno i could use as a programmer, but i am unsure which IDE settings to use, as the example in the link is for uno to uno.
-
i fixed it by following this:
https://www.arduino.cc/en/Tutorial/ArduinoISP
the procedure i used was:
upload ardrinoISP sketch to a spare Ardrino uno.
remove all connections and omega2+ from the ardino dock2.
connected the uno to the dock2 icsp port as shown in the 1st link.
set ardrino IDE to board "Ardrino/Genuino Uno"
set ardrino IDE programmer to "Ardino as ISP"
set port to /dev/tty/ACMOselected "burn bootloader"
disconnected the uno.
reinstalled the omega2+
now the dock2 is programmable via the omega2+ using
set ardrino IDE to board "Ardrino/Genuino Uno"
and
Programmer "AVRISP mII"
via the network port
root@Omega-:~# avrdude -C /usr/share/arduino-dock/avrdude.conf -p atmega328p -c linuxgpio -P gpio -n -v
reports consistently:
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e950f
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as 5avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as 5
avrdude: safemode: Fuses OK (E:05, H:DA, L:FF)avrdude done. Thank you.
-
@C-G Congratulations!
So the external programmer (the other Arduino) was reading the correct signature and that's how it was able to (re)write the chip.
I don't fully understand the way your method works but that's not the point. The main thing is that everything is working fine now.Onion's official Arduino IDE setting (IDE >> Tools) is different than yours:
Board: "Onion Arduino Dock"
Port: "Omega-XXXX at_IP_address (Arduino/Genuino Uno)"
Programmer: "irrelevant"vs.
Board "Ardrino/Genuino Uno"
Port: "network port"
Programmer "AVRISP mII"But if this is working out for you ... that's your call.
Footnote:
I'm sorry the original cause of the error was not revealed after all. I wouldn't want to reproduce it intentionally but if I accidentally stumble upon this error I'll try your method too.
-
@C-G Thanks so much. This totally worked. Don't forget the 10 micro-f capacitor between ground and reset on the programming Arduino.
-
@Matthew-Lousteau Take that back. I reacted too quickly.
-
@Matthew-Lousteau OK. so it works, but if I have a ground pin connected into my project, it won't let me flash my sketch. If I disconnect the ground pin, I can flash the sketch and reconnect the pin afterwards and the sketch runs as I expected.