Ameba-AIoT / ameba-arduino-pro2

AmebaPro2 Arduino third-party package SDK
https://www.amebaiot.com/en/ameba-arduino-summary/
MIT License
49 stars 23 forks source link

RTL8735BM programming not working with uartfwburn.linux, ping failure #152

Closed dashxdr closed 10 months ago

dashxdr commented 11 months ago

When I try to program an image to my device using

./uartfwburn.linux -p /dev/ttyUSB0 -f flash_ntz.nn.bin -b 115200 -U

I get errors like ping failure, as uartfwburn.linux is unable to confirm the device is present. I'm using just RX and TX without any hardware flow control. I know the device is in BootFromUART mode, here is the uart log:

== Rtl8735b IoT Platform == Chip VID: 0, Ver: 0 ROM Version: v3.0

[Normal mode] BootFromNORFlash [SPIF Err]Invalid ID [SPIF Err]Invalid ID [BOOT Err]Flash init error (io_mod=0, pin_sel=0) Fallback to NAND Flash Boot from NAND Flash [BOOT Err]snafc init error Fallback NOR Flash BootFromNORFlash [SPIF Err]Invalid ID [SPIF Err]Invalid ID [BOOT Err]Flash init error (io_mod=0, pin_sel=0) Fallback to NAND Flash Boot from NAND Flash [BOOT Err]snafc init error Fallback NOR Flash BootFromNORFlash [SPIF Err]Invalid ID [SPIF Err]Invalid ID [BOOT Err]Flash init error (io_mod=0, pin_sel=0) Fallback to NAND Flash Boot from NAND Flash [BOOT Err]snafc init error Fallback NOR Flash BootFromUART Image Load over UART1 baud=115200

Since uartfwburn.linux is closed source I have no idea how to proceed. Is there any documentation on the protocol the RTL8735 uses during the uart boot process?

Thanks anyone for any help! -Dave

github-actions[bot] commented 11 months ago

Hello, hope this message finds you well. Congrats to your first Issue! We will review it as soon as possiable. Feel free to have a look at https://www.amebaiot.com/en/ameba-arduino-summary/ for more information

dashxdr commented 11 months ago

Posted this question also here: https://forum.amebaiot.com/t/rtl8735bm-programming-not-working-with-uartfwburn-linux-ping-failure/2483

M-ichae-l commented 11 months ago

This tool is build in Arduino package it is not recommend to use it independently. Try ./uartfwburn.linux -p /dev/ttyUSB0 -f flash_ntz.nn.bin -b 115200 -U -x 32 -r

dashxdr commented 11 months ago

@M-ichae-l I was able to get the board into the usual flashrom programming mode and the uartfwburn.linux works when I use "-n pro2". Unfortunately the image isn't acceptable to the RTL8735,I get this error:

== Rtl8735b IoT Platform ==
Chip VID: 0, Ver: 0
ROM Version: v3.0

[Normal mode]
BootFromNORFlash
[Start Boot ROM...]
=== Load CERTI ===
[BOOT Err]ld_certi_idx err:-1
[BOOT Err]StartUp@0x0: Invalid RAM Img Signature!Boot_err(0x11)

Is there any way to erase the certification requirement on the RTL8735? My guess is this is happening because of something written into its flashrom.

I just want to disable any CERT requirement if possible. Thanks!

M-ichae-l commented 11 months ago

If you are using AMB82-mini, you can refer to https://www.amebaiot.com/en/amebapro2-amb82-mini-arduino-getting-started/ for "erase flash" Other boards at this SDK can't.

dashxdr commented 11 months ago

@M-ichae-l I think I can erase and program the 8 pin flash device, the trouble is the RTL8735 doesn't accept anything but the original image programmed to it. I need to be able to reprogram the flashrom of the RTL8735 itself to change its behaviour. I tried those options but the end result is the same... RTL8735 refuses to load my file.

M-ichae-l commented 11 months ago

@dashxdr
Do you mean that you have tried Erase All Flash Memory (16MB) under Arduino IDE with hardware AMB82-mini. And still cant upload the code.

dashxdr commented 11 months ago

@M-ichae-l Yes I've tried that. The 8 pin 16 megabyte flashrom can be erased and rewritten. That's not the problem. The problem is the RTL8735 doesn't accept anything but the original image burned into the 16 megabyte flashrom.

This is a hardware device equivalent to the AMB82-MINI development board. I want to be able to reprogram it. Something has been done to this device that prevents me from loading my own code and having it executed.

Is there any way to prevent the RTL8735 boot process from checking the certificate?

M-ichae-l commented 11 months ago

@dashxdr Unfortunately the boot process can not be changed under this SDK. You may want to try the following suggestions.