Picade PCB connection problem after trying to flash new firmware 2.3

Hello,
as I wanted my Picade PCB behave like a game pad I tried to flash the latest firmware 2.3 on it. I used my PC running Ubuntu for this process and connected it via USB. The update script stopped with these messages:
avrdude: safemode: Verify error - unable to read lfuse properly. Programmer may not be reliable.
avrdude: safemode: To protect your AVR the programming will be aborted
Then I googled a litte bit and got the information that you can run avrdude with option -u to override safe mode. So I added -u to the last avrdude command in the update script. After 11% the message ‘0.38savrdude: error: programmer did not respond to command: set addr
avrdude: error: programmer did not respond to command: write block’ appeared followed by a lot of further error messages. I add the log with most interesting messages here: [spoiler]gianni@ATELCO-PC:~ lsusb Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 002: ID 046d:c52b Logitech, Inc. Unifying Receiver Bus 001 Device 003: ID 2341:8036 Arduino SA Leonardo (CDC ACM, HID) Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub gianni@ATELCO-PC:~ git clone https://github.com/pimoroni/Picade-Sketch
Klone nach ‘Picade-Sketch’ …
remote: Enumerating objects: 230, done.
remote: Total 230 (delta 0), reused 0 (delta 0), pack-reused 230
Empfange Objekte: 100% (230/230), 177.83 KiB | 648.00 KiB/s, Fertig.
Löse Unterschiede auf: 100% (111/111), Fertig.
gianni@ATELCO-PC:~ cd Picade-Sketch/ gianni@ATELCO-PC:~/Picade-Sketch ls -l
insgesamt 24
drwxr-xr-x 2 gianni gianni 4096 Jan 20 13:48 Config
drwxr-xr-x 2 gianni gianni 4096 Jan 20 13:48 Picade
-rw-r–r-- 1 gianni gianni 3326 Jan 20 13:48 picade.inf
drwxr-xr-x 2 gianni gianni 4096 Jan 20 13:48 PicadeMegadrive
-rw-r–r-- 1 gianni gianni 1284 Jan 20 13:48 README.md
drwxr-xr-x 3 gianni gianni 4096 Jan 20 13:48 update
gianni@ATELCO-PC:~/Picade-Sketch$ cd update/
gianni@ATELCO-PC:~/Picade-Sketch/update$ ls -l
insgesamt 140
lrwxrwxrwx 1 gianni gianni 26 Jan 20 13:48 fw_experimental.hex -> ./other/picade_gamepad.hex
lrwxrwxrwx 1 gianni gianni 37 Jan 20 13:48 fw_nodetect.hex -> ./picade_v2.3_no-headphone-detect.hex
lrwxrwxrwx 1 gianni gianni 12 Jan 20 13:48 fw_stable.hex -> ./picade.hex
drwxr-xr-x 2 gianni gianni 4096 Jan 20 13:48 other
-rw-r–r-- 1 gianni gianni 44457 Jan 20 13:48 picade.hex
-rw-r–r-- 1 gianni gianni 39196 Jan 20 13:48 picade_v2.2.hex
-rw-r–r-- 1 gianni gianni 42608 Jan 20 13:48 picade_v2.3_no-headphone-detect.hex
-rw-r–r-- 1 gianni gianni 1451 Jan 20 13:48 README.md
-rwxr-xr-x 1 gianni gianni 3217 Jan 20 13:48 update
gianni@ATELCO-PC:~/Picade-Sketch/update$ cd /dev
gianni@ATELCO-PC:/dev$ ls tty*
tty tty17 tty26 tty35 tty44 tty53 tty62 ttyS11 ttyS20 ttyS3
tty0 tty18 tty27 tty36 tty45 tty54 tty63 ttyS12 ttyS21 ttyS30
tty1 tty19 tty28 tty37 tty46 tty55 tty7 ttyS13 ttyS22 ttyS31
tty10 tty2 tty29 tty38 tty47 tty56 tty8 ttyS14 ttyS23 ttyS4
tty11 tty20 tty3 tty39 tty48 tty57 tty9 ttyS15 ttyS24 ttyS5
tty12 tty21 tty30 tty4 tty49 tty58 ttyACM0 ttyS16 ttyS25 ttyS6
tty13 tty22 tty31 tty40 tty5 tty59 ttyprintk ttyS17 ttyS26 ttyS7
tty14 tty23 tty32 tty41 tty50 tty6 ttyS0 ttyS18 ttyS27 ttyS8
tty15 tty24 tty33 tty42 tty51 tty60 ttyS1 ttyS19 ttyS28 ttyS9
tty16 tty25 tty34 tty43 tty52 tty61 ttyS10 ttyS2 ttyS29
gianni@ATELCO-PC:/dev$ lsusb
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 001 Device 003: ID 2341:8036 Arduino SA Leonardo (CDC ACM, HID)
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
gianni@ATELCO-PC:/dev$ cd ~
gianni@ATELCO-PC:~ cd Picade-Sketch/ gianni@ATELCO-PC:~/Picade-Sketch cd update/
gianni@ATELCO-PC:~/Picade-Sketch/update$ ./update

Picade Updater. Version 1.1

Checking for required packages…
avrdude is required
Updating apt indexes…
…[sudo] Passwort für gianni: …

Use of uninitialized value $value in substitution (s///) at /usr/bin/apt-show-versions line 591, line 2960.
Use of uninitialized value $value in substitution (s///) at /usr/bin/apt-show-versions line 592, line 2960.
Use of uninitialized value $value in substitution (s///) at /usr/bin/apt-show-versions line 591, line 1418.
Use of uninitialized value $value in substitution (s///) at /usr/bin/apt-show-versions line 592, line 1418.
Reading package lists…

Installing avrdude…

python-serial is required
Installing python-serial…

Please choose a firmware to flash:

0 : standard (recommended)
1 : no headphone detection
2 : experimental (serial control)

Enter an option [0-2]:0

Flashing standard firmware

Updating should continue automatically.
If not, press reset on your Picade.

Traceback (most recent call last):
File “”, line 1, in
File “/usr/lib/python2.7/dist-packages/serial/serialutil.py”, line 240, in init
self.open()
File “/usr/lib/python2.7/dist-packages/serial/serialposix.py”, line 268, in open
raise SerialException(msg.errno, “could not open port {}: {}”.format(self._port, msg))
serial.serialutil.SerialException: [Errno 13] could not open port /dev/ttyACM0: [Errno 13] Permission denied: ‘/dev/ttyACM0’
^C
gianni@ATELCO-PC:~/Picade-Sketch/update$ cd /dev
gianni@ATELCO-PC:/dev$ ls -l ttyA*
crw-rw---- 1 root dialout 166, 0 Jan 20 13:37 ttyACM0
gianni@ATELCO-PC:/dev$ cd ~
gianni@ATELCO-PC:~ cd Picade-Sketch/ gianni@ATELCO-PC:~/Picade-Sketch cd update/
gianni@ATELCO-PC:~/Picade-Sketch/update$ su - root
Passwort:
root@ATELCO-PC:~# cd /home/gianni/Picade-Sketch/update/
root@ATELCO-PC:/home/gianni/Picade-Sketch/update# ./update

Picade Updater. Version 1.1

Checking for required packages…
avrdude is already installed
python-serial is already installed
Please choose a firmware to flash:

0 : standard (recommended)
1 : no headphone detection
2 : experimental (serial control)

Enter an option [0-2]:0

Flashing standard firmware

Updating should continue automatically.
If not, press reset on your Picade.

Connecting to programmer: .
Found programmer: Id = “CATERIN”; type = S
Software Version = 1.0; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=128 bytes.

Programmer supports the following devices:
Device code: 0x44

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9587 (probably m32u4)
avrdude: safemode: Verify error - unable to read lfuse properly. Programmer may not be reliable.
avrdude: safemode: To protect your AVR the programming will be aborted

avrdude done. Thank you.

root@ATELCO-PC:/home/gianni/Picade-Sketch/update# nano update

Here I added option -u to avrdude command of update script

root@ATELCO-PC:/home/gianni/Picade-Sketch/update# ./update

Picade Updater. Version 1.1

Checking for required packages…
avrdude is already installed
python-serial is already installed
Please choose a firmware to flash:

0 : standard (recommended)
1 : no headphone detection
2 : experimental (serial control)

Enter an option [0-2]:0

Flashing standard firmware

Updating should continue automatically.
If not, press reset on your Picade.

Connecting to programmer: .
Found programmer: Id = “CATERIN”; type = S
Software Version = 1.0; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=128 bytes.

Programmer supports the following devices:
Device code: 0x44

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9587 (probably m32u4)
avrdude: reading input file “./fw_stable.hex”
avrdude: input file ./fw_stable.hex auto detected as Intel Hex
avrdude: writing flash (15800 bytes):

Writing | ###### | 11% 0.38savrdude: error: programmer did not respond to command: set addr
avrdude: error: programmer did not respond to command: write block
Writing | ###### | 12% 0.39s ***failed;
***failed;
***failed;

***failed;
***failed;
avrdude: Error: butterfly programmer uses avr_write_page() but does not
provide a cmd() method.
*** page 127 (addresses 0x0000 - 0x007f) failed to write

***failed;
***failed;
***failed;

avrdude: Error: butterfly programmer uses avr_write_page() but does not
provide a cmd() method.
*** page 127 (addresses 0x0080 - 0x00ff) failed to write

***failed;
***failed;

***failed;
avrdude: Error: butterfly programmer uses avr_write_page() but does not
provide a cmd() method.
*** page 127 (addresses 0x0100 - 0x017f) failed to write

***failed;

***failed;
avrdude: Error: butterfly programmer uses avr_write_page() but does not
provide a cmd() method.
*** page 127 (addresses 0x0180 - 0x01ff) failed to write

***failed;
***failed;

***failed;
***failed;
avrdude: Error: butterfly programmer uses avr_write_page() but does not
provide a cmd() method.
*** page 127 (addresses 0x0200 - 0x027f) failed to write

***failed;
***failed;
***failed;
***failed;
***failed;

***failed;
avrdude: Error: butterfly programmer uses avr_write_page() but does not
provide a cmd() method.
*** page 127 (addresses 0x0280 - 0x02ff) failed to write

***failed;
***failed;
***failed;
***failed;

***failed;
***failed;
avrdude: Error: butterfly programmer uses avr_write_page() but does not
provide a cmd() method.
*** page 127 (addresses 0x0300 - 0x037f) failed to write

***failed;
***failed;
*
***failed;
avrdude: Error: butterfly programmer uses avr_write_page() but does not
provide a cmd() method.
*** page 127 (addresses 0x0380 - 0x03ff) failed to write

***failed;
***failed;

***failed;
avrdude: Error: butterfly programmer uses avr_write_page() but does not
provide a cmd() method.
*** page 127 (addresses 0x0400 - 0x047f) failed to write

***failed;
***failed;

***failed;
avrdude: Error: butterfly programmer uses avr_write_page() but does not
provide a cmd() method.
*** page 127 (addresses 0x0480 - 0x04ff) failed to write

***failed;
***failed;

…and so on …

***failed;
***failed;
avrdude: Error: butterfly programmer uses avr_write_page() but does not
provide a cmd() method.
*** page 127 (addresses 0x1200 - 0x127f) failed to write

***failed;
***failed;
***failed;
***failed;
Writing | ############### | 30% 0.42s ***failed;
***failed;
***failed;
***failed;
***failed;
***failed;
avrdude: Error: butterfly programmer uses avr_write_page() but does not
provide a cmd() method.
*** page 55 (addresses 0x3d38 - 0x3db7) failed to write

Writing | ################################################## | 100% 0.48s

avrdude: 15800 bytes of flash written
avrdude: verifying flash memory against ./fw_stable.hex:
avrdude: load data flash data from input file ./fw_stable.hex:
avrdude: input file ./fw_stable.hex auto detected as Intel Hex
avrdude: input file ./fw_stable.hex contains 15800 bytes
avrdude: reading on-chip flash data:

Reading | | 0% 0.00savrdude: error: programmer did not respond to command: set addr
avrdude: error: programmer did not respond to command: set addr
Reading | # | 1% 0.01savrdude: error: programmer did not respond to command: set addr
Reading | # | 2% 0.01savrdude: error: programmer did not respond to command: set addr
Reading | ## | 3% 0.01savrdude: error: programmer did not respond to command: set addr
Reading | ## | 4% 0.01savrdude: error: programmer did not respond to command: set addr
avrdude: error: programmer did not respond to command: set addr
Reading | ### | 5% 0.02savrdude: error: programmer did not respond to command: set addr
Reading | ### | 6% 0.02savrdude: error: programmer did not respond to command: set addr
Reading | #### | 7% 0.03savrdude: error: programmer did not respond to command: set addr
Reading | #### | 8% 0.03savrdude: error: programmer did not respond to command: set addr
avrdude: error: programmer did not respond to command: set addr
Reading | ##### | 9% 0.04savrdude: error: programmer did not respond to command: set addr
Reading | ##### | 10% 0.04savrdude: error: programmer did not respond to command: set addr
Reading | ###### | 11% 0.04savrdude: error: programmer did not respond to command: set addr
Reading | ###### | 12% 0.04savrdude: error: programmer did not respond to command: set addr
avrdude: error: programmer did not respond to command: set addr
Reading | ####### | 13% 0.05savrdude: error: programmer did not respond to command: set addr
Reading | ####### | 14% 0.05savrdude: error: programmer did not respond to command: set addr
Reading | ######## | 15% 0.06savrdude: error: programmer did not respond to command: set addr
Reading | ######## | 16% 0.06savrdude: error: programmer did not respond to command: set addr
avrdude: error: programmer did not respond to command: set addr
Reading | ######### | 18% 0.31savrdude: butterfly_recv(): programmer is not responding
Reading | ########## | 20% 5.31savrdude: butterfly_recv(): programmer is not responding
Reading | ########### | 21% 11.82savrdude: butterfly_recv(): programmer is not responding
Reading | ########### | 22% 17.62s^C

I aborted the hanging script at 22% verifying and pressed reset on the PCB

root@ATELCO-PC:/var/lock# lsusb
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 011: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
root@ATELCO-PC:/var/lock# cd /dev
root@ATELCO-PC:/dev# ls ttyA*
ls: Zugriff auf ‘ttyA*’ nicht möglich: Datei oder Verzeichnis nicht gefunden
root@ATELCO-PC:/dev# exit[/spoiler]

Now when I try to connect to the PCB lsusb doen’t show the device anymore, also /dev/ttyACM0 is missing. How can I flash the PCB again? And why didn’t work the update script?
Thx

Do you see anything in lsusb immediately following connection or pressing reset? When you plug in the Picade it should spend a brief period in bootloader mode.

You might have better luck with dmesg -w checking for the output.

The bad flash could be due to a flaky USB cable- seems to be the case when this happens to me. It’d been a long, long time since I’ve touched the Picade PCB though so my debugging knowledge will be very poor.

I have solved the problem by using an AVR programmer connected to the SPI header.

1 Like

Excellent! I remembered it’s possible to reflash via the Pi if all else fails, but if you’ve got an AVR programmer then you’re set.