-
Notifications
You must be signed in to change notification settings - Fork 16
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
Set the MCU to UART boot mode (pull TX pin low during boot) #9
Comments
Hi @Belaial , thanks for asking. You just have to connect the TX pin to the GND pin during boot with a small piece of wire. Remove the wire some seconds after you powered on the board. |
Ah ok, that was my guess (and a friend I asked) but wanted to be 100% sure before I tried! Will try and re-flash my stick later today! Thanks for the reply. |
I am not sure I am able to get the stick into the correct mode, in the guide there is the following when the stick is in the "xmodem mode"
I am not able to see this after connecting TX to GND for a few second during boot and then removing the wire (wire not connected in the picture but I connect it to GND before boot and then remove it a few seconds later) When I have done this and then Am I doing something wrong trying to get the stick into "xmodem mode" maybe? Or am I using the wrong rate (115200) when looking what is going on? If I just boot the stick normally I see the boot log just fine with 115200 so the serial adapter and wires are OK at least. |
Hm, strange, never experienced this. It looks like you do everything right. Try using a small resistor (200 Ohm ... 1kOhm) instead of the wire. What stock stick firmware do you have? Maybe they changed (protected) something. |
I will try the resistor instead of the wire later on today, need to get the resistor, don't have that at home. Not sure what version it's running, hopefully this can tell ROM:[V0.1] Press key 'w' to 2ndboot cli menu in 100ms. 17: ota upg_flag:0xffffcount:0 crc;0xffff 30: No OTA upgrade. os image start Initializing WIFI ... LDO Mode, BD_Info: 0 WIFI initialized hal_wlan_init(75), Available heap 0x88792 ============free heap size =84128========== The collector.total_working_time :196054 1 ssid xxxxxxxx channel 64 rssi -77 LwIP_DHCP: dhcp stop. LDO Mode, BD_Info: 0 WIFI initialized LwIP_DHCP: dhcp stop. LDO Mode, BD_Info: 0 WIFI initialized |
You have a newer firmware v10130 (line: "Ali_V00010130_"). They might have disabled uart boot mode, but somehow I would be surprised if they had. It's worth going on. |
Ok, stick was purchased in October 2022 (in Finland if that matters) I will try the resistor later today and see what happens, I have nothing to loose since I won't use the stick with stock firmware anyway (running a pi now but wanna try this project also). Either we get it to accept custom firmware or the stick dies, whatever comes first 👍 |
Ok, so I have now tested with 180 Ohm, 470 Ohm and 1kOhm, results are interesting and the same for all resistors I now get to see the However the last line If I try to read the stock firmware I get this If this is due to not having python2 implemented correctly I don't know, I am still on the same computer as explained in ticket #10 I was however able to get pyserial2.7 installed, not sure if something else is broken with python2 tho. EDIT Forgot to mention.... when using the plain old wire to connect GDN / TX I do not get to even see the |
Close And maybe try a 10kOhm resistor? It looks like theres something wierd with your serial adapter and/or cabling, the stick seems to be ok (and not UART-protected). |
I do close screen in between so that the serial port is not in use, I only check it to see what is going on, tested a few times not to not use screen at all but results are the same, failed to connect device on /dev/ttyUSB0 10kOhm seems to be to much, tried 10+ times, always boots into regular mode, will try something lower and see what happens. |
10kOhm - to much 3.9kOhm - Ok (however same ???????? spam) EDIT Regarding serial adapter / cabling Very simple adapter, cables like 10 cm long, soldered pins in both ends so should not be bad contacting at least. EDIT2 Tested to hold "w" at boot and that worked flawlessly, got into that "2ndboot#" instantly. |
Any tips what adapter I should get? Have tried all I can think of for now at least without luck. Next step is to fix another Linux machine that does not have mixed Python 2/3 in case that could be the issue. I will be traveling for work coming days so won't have access to this stuff again before Friday 16 of June, weekend when I get home so might take until Sunday 18 of June before I can test any idea's if someone comes to think of something. |
Connect VCC to 5V, this is what I use (RX/TX are jumpered to 3v3 level, though). |
Ok so I have made some progress now, the issue is neither with the USB-serial converter or the cables, it seems to be a issue with my mixed Python 2/3 environment in Fedora. I have booted a old Linux Mint 18 and there I can get the status However the dumping is so slow that the stick seems to reboot after some time, I have not timed it (maybe 10 minutes or so) but I managed at best to dump 750K before it fails and then I see the LEDs on the stick starts flashing like it does during a normal boot. Did you ever run into the same issue @hn or could you dump the stick faster? EDIT Tested now on a second computer, same deal, after like 10 minutes stick just reboots and the dump fails. I somehow need to speed up the process (or make it not reboot somehow) otherwise there is not enough time it seems. EDIT2 I timed it now, 15 minutes exactly, then it just reboots. EDIT3 I now tried to leave the 470Ohm resistor connected between TX /GND, same deal, 15 minutes and it just reboots, if this is a feature of the new |
Dumping the firmware takes some time, but I would say it's more like 2-4 minutes, but don't remember exactly. You can try the alternative tools @hcouplet mentioned here: #7 (comment) |
I will look into this, however I need some account to download stuff from RealMCU and not getting their download to work at the moment. |
Do you have a name / model on that USB to serial adapter? Was thinking I could get the same one to see if that helps out. EDIT Never mind, found it on eBay, just need to find a seller with good shipping to my area. |
I will close this ticket since you can dump this on even newer firmware, I will report back if I ever solve this and manages to dump and re-flash my stick. The issue once again is not with the project but seems to be all kinds for weird issues on my end. Many thanks for helping out and replying to all my questions. |
I have a bunch of cheap serial adapters from the last 10 years or so, all of them within reach work. I have really no idea what's wrong with your setup. Serial adapters aren't rocket science :) I think it may have to do with the 5V VCC pin not having enough power to reliably supply the stick, but that's just a rough guess. |
I read up some more during the weekend and even tho I closed this ticket already I will post what I found. I noticed the following in the code for the rtltool.py Therefore my best guess now is that this USB-serial adapter i have is to slow to dump the firmware before the stick automatically reboots after 15 minutes. I have ordered a new USB-serial adapter, just like the one in your pictures, will take a few weeks for it to arrive (slow shipping from eBay seller), I will let you know how it goes once I get it. EDIT Did not notice your reply regarding low power on 5V VCC, I guess it could be possible but I have had the stick booted normally for hours, and that seems to work just fine, it just stands there looking for it's SSID I configured when I tested the stick out towards the Solis inverter, therefore I think that power should be fine, can't guarantee it but that is my rough guess. The "only issue" now is the automatic reboot that only seem to exist in the "download mode", timed it a few times and it's always 15 minutes, at least on my stick, so again my only guess is that my serial adapter is to slow to complete the dump in time, I guess it also would be to slow to flash the stick. And you are correct that serial adapters ain't rocket science :) But in some weeks we might know what science is behind my issues.... maybe they are related to speed / to cheap adapter. |
If my firmware dump took a good 3 minutes, that's roughly 45000 bytes per second for 8MB, which is about 460800 baud. The currently connected adapter shown in the picture is a |
Ok, I managed to dump ~0,75MB in ~15 minutes so that is quite slow compared to your results, will be interesting to see if another adapter helps out, unfortunately I have no other adapter to test at home so will just have to wait for the new one to arrive which will take some time unfortunately but I will update once I know. I also tested 2 different computers just to be sure, only thing that followed along was the adapter.... so my hope is that is where the issues is. I ordered these ones https://www.ebay.com/itm/202647978588 I know they are based on the same chip but once I order something I usually take more then I need since the shipping is so slow anyway :) |
Hi @Belaial When shorting TX to GND with a wire, you're blocking the TX output from the chip (it can't send anything since the wire is "stronger" than the chip), so not seeing the xmodem boot message is also completely normal. However, I can't say exactly why is it failing for you. Using a good (real) FT232RL adapter is the best choice, as the BootROM initializes on 1.5Mbit baudrate, which is quite high for cheap adapters. I think you can set a lower baudrate in rtltool (it will still initialize on high baud, but will lower it for the actual data transfer), which should give you more luck. |
Hi @kuba2k2 Figured it should be normal behavior to see the "continuous spam", have worked a lot with serial connections on network equipment so now and then I do see things like this. Regarding changing the baud rate in rtltool I tried that (to the best of my knowledge at least) but it did not have any impact as far as I could tell, a real FT232RL is indeed the best choice, I have ordered a few and are still waiting for them, takes quite a few weeks for them to arrive, once they do I will test again and update this ticket how it goes! |
Hello again! Today I got my new serial adapters, just like the one in your picture @hn and I can now HAPPILY inform you that I can now dump the firmware in 1 minute 5 seconds, I even tried 3 times in a row since it felt soooooo good to finally have the solution to this problem! Worked flawlessly every single time!! :) I might take the time to re-flash the stick tonight but I will probably not do it before tomorrow or this weekend. So we can now for sure say that a serial adapter based on the CP2102 chip is not enough to preform these actions, you need something more serious like the FT232RL. |
Hi @hn, You can get it here - it's not released yet: [not sure where should I put it, so I put it here.] EDIT: Oh, and it can also auto-detect flash size, so it allows flashing over 2 MiB now. I'd appreciate someone with access to an RTL8710 testing it. |
@kuba2k2 Hi, nice to hear from you :) I did a quick test but something does not work work [maybe I did something wrong]:
With '-s', the serial data looks like this (just an excerpt):
Same for 'flash write'! |
Hmm, the response seems to be identical in both of your test runs (which would be odd if the garbage data was caused by incorrect baudrate). Can you try setting baudrate to 115200 manually ( |
I modified the tool now to wait a little bit after booting RAM code, and to print a special "marker message" so that the tool can detect when the actual data arrives. Valid output of
The critical part is here:
where a delay (of around 400 ms) is added, the marker message is transmitted, the chip ID & flash ID ( |
That did the trick! Reading flash seems to work reliably (tested three times, produced identical files). Didn't test flash write (yet). You cannot dump the flash several times in a row, you have to reset the MCU each time, because the second time it hangs here forever:
If I remember correctly, I can dump/write flash multiple times in a row with rtltool, which is very helpful when you have to pull TX to GND with a paperclip in this case :) |
Hi
Not an issue with the project or the code but asking here anyway in case someone else wonders and can look up this ticket.
"Set the MCU to UART boot mode (pull TX pin low during boot)"
I am not familiar what it means to pull a pin low, I am using a USB to serial adapter and can read the boot process just fine with a speed of 115200, however to enter into "Set the MCU to UART boot mode" I need to pull the TX pin low, could someone explain how that is done?
Maybe it can't be performed with a regular cheap USB to Serial adapter?
The text was updated successfully, but these errors were encountered: