Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with flashing wifi stick (data transfer issues?) #23

Closed
ErwinP opened this issue Feb 29, 2024 · 5 comments
Closed

Problems with flashing wifi stick (data transfer issues?) #23

ErwinP opened this issue Feb 29, 2024 · 5 comments

Comments

@ErwinP
Copy link

ErwinP commented Feb 29, 2024

Hi all,

I'm quite used to flashing devices using UART (mostly shelly plugs and sonoff switches) but this wifi stick is giving me more problems that I anticipated :-/

I had the same as user Belaial (from the image here) and I can confirm what kuba2k2 mentioned here: these adapters are apparently not strong enough for the required baudrate. I bought a new one, based on the FT232 and only with that adapter was able to communicate in the download mode, using ltchiptool-v4.10.2.

I compiled the firmware using esphome on my other computer, and tried to flash the firmware.uf2 using the Windows version. However, during upload, I get the following errors:

I: Found new device: COM7 - USB Serial Port - FTDI (0403/6001)
I: Transmission successful (ACK received).
I: Transmission successful (ACK received).
E: send error: expected ACK; got b'\x15' for block 2
E: send error: expected ACK; got b'\x15' for block 2
E: send error: expected ACK; got b'\x15' for block 19
E: send error: expected ACK; got b'\x15' for block 19
E: send error: expected ACK; got b'\x15' for block 23
E: send error: expected ACK; got b'\x15' for block 23
...
E: send error: expected ACK; got b'\x15' for block 168
E: send error: expected ACK; got b'\x15' for block 168
I: Transmission successful (ACK received).
I: Transmission successful (ACK received).
I: Transmission successful (ACK received).
I: Transmission successful (ACK received).

I'm not quite sure what these write errors have as a consequence, but I've tried it multiple times and I think the amount of errors differs between some runs. When I read out the terminal during normal boot, it always reboots during the scanning of the wifi:

<RTL8195A>ROM:[V0.1]
FLASHRATE:4
BOOT TYPE:0 XTAL:40000000
IMG1 DATA[1128:10002000]
IMG1 ENTRY[800053d:100021ef]
IMG1 ENTER
CHIPID[000000ff]
read_mode idx:0, flash_speed idx:0
calibration_result:[1:0:0][ff:ff] 
calibration_result:[2:0:0][ff:ff] 
calibration_result:[3:0:0][ff:ff] 

FLASH Calibration Fail!!!
Please set proper flash speed and read mode in SYSTEM DATA!!!

OTA2 ADDR[8100000]
OTAx SELE[ffffffff]
OTA1 USE
IMG2 DATA[0x80b40d0:4520:0x10005000]
IMG2 SIGN[RTKWin(10005008)]
IMG2 ENTRY[0x10005000:0x8041eb1]
BOOT_FLASH_RDP RDP enable 
SYSTEM.bin RDP Empty.
System_Init1
System_Init2
I [      0.000] LibreTiny v1.5.0 on generic-rtl8710bx-4mb-980k, compiled at Feb 29 2024 05:55:03, GCC 10.3.1 (-Os)
[I][logger:395]: Log initialized
[C][ota:473]: There have been 9 suspected unsuccessful boot attempts.
[D][lt.preferences:104]: Saving 1 preferences to flash...
[D][lt.preferences:132]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[I][app:029]: Running through setup()...
[C][uart.lt:049]: Setting up UART...
[C][switch.gpio:011]: Setting up GPIO Switch 'led_orange_com'...
[D][switch:016]: 'led_orange_com' Turning OFF.
[D][switch:055]: 'led_orange_com': Sending state OFF
[D][switch:016]: 'led_orange_com' Turning OFF.
[C][switch.gpio:011]: Setting up GPIO Switch 'led_green_net'...
[D][switch:016]: 'led_green_net' Turning OFF.
[D][switch:055]: 'led_green_net': Sending state OFF
[D][switch:016]: 'led_green_net' Turning OFF.
[C][switch.gpio:011]: Setting up GPIO Switch 'wdt_reset'...
[D][switch:016]: 'wdt_reset' Turning OFF.
[D][switch:055]: 'wdt_reset': Sending state OFF
[D][switch:016]: 'wdt_reset' Turning OFF.
[D][binary_sensor:034]: 'button_reset': Sending initial state OFF
[C][wifi:038]: Setting up WiFi...
[C][wifi:051]: Starting WiFi...
[C][wifi:052]:   Local MAC: D0:BA:E4:88:8E:EC
interface 0 is initialized
interface 1 is initialized

Initializing WIFI ...
WIFI initialized
[D][wifi:455]: Starting scan...
<RTL8195A>ROM:[V0.1]
FLASHRATE:4
BOOT TYPE:0 XTAL:40000000
IMG1 DATA[1128:10002000]
IMG1 ENTRY[800053d:100021ef]
IMG1 ENTER
CHIPID[000000ff]
read_mode idx:0, flash_speed idx:0
calibration_result:[1:0:0][ff:ff] 
calibration_result:[2:0:0][ff:ff] 
calibration_result:[3:0:0][ff:ff] 

FLASH Calibration Fail!!!
Please set proper flash speed and read mode in SYSTEM DATA!!!

OTA2 ADDR[8100000]
OTAx SELE[ffffffff]
OTA1 USE
IMG2 DATA[0x80b40d0:4520:0x10005000]
IMG2 SIGN[RTKWin(10005008)]
IMG2 ENTRY[0x10005000:0x8041eb1]
BOOT_FLASH_RDP RDP enable 
SYSTEM.bin RDP Empty.
System_Init1
System_Init2
I [      0.000] LibreTiny v1.5.0 on generic-rtl8710bx-4mb-980k, compiled at Feb 29 2024 05:55:03, GCC 10.3.1 (-Os)
[I][logger:395]: Log initialized
[C][ota:473]: There have been 10 suspected unsuccessful boot attempts.
[D][lt.preferences:104]: Saving 1 preferences to flash...
[D][lt.preferences:132]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[E][ota:480]: Boot loop detected. Proceeding to safe mode.
[I][app:029]: Running through setup()...
[C][wifi:038]: Setting up WiFi...
[C][wifi:051]: Starting WiFi...
[C][wifi:052]:   Local MAC: D0:BA:E4:88:8E:EC
interface 0 is initialized
interface 1 is initialized

Initializing WIFI ...
WIFI initialized
[D][wifi:455]: Starting scan...
<RTL8195A>ROM:[V0.1]
FLASHRATE:4
BOOT TYPE:0 XTAL:40000000

I think there is a problem during data transfer, but I've already tried 2 different set of cables, including the one that came with the adapter. Can anyone recommend cables? Or is there an other issue at play?

Thanks in advance,
Erwin

@hn
Copy link
Owner

hn commented Feb 29, 2024

I think ltchiptool does a final check of the written data (-c Check hash/CRC of the written data (default: True)) and therefore it should warn you if things have gone horribly wrong.

Your WiFi problem is #22 which @kuba2k2 fortunately fixed just today with LT 1.5.1: libretiny-eu/libretiny#257 . If your environment does not update to the latest version automatically you can force it with

rtl87xx:
  board: generic-rtl8710bx-4mb-980k
  framework:
    version: 1.5.1

If you hurry up, you may be the first person on earth to use this version on an EMW3080 :)

@ErwinP
Copy link
Author

ErwinP commented Mar 1, 2024

Bingo! It seems like I've beaten Belaial on being the first (reported) user that confirms the fix.
Now I'm having an error when my network SSID is hidden, which seems to be reported already here. But that is out of your control ;)

I can't say it enough: thank you!!

@Belaial
Copy link
Contributor

Belaial commented Mar 1, 2024

Damn it! I wanted to be the first 😄
Am I reading this right? There is no known issue with OTA updates? This was just a serial-adapter issue as I understand it.
(just woke up so sorry if I missed something....)

@ErwinP
Copy link
Author

ErwinP commented Mar 1, 2024

I thought that the error was a consequence of a flakey connection, but it appeared to be an issue with the board definition itself, which caused it to crash after scanning for wifi. I was able to recompile the firmware and it now worked, but I still flashed it manually.

If your issue was related to esphome compiling a faulty firmware and pushing it to your device OTA, then the issue is resolved (because technically, the OTA update mechanism wasn't broken but your device wasn't able to come online anymore). However, if the issue was truly the OTA feature, then most likely it is still broken. But at this moment I lack time (and bravery) to test it :)

@ErwinP ErwinP closed this as completed Mar 1, 2024
@Belaial
Copy link
Contributor

Belaial commented Mar 2, 2024

Tested this morning, OTA worked just fine after the edit suggested here #23 (comment)

I assume I at least claimed world second running this on EMW3080 🥈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants