starfive-tech / Tools

19 stars 6 forks source link

Document XMODEM behavior with good/bad chips #6

Open bluecmd opened 1 year ago

bluecmd commented 1 year ago

Hi!

I was playing around with the recovery feature on VisionFive2 and I had no luck getting it to work at all with a TTL-USB converter using this device:

Prolific Technology, Inc. PL2303 Serial Port / Mobile Action MA-8910

This is the errors:


Welcome to minicom 2.8                                                                        

OPTIONS: I18n                                                                                 
Comp+----------------[xmodem upload - Press CTRL-C to quit]----------------+                  
Port|Sending jh7110-recovery-20230322.bin, 1291 blocks: Give your local XMO|                  
    |DEM receive command now.                                              |                  
Pres|Xmodem sectors/kbytes sent: 1192/149kRetry 0: NAK on sector           |                  
    |                                                                      |                  
CCCC|                                                                      |                  
(C)S|                                                                      |                  
CCCC|                                                                      |                  
    +----------------------------------------------------------------------+                  

However, when I switch to using my trusty Future Technology Devices International, Ltd FT232 Serial (UART) IC based one the XMODEM inside Minicom worked on the first try. (115200 8N1, No flow control).

Welcome to minicom 2.8                                                                        

OPTIONS: I18n                                                                                 
Compiled on Jan 19 2023, 00:00:00.                                                            
Port /dev/ttyUSB0, 14:01:37                                                                   

Press CTRL-A Z for help on special keys                                                       

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
JH7110 secondboot version: 230322-c514da9                                                     
CPU freq: 1250MHz                                                                             
idcode: 0x1860C8                                                                              
ddr 0x00000000, 4M test                                                                       
ddr 0x00400000, 8M test                                                                       
DDR clk 2133M, size 4GB                                                                       

*********************************************************                                     
****************** JH7110 program tool ******************                                     
*********************************************************                                     
0: update 2ndboot/SPL in flash                                                                
1: update 2ndboot/SPL in emmc                                                                 
2: update fw_verif/uboot in flash                                                             
3: update fw_verif/uboot in emmc                                                              
4: update otp, caution!!!!                                                                    
5: exit                                                                                       
NOTE: current xmodem receive buff = 0x40000000, 'load 0x********' to change.                  
select the function to test:                                                                  

Might be worth mentioning on the recovery guide so that people don't pull their hair out trying to debug something that is due to a less-than-ideal TTL-serial-converter.

I repeated this experiement more than three times to ensure it was conclusive and it is. 0% success rate with my PL2303 adapter, 100% success rate with my FT232 one.

misuzu commented 1 year ago

I have this one and had no issues flashing the firmware:

Bus 003 Device 010: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port / Mobile Action MA-8910P
bluecmd commented 1 year ago

I have this one and had no issues flashing the firmware:

Bus 003 Device 010: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port / Mobile Action MA-8910P

Interesting. I have this one: https://vi.aliexpress.com/item/2027583503.html - do you have something else? Granted, I have no idea if it is an actual PL2303 or a clone IC that just pretends to be one. My IC is totally clean of any markings, so that makes me suspect it might be a clone.

misuzu commented 1 year ago

Mine is already unlisted unfortunately, but it looks like this one.

strlcat commented 1 year ago

Retry 0: NAK on sector should not be the problem, and process shall continue, on normal xmodem devices I have exactly same looking device as yours from https://github.com/starfive-tech/Tools/issues/6#issuecomment-1634182961, but mine shows as 067b:2303 Prolific Technology, Inc. PL2303 Serial Port / Mobile Action MA-8910P (note additional P) Might be difference.

eshattow commented 10 months ago

Reporting success with CP2102N Friend adapter from Adafruit web store and tio serial terminal software on Linux host.

Muzuwi commented 1 day ago

Just chiming in for posterity as I encountered the same issue OP has described while experimenting with my VisionFive2 board. In my case however, the FT232 refuses to work with xmodem unfortunately. I'm using a Waveshare TTL-USB dongle with supposedly a FT232RL on-board, but judging by the issues it may not be genuine after all (or there's some other variable at play that makes xmodem fail here).

Appears the same in lsusb:

$ lsusb
...
Bus 001 Device 007: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC

Failure looks similar (using screen, minicom yields the same result):

CCCCCCCCCCCCCCCCCCCSending jh7110-recovery-20221205.bin, 1291 blocks: Give your local XMODEM receive command now.
Xmodem sectors/kbytes sent:   0/ 0kRetry 0: NAK on sector
Retry 0: NAK on sector
Retry 0: NAK on sector
Retry 0: NAK on sector
Retry 0: NAK on sector
Xmodem sectors/kbytes sent:  13/ 1kRetry 0: NAK on sector
Retry 0: NAK on sector
Retry 0: NAK on sector
Retry 0: NAK on sector
Retry 0: NAK on sector
Retry 0: NAK on sector
Retry 0: NAK on sector
Retry 0: NAK on sector
Retry 0: NAK on sector
Retry 0: NAK on sector
Retry 0: NAK on sector
Retry 0: Retry Count Exceeded

Transfer incomplete
 Error

Will update this issue if I can figure out something more than the chip just being plain bad.

eshattow commented 1 day ago

Useless to spend more time on StarFive tools, they do not release source code.

There are tools to do this work that have source code available, now.