tjikkun / zigate-flasher

Python tool to flash your Zigate (Jennic JN5168)
GNU General Public License v3.0
17 stars 4 forks source link

IndexError: index out of range #3

Open dcolens opened 5 years ago

dcolens commented 5 years ago

Thanks for creating and publishing this project, I tried using it to flash multiple FW to a zigate and am getting the following error:

./zigate-flasher.py -p /dev/ttyUSB1 -w ../ZiGate_Coordinator_v3.0e.bin -e
Found MAC-address: 00:15:8d:00:01:b2:2a:54
writing new flash from ../ZiGate_Coordinator_v3.0e.bin
Traceback (most recent call last):
  File "./zigate-flasher.py", line 349, in <module>
    main()
  File "./zigate-flasher.py", line 345, in main
    erase_EEPROM(ser, args.pdm_only)
  File "./zigate-flasher.py", line 306, in erase_EEPROM
    res = read_response(ser)
  File "./zigate-flasher.py", line 102, in read_response
    return _unpack_raw_message(length, answer)
  File "./zigate-flasher.py", line 113, in _unpack_raw_message
    return _responses.get(type_, Response)(type_, data, chksum)
  File "./zigate-flasher.py", line 62, in __init__
    self.status = data[0]
IndexError: index out of range

I don't get this error when using JennicModuleProgrammer.

pipiche38 commented 5 years ago

Same problem here: python3 zigate-flasher.py -p /dev/ttyUSBRPI3 -e -w /tmp/ZiGate_v3.1b.bin Found MAC-address: 00:15:8d:00:01:c6:1b:bb writing new flash from /tmp/ZiGate_v3.1b.bin Traceback (most recent call last): File "zigate-flasher.py", line 349, in main() File "zigate-flasher.py", line 345, in main erase_EEPROM(ser, args.pdm_only) File "zigate-flasher.py", line 306, in erase_EEPROM res = read_response(ser) File "zigate-flasher.py", line 102, in read_response return _unpack_raw_message(length, answer) File "zigate-flasher.py", line 113, in _unpack_raw_message return responses.get(type, Response)(type_, data, chksum) File "zigate-flasher.py", line 62, in init self.status = data[0] IndexError: index out of range

Looks like it is related to the use of Erase option

pipiche38 commented 3 years ago

@tjikkun do you have any idea on how to fix this issue ? Basically I'm not able to Erase EEPROM nor PDM

tjikkun commented 3 years ago

@doudz wrote this part (erase option). I haven't played with Zigate for a while now so have not really tested that part myself. From what I remember this was not a documented feature of the bootloader. If I recall correctly JennicModuleProgrammer uses a boot image that it boots from, which then erases the EEPROM from within that boot.

chrisaga commented 3 years ago

Hello. I am struggleling with my ZiGate update witch lead me to zigate-flasher. As far as I understand, both JennicModuleProgrammer and zigate-flasher erase the FLASH memory with command 0x07 before writing the new firmware. zigate-flasher implements an undocumented (and apparently not functional) command 0x36 to erase EEPROM. Dont know what we are supposed to achieve with that.

pipiche38 commented 3 years ago

My understand is that the command 0x07 is an Erase in preparation of the flash ( this is done by JeenicModuleProgrammer as well as the zigate-flasher), the 0x37 is done after the flash to Erase the EEPROM

chrisaga commented 3 years ago

Yes, I think this is the idea. Unfortunately, erasing the EEPROM doesn't work. I needed it and I managed to run the windows utility under wine to achieve that. I have no access to the sources nor to debuging tools so I don't know how it's done.

doudz commented 3 years ago

2 years ago I started to port NXP programmer to Python3, it's not working but it can help https://github.com/doudz/nxp_flashprogrammer