Ardrino Dock2 request reflash recovery proceedure
-
@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.