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

Can't upload to S3 #7

Closed
hcouplet opened this issue May 22, 2023 · 5 comments
Closed

Can't upload to S3 #7

hcouplet opened this issue May 22, 2023 · 5 comments

Comments

@hcouplet
Copy link

hcouplet commented May 22, 2023

I have an error when uploading the firmware. It start flashing, then after some time, I am getting an error : ValueError: Failed to write to 0x800B000

Here is the log :

➜  libretiny-esphome git:(platform/libretuya) ✗ python3.10 -m esphome upload solis2-stick.yaml --device
/dev/tty.SLAB_USBtoUART
INFO Reading configuration solis2-stick.yaml...
****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
Obsolete PIO Core v6.1.6 is used (previous was 6.1.7)
Please remove multiple PIO Cores from a system:
https://docs.platformio.org/en/latest/core/installation/troubleshooting.html
****************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
Processing solis2-stick (board: generic-rtl8710bx-4mb-980k; framework: arduino; platform: libretiny)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Configuring upload protocol...
AVAILABLE: uart
CURRENT: upload_protocol = uart
Looking for upload port...
Using manually specified: /dev/tty.SLAB_USBtoUART
Uploading .pioenvs/solis2-stick/firmware.uf2
|-- Detected file type: UF2 - esphome 2023.5.0-dev
|-- Connecting to 'Realtek AmebaZ' on /dev/tty.SLAB_USBtoUART @ 1500000
|   |-- Success! Chip info: Realtek RTL87xxB
|-- Writing '.pioenvs/solis2-stick/firmware.uf2'
|   |-- esphome 2023.5.0-dev @ 2023-05-23 00:27:42 -> generic-rtl8710bx-4mb-980k
|-- ValueError: Failed to write to 0x800B000
|   |-- File "/usr/local/lib/python3.10/site-packages/ltchiptool/soc/ambz/flash.py", line 147, in flash_write_raw

My chip looks the same as yours :
IMG_7466

@hn
Copy link
Owner

hn commented May 23, 2023

Please try to solely flash the app alone using the Python2 version of rtltool:

python2 ./rtltool2.py -p /dev/ttyUSB0 wf 0xb000 ./.esphome/build/solis-inv/.pioenvs/solis-inv/image_0x00B000.ota1.bin

@hcouplet
Copy link
Author

hcouplet commented May 24, 2023

Thanks for your response. It helped a lot.
Now I can flash it and it's working.

Here are my findings.

  1. As the link to the russian site for rtltool.py was dead, so I used rtltool.py from https://hackaday.io/project/182205-py-ft10/log/206206-rtltool or https://github.com/cyber-murmel/rtltool. They are both the same and may be you could update the reference.
  2. for the rtltool.py, no need for the "RTL8762x MP Tool Kits(ZIP)". Just run trltool.py with pyton2.7
    3
    I have issue with OTA. It says that the Auth is not correct.
    I had to flash in twice (not sure if the is correct) at 0xb000 and at 0x100000
/Users/hcouplet/.pyenv/versions/2.7.18/bin/python2 /Users/hcouplet/prg/projects/other/homeassistant/solis-stick/rtltool.py \
    -p /dev/tty.usbserial-0001 wf 0xb000 \
    /Users/hcouplet/prg/projects/other/homeassistant/solis-stick/libretiny-esphome/.esphome/build/solis2-stick/.pioenvs/solis2-stick/image_ota1.0x00B000.bin

/Users/hcouplet/.pyenv/versions/2.7.18/bin/python2 /Users/hcouplet/prg/projects/other/homeassistant/solis-stick/rtltool.py \
    -p /dev/tty.usbserial-0001 wf 0x100000 \
    /Users/hcouplet/prg/projects/other/homeassistant/solis-stick/libretiny-esphome/.esphome/build/solis2-stick/.pioenvs/solis2-stick/image_ota2.0x100000.bin

I ended up disabling OTA Password and OTA is working fine (I needed this before putting back the S3 card into the case to be able to update remotely the firmware).
I updated ota_component.cpp to bypass the wrong ota password commenting line at 239 :
image
After that flashing is working fine but the response is not valid (bypass error message).
it's some kind of digest auth with nonce and cnonce, may be the version in that tree has something wrong.

  1. I did all the initial flash on my mac but after installed LibreTiny ESPHOME on my HA. ESPHome was already there and I can use both of them :
    image

For this I used the add repository button on https://github.com/libretiny-eu/esphome-hass-addon
So now I am using the libretiny version only for my solis S3.
OTA (without password) is working fine.

@hn
Copy link
Owner

hn commented May 24, 2023

  • You are Solis S3 stick open source registered user # 3 :)
  • Updated rtltool2 link. The one I use was created by @pvvx, the ones you mention differ (but probably work just as well)
  • I never had any OTA password issues, that's strange.
  • Don't know why ltchiptool fails for you, maybe @kuba2k2 has an approach on how to fix/debug this.

@kuba2k2
Copy link

kuba2k2 commented Jun 23, 2023

Hi, thanks for the ping.

  1. It seems that some people have issues with ltchiptool flashing (I don't, but others do...). Since there are many versions of rtltool scattered around the Internet (on github, forums, etc), both for Python 2 and 3... can you send the version which you've found to work the most reliably? It's possible that I broke the one used in ltchiptool somehow, or maybe it was broken since I got it in the first place.
  2. @hcouplet you're actually the second person reporting OTA issues lately (see RTL8710BX - authentication error when updating OTA from 2023.5.0-dev to 2023.5.0-dev libretiny-eu/libretiny#142). @hn do you have the latest version of LibreTiny (AND esphome) installed? Maybe there's something that changed in latest ESPHome versions that needs a fix on Realtek.

@hn
Copy link
Owner

hn commented Jun 23, 2023

@kuba2k2

I use this rtltool version for python2, created by @pvvx, It always worked so far.

If I remember correctly, I re-installed both LibreTiny and ESPhome when you released LT 1.0.2 (May 11). Unlike @hcouplet, I don't have any (OTA-)problems with these versions, so everything is fine (except the strange ModBus sync problem, but that's a different story).

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