force totumduino flashing - Opentotum/Opentotum GitHub Wiki
Symptomatology
You want to flash your Totumduino and it won't with this error message (you see it directly if using commandline via ssh, or showing the trace in the recovery menu of a recent FABUI):
avrdude-original: stk500_getsync() attempt 1 of 10: not in sync: resp=0x65
avrdude-original: stk500_getsync() attempt 2 of 10: not in sync: resp=0x63
avrdude-original: stk500_getsync() attempt 3 of 10: not in sync: resp=0x68
avrdude-original: stk500_getsync() attempt 4 of 10: not in sync: resp=0x6f
avrdude-original: stk500_getsync() attempt 5 of 10: not in sync: resp=0x3a
Other remedies around, to which you should pay attention, but are not part of this solution:
- Use the latest version of FABUI
- Use a new SDCard
- Reboot
- Try to reset manually the Totumduino with the switch button just before triggering the flash (hitting return in the command line or after it says it resetted in the UI).
I am not saying that those cannot cause this problem. What I say, from experience (lots of arduinos and quite a lot of Totumduino flashing), is that this has happened to me like 5 times with totally different FABUI versions.
This method has worked to me fine. If you come across such a "I refuse to flash" behaviour, please let us know if this worked for you (you can open a GitHub issue if there isn't one opened).
Rationale
It just comes from the idea that Arduinos do not usually refuse to be flashed (unless the bootloader is corrupted, which seldom happens), so it must be something with the UART. As you are resetting the Totumduino, then there is a big chance that the problem is the Raspberry pi.
The method
-
Make an SSH connection to your FABtotum, if you are using Linux you can just type:
ssh root@fabtotum
(default password is fabtotum) -
Stop Apache and Mysql, at least to avoid having errors in the logs because other process will be killed:
/etc/init.d/apache2 stop
/etc/init.d/mysql stop
-
List all the processes running in the RPi:
ps aux
-
Find in the list these two (by name) and note the process identifiers:
root 1505 0.0 1.9 50392 17508 ? S 18:47 0:00 php /var/www/fabui/script/socket_server.php
root 1506 0.4 1.2 112824 11116 ? Sl 18:47 0:06 python /var/www/fabui/python/monitor.py
- Kill those processes using
kill -9
like this (make sure to put your processid numbers not mine):
kill -9 1505 1506
Note: Probably it suffices to kill monitor.py. If you try and it works let us know it using the Issues in GitHub.
-
Go to the directory where you have previously uploaded your flash image. Usually the last tried one is still in /var/www/build.
-
Flash the totumduino from commandline using:
sudo /usr/bin/avrdude -D -q -V -p atmega1280 -C /etc/avrdude.conf -c arduino -b 57600 -P /dev/ttyAMA0 -U flash:w:Marlin.cpp.hex:i
NOTE: In a second try it has sufficed to me to kill the process "python /var/www/fabui/python/monitor.py"