dresden-elektronik / gcfflasher

GCFFlasher is the tool to program the firmware of dresden elektronik's Zigbee products.
BSD 3-Clause "New" or "Revised" License
34 stars 3 forks source link

GCFFlasher_internal causes USB serial device to be unregistered and fails #12

Closed mattiasflodin closed 7 months ago

mattiasflodin commented 1 year ago

I connect ConBee stick and see this in kernel log:

[ 4749.160117] usb 1-3: new full-speed USB device number 8 using xhci_hcd
[ 4749.316628] usb 1-3: New USB device found, idVendor=0403, idProduct=6015, bcdDevice=10.00
[ 4749.316637] usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 4749.316641] usb 1-3: Product: FT230X Basic UART
[ 4749.316645] usb 1-3: Manufacturer: FTDI
[ 4749.316649] usb 1-3: SerialNumber: DJ00QDS1
[ 4749.346114] usbcore: registered new interface driver usbserial_generic
[ 4749.346138] usbserial: USB Serial support registered for generic
[ 4749.348573] usbcore: registered new interface driver ftdi_sio
[ 4749.348583] usbserial: USB Serial support registered for FTDI USB Serial Device
[ 4749.348632] ftdi_sio 1-3:1.0: FTDI USB Serial Device converter detected
[ 4749.348661] usb 1-3: Detected FT-X
[ 4749.349085] usb 1-3: FTDI USB Serial Device converter now attached to ttyUSB0

I run GCFFlasher_internal -l:

GCFFlasher V3_17 (c) dresden elektronik ingenieurtechnik gmbh
Path             | Vendor | Product | Serial     | Type
-----------------+--------+---------+------------+-------
/dev/ttyUSB0     | 0x0403 | 0x6015  | DJ00QDS1   | ConBee 

I try to update firmware by running

GCFFlasher_internal -t 60 -d /dev/ttyUSB0 -f deCONZ_Rpi_0x26400500.bin.GCF -sn DJ00QDS1 -x 3

GCFFlasher_internal outputs this in a loop for 60 seconds then gives up:

10:06:21:928 using firmware file: deCONZ_Rpi_0x26400500.bin.GCF 
10:06:21:975 ls dev: /dev/ttyACM0 (0x0658/0x0200) sn: 
10:06:21:975 device /dev/ttyUSB0 not found
10:06:21:975 retry, elapsed 0 seconds
10:06:22:070 parse commands: /usr/bin/GCFFlasher_internal.bin -t 60 -d /dev/ttyUSB0 -f deCONZ_Rpi_0x26400500.bin.GCF -sn DJ00QDS1 -x 3

At the same time, I see this in kernel log:

[ 4788.425720] usbserial: USB Serial deregistering driver FTDI USB Serial Device
[ 4788.426059] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
[ 4788.426081] usbcore: deregistering interface driver ftdi_sio
[ 4788.426110] ftdi_sio 1-3:1.0: device disconnected
[ 4788.451842] usbserial: USB Serial deregistering driver generic
[ 4788.451925] usbcore: deregistering interface driver usbserial_generic

The /dev/ttyUSB0 device is now gone from the file system. It appears that running GCFFlasher_internal immediately causes the /dev/ttyUSB0 device to unregister and then it can't find it.

How do I make this work so I can update firmware on my ConBee stick?

ChrisHae commented 1 year ago

Some solution ideas:

mattiasflodin commented 1 year ago

I discarded the -sn parameter (this was something I added later when just -d didn't work) and then tried to unplug and reconnect the conbee during update. That gave me another behavior that seems to go further but it still loops and eventually fails.

21:22:17:461 using firmware file: deCONZ_Rpi_0x26400500.bin.GCF 
21:22:17:486 ls dev: /dev/ttyUSB0 (0x0403/0x6015) sn: DJ00QDS1
Reboot device /dev/serial/by-id/usb-FTDI_FT230X_Basic_UART_DJ00QDS1-if00-port0 (ConBee)
21:22:17:486 query bootloader v1 ID after 0 ms
21:22:17:987 close serial after 500
21:22:18:990 query bootloader v1 ID after 1503 ms
21:22:19:491 close serial after 2004
21:22:19:493 query deCONZ firmware version
21:22:19:509 SLIP RX frame length: 9
deCONZ firmware version 261F0500
21:22:19:509 send watchdog reset 2 seconds
slip put 0xC0
slip put 0x0B
slip put 0x19
slip put 0x00
slip put 0x0C
slip put 0x00
slip put 0x05
slip put 0x00
slip put 0x26
slip put 0x02
slip put 0x00
slip put 0x00
slip put 0x00
slip put 0xA3
slip put 0xFF
slip put 0xC0
21:22:19:509 TX c00b19000c0005002602000000a3ffc0
21:22:19:525 set watchdog ttl status: 0x04
retry, failed

After timeout it ends with

2410: Error: uart reset failed, check retry
mattiasflodin commented 1 year ago

Update: I tried the v4.0.0-beta release from this repository and it core dumps when I run the -l flag to list devices, but it actually succeeded in flashing new firmware. Thanks!

manup commented 7 months ago

Closing this for now, the latest GCFFlasher 4.x versions support all ConBee and RaspBee devices, and not crash ;)