pvvx / TLSRPGM

TLSR SWire programmer
Other
45 stars 4 forks source link

Erase flash, then write program back but fail to running #9

Open Henry586 opened 2 months ago

Henry586 commented 2 months ago

Many thanks for such a great tools.

I just read flash from dongle, then erase flash, then write back, but it seems does not run any more. 1) read `D:\tlsr8258\TLSRPGM>TlsrPgm.py -w -t 5 -a 100 -c -pCOM8 -b1000000 rf 0 0x80000 dongle_512k.bin

TLSR82xx TlsrPgm version 31.10.23

Open COM8, 230400 bit/s... ok PGM: ChipID: 0x5562 (TLSR825x), ver: 0.0.0.2 swdiv 5, addrlen 3, swbuf [5a 00 06 02 00 05], pwr On SWire bit rate: 0.9600 Mbits/s Set Speed UART PGM board 1000000 bits/s... ok ReOpen COM8, 1000000 bit/s... ok === PreProcess ======================================== Hard reset Ext.MCU 5 ms... ok Activate 100 ms... ok CPU PC=0x00000000 CPU Stall... ok === Process =========================================== Outfile: dongle_512k.bin Read Flash from 0x000000 to 0x080000... Worked Time: 14.937 sec

D:\tlsr8258\TLSRPGM>`

2) erase flash and write it back: `D:\tlsr8258\TLSRPGM>TlsrPgm.py -s -pCOM8 ea

TLSR82xx TlsrPgm version 31.10.23

Open COM8, 230400 bit/s... ok PGM: ChipID: 0x5562 (TLSR825x), ver: 0.0.0.2 swdiv 5, addrlen 3, swbuf [5a 00 06 02 00 05], pwr On SWire bit rate: 0.9600 Mbits/s === PreProcess ======================================== CPU Stop... ok === Process =========================================== Write 0 to Flash Status Register... Flash Status Register: 0x00 Erase All Flash ...

D:\tlsr8258\TLSRPGM>TlsrPgm.py -w -t 5 -a 100 -c -pCOM8 -b1000000 we 0 dongle_512k.bin

TLSR82xx TlsrPgm version 31.10.23

Open COM8, 230400 bit/s... ok PGM: ChipID: 0x5562 (TLSR825x), ver: 0.0.0.2 swdiv 5, addrlen 3, swbuf [5a 00 06 02 00 05], pwr On SWire bit rate: 0.9600 Mbits/s Set Speed UART PGM board 1000000 bits/s... ok ReOpen COM8, 1000000 bit/s... ok === PreProcess ======================================== Hard reset Ext.MCU 5 ms... ok Activate 100 ms... ok CPU PC=0x00000000 CPU Stall... ok === Process =========================================== Inputfile: dongle_512k.bin Write 0 to Flash Status Register... Flash Status Register: 0x00 Write Flash data 0x00000000 to 0x00080000... Worked Time: 6.934 sec ` 3) try to restart but it does not work as expected.

Is there anything missing? Many thanks!

pvvx commented 1 month ago

TLSR8258 Flash memory can be 1 MB. Such chips are usually installed in Tuya's ZTU modules for Zigbee. You can find out the Flash size using the "i" command.

...
Flash JEDEC ID: 0xC86013, Size: 512 kbytes
...

When recording Flash, no full check is performed to speed up the process. If clarification of the record is required, then you should read it again and compare the files. It will take the same amount of time if build in the “verify” command.

Henry586 commented 1 month ago

that is output of 'i' command: `D:\tlsr8258\TLSRPGM>TlsrPgm.py -s -p com8 i

TLSR82xx TlsrPgm version 31.10.23

Open com8, 230400 bit/s... ok PGM: ChipID: 0x5562 (TLSR825x), ver: 0.0.0.2 swdiv 5, addrlen 3, swbuf [5a 00 06 02 00 05], pwr On SWire bit rate: 0.9600 Mbits/s === PreProcess ======================================== CPU Stop... ok === Process =========================================== Chip TLSR825x ID: 0x5562, rev: 0x02 CPU PC=0x00000000 ([0x0602] = 0x05) Flash JEDEC ID: 0xC86013, Size: 512 kbytes Flash Status Register: 0x00

FLASH UID: 000000: 41 50 33 41 31 37 36 18 00 98 01 24 08 08 ff ff 000010: c8 01 ff ff ff ff ff ff ff ff ff ff ff ff ff ff

FLASH: 000000: 26 80 00 00 00 00 5d 02 4b 4e 4c 54 ee 01 88 00 000010: 96 80 00 00 00 00 00 00 04 66 00 00 00 00 00 00

ANALOG REGISTERS: 000000: 48 4c a2 4f 48 02 ff 1d 05 00 00 38 c4 80 00 40 000010: 00 00 00 00 00 3c 00 00 00 00 00 00 00 00 00 40 000020: 54 00 00 00 00 00 00 00 00 00 00 2e 1f 15 00 00 000030: 20 2b 5d 80 80 20 00 00 00 ff 00 00 00 00 00 00 000040: 04 b7 01 00 80 00 00 00 00 00 00 00 ff ff ff 0f 000050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 000080: 48 4c a2 4f 48 02 ff 1d 05 00 00 38 c4 80 00 40 000090: 00 00 00 00 00 3c 00 00 00 00 00 00 00 00 00 40 0000a0: 54 00 00 00 00 00 00 00 00 00 00 2e 1f 15 00 00 0000b0: 20 2b 5d 80 80 20 00 00 00 ff 00 00 00 00 00 00 0000c0: 30 b7 01 00 80 00 00 00 00 00 00 00 ff ff ff 0f 0000d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0000e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0000f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01

REGISTERS: 000060: 00 00 c0 ff 1f 37 42 00 02 00 02 00 01 02 1f 00 000070: 00 04 00 04 00 00 00 00 00 00 00 64 00 02 62 55`

will try with verify command.

Henry586 commented 1 month ago

just read out binary file and compare with the original one, found they are same. but the i command return different values as below: `D:\tlsr8258\TLSRPGM>TlsrPgm.py -w -t 5 -a 100 -c -pCOM8 i

TLSR82xx TlsrPgm version 31.10.23

Open COM8, 230400 bit/s... ok PGM: ChipID: 0x5562 (TLSR825x), ver: 0.0.0.2 swdiv 5, addrlen 3, swbuf [5a 00 06 02 00 05], pwr On SWire bit rate: 0.9600 Mbits/s === PreProcess ======================================== Hard reset Ext.MCU 5 ms... ok Activate 100 ms... ok CPU PC=0x00000000 CPU Stall... ok === Process =========================================== Chip TLSR825x ID: 0x5562, rev: 0x02 CPU PC=0x0000016c ([0x0602] = 0x04) Flash JEDEC ID: 0xC86013, Size: 512 kbytes Flash Status Register: 0x00

FLASH UID: 000000: 41 50 33 41 31 37 36 18 00 98 01 24 08 08 ff ff 000010: c8 01 ff ff ff ff ff ff ff ff ff ff ff ff ff ff

FLASH: 000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

ANALOG REGISTERS: 000000: 48 4c a4 4f 48 02 ff 1d 05 00 00 7b c4 80 00 00 000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 000020: 54 00 00 00 00 00 00 00 00 00 00 2e 1f 15 00 00 000030: 20 20 80 80 07 20 00 00 00 ff 00 00 00 00 00 00 000040: 24 0b 00 00 80 00 00 00 00 00 00 00 ff ff ff 0f 000050: 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 000080: 48 4c a4 4f 48 02 ff 1d 05 00 00 7b c4 80 00 00 000090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 0000a0: 54 00 00 00 00 00 00 00 00 00 00 2e 1f 15 00 00 0000b0: 20 20 80 80 07 20 00 00 00 ff 00 00 00 00 00 00 0000c0: 4b 0b 00 00 80 00 00 00 00 00 00 00 ff ff ff 0f 0000d0: 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0000e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0000f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01

REGISTERS: 000060: 7c f7 c7 83 08 30 06 00 02 00 02 00 01 02 1f 00 000070: 00 04 00 04 00 00 00 00 00 00 00 64 00 02 62 55 Worked Time: 0.267 sec

D:\tlsr8258\TLSRPGM>`

pvvx commented 1 month ago

The processor is stopped in a different place in the program - therefore there may be different data in the registers...

On the second pass, Flash is not yet enabled. There was no SoC reset. "-t 5" - the reset pulse time of 5 ms is not enough to discharge the capacitor from the programmer pin at 4 mA or pin "reset" is not connected.

Henry586 commented 1 month ago

Yes, you are right, only have gnd,sws,pwr connected. Thanks, I will try to modify them and try again.