ESP01 1M Flash 512 and 1M MicroPython Neither Responds?

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: ESP01 1M Flash 512 and 1M MicroPython Neither Responds?

Post by Roberthh » Sat Aug 06, 2022 8:18 pm

I do not have any ESP01 anymore with 1M flash. I replaced the flash chips with larger ones.
But as a blind guess, you could try to write the esp_init_data_default.bin file to address c0000 and then reload the 1M firmware again.

esptool.py --port /dev/ttyUSB0 write_flash --verify 0xc000 esp_init_data_default.bin

esp_init_data_default.bin is in the esp SDK. A copy is also here: https://github.com/robert-hh/Shared-Stu ... efault.bin

Jibun no kage
Posts: 144
Joined: Mon Jul 25, 2022 9:45 pm

Re: ESP01 1M Flash 512 and 1M MicroPython Neither Responds?

Post by Jibun no kage » Sat Aug 06, 2022 11:32 pm

Using a different bootloader type, I got the firmware image loaded and it booted. But then got an error in Thonny IDE. But this is progress.

Code: Select all

MicroPython v1.19.1-229-g579f33050 on 2022-08-02; ESP module (512K) with ESP8266
Type "help()" for more information.
ERROR   thonny.plugins.micropython.backend: Crash in backend
Traceback (most recent call last):
  File "C:\Program Files (x86)\Thonny\lib\site-packages\thonny\plugins\micropython\backend.py", line 136, in __init__
    self._prepare_after_soft_reboot(clean)
  File "C:\Program Files (x86)\Thonny\lib\site-packages\thonny\plugins\micropython\backend.py", line 167, in _prepare_after_soft_reboot
    self._update_cwd()
  File "C:\Program Files (x86)\Thonny\lib\site-packages\thonny\plugins\micropython\bare_metal_backend.py", line 402, in _update_cwd
    super()._update_cwd()
  File "C:\Program Files (x86)\Thonny\lib\site-packages\thonny\plugins\micropython\backend.py", line 493, in _update_cwd
    self._cwd = self._evaluate("__thonny_helper.getcwd()")
  File "C:\Program Files (x86)\Thonny\lib\site-packages\thonny\plugins\micropython\backend.py", line 611, in _evaluate
    raise ManagementError(script, out, err)
thonny.plugins.micropython.backend.ManagementError: Problem with a management command

SCRIPT:
__thonny_helper.print_mgmt_value(__thonny_helper.getcwd())

STDOUT:


STDERR:
Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "<stdin>", line 44, in getcwd

AttributeError: no such attribute

Backend terminated or disconnected. Use 'Stop/Restart' to restart.
The 1MB image worked, I got a valid REPL connection. The issue apparently is that the first bootloader, which works for almost everything, what has a nice programmer mode vs. UART mode switch, does not seem to but the ESP01 device in the right mode for MicroPython/Thonny IDE to allow a boot/REPL session. My older bootloader that has a bootselect button, that you have to hold until the firmware download starts, i.e. a temporary connect of (what is it, GND and GPIO0?) to force programming mode, works. The only other change I did was I explicitly set DOUT flash mode.

The boot does that typical ESP load of junk characters (at the wrong buad rate for bootloader?) but once MP comes up, it is at 115200 as expected. Now to see how crazy I can get!

Jibun no kage
Posts: 144
Joined: Mon Jul 25, 2022 9:45 pm

Re: ESP01 1M Flash 512 and 1M MicroPython Neither Responds?

Post by Jibun no kage » Sat Aug 06, 2022 11:45 pm

Now I have the same old issue I have seen before, I keep getting this issue, on any ESP module...

Code: Select all

>>> %Run -c $EDITOR_CONTENT
Traceback (most recent call last):
  File "<stdin>", line 10, in <module>
ImportError: no module named 'uasyncio'
>>> %Run -c $EDITOR_CONTENT
Traceback (most recent call last):
  File "<stdin>", line 10, in <module>
ValueError: incompatible .mpy file
>>> 
All I did was install the uasyncio for MicroPython package, which installed with no errors but when I run any script that imports uasyncio, the above error results. What the heck?

User avatar
scruss
Posts: 360
Joined: Sat Aug 12, 2017 2:27 pm
Location: Toronto, Canada
Contact:

Re: ESP01 1M Flash 512 and 1M MicroPython Neither Responds?

Post by scruss » Sun Aug 07, 2022 4:17 am

I'm not sure, but uasyncio might include some code that needs to be compiled into the MicroPython binary. I don't think it's something you can copy across

Jibun no kage
Posts: 144
Joined: Mon Jul 25, 2022 9:45 pm

Re: ESP01 1M Flash 512 and 1M MicroPython Neither Responds?

Post by Jibun no kage » Sun Aug 14, 2022 3:39 pm

Yeah, looks like I will need to roll-my-own firmware image at some point, all I need is uasyncio, UART support, and MQTT support, not much else to use the ESP01 as a WiFi bridge to a non-WiFi RPI2040 board.

jomas
Posts: 59
Joined: Mon Dec 25, 2017 1:48 pm
Location: Netherlands

Re: ESP01 1M Flash 512 and 1M MicroPython Neither Responds?

Post by jomas » Sun Aug 14, 2022 4:32 pm

Jibun no kage wrote:
Sat Aug 06, 2022 11:32 pm
Using a different bootloader type, I got the firmware image loaded and it booted. But then got an error in Thonny IDE. But this is progress.

Code: Select all

MicroPython v1.19.1-229-g579f33050 on 2022-08-02; ESP module (512K) with ESP8266
Type "help()" for more information.
ERROR   thonny.plugins.micropython.backend: Crash in backend
Traceback (most recent call last):
  File "C:\Program Files (x86)\Thonny\lib\site-packages\thonny\plugins\micropython\backend.py", line 136, in __init__
    self._prepare_after_soft_reboot(clean)
  File "C:\Program Files (x86)\Thonny\lib\site-packages\thonny\plugins\micropython\backend.py", line 167, in _prepare_after_soft_reboot
    self._update_cwd()
  File "C:\Program Files (x86)\Thonny\lib\site-packages\thonny\plugins\micropython\bare_metal_backend.py", line 402, in _update_cwd
    super()._update_cwd()
  File "C:\Program Files (x86)\Thonny\lib\site-packages\thonny\plugins\micropython\backend.py", line 493, in _update_cwd
    self._cwd = self._evaluate("__thonny_helper.getcwd()")
  File "C:\Program Files (x86)\Thonny\lib\site-packages\thonny\plugins\micropython\backend.py", line 611, in _evaluate
    raise ManagementError(script, out, err)
thonny.plugins.micropython.backend.ManagementError: Problem with a management command

SCRIPT:
__thonny_helper.print_mgmt_value(__thonny_helper.getcwd())

STDOUT:


STDERR:
Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "<stdin>", line 44, in getcwd

AttributeError: no such attribute

Backend terminated or disconnected. Use 'Stop/Restart' to restart.
The 1MB image worked, I got a valid REPL connection. The issue apparently is that the first bootloader, which works for almost everything, what has a nice programmer mode vs. UART mode switch, does not seem to but the ESP01 device in the right mode for MicroPython/Thonny IDE to allow a boot/REPL session. My older bootloader that has a bootselect button, that you have to hold until the firmware download starts, i.e. a temporary connect of (what is it, GND and GPIO0?) to force programming mode, works. The only other change I did was I explicitly set DOUT flash mode.

The boot does that typical ESP load of junk characters (at the wrong buad rate for bootloader?) but once MP comes up, it is at 115200 as expected. Now to see how crazy I can get!
The error occure because the 1MB image has no filesystem.
See this issue
https://github.com/thonny/thonny/issues/1923

Jibun no kage
Posts: 144
Joined: Mon Jul 25, 2022 9:45 pm

Re: ESP01 1M Flash 512 and 1M MicroPython Neither Responds?

Post by Jibun no kage » Mon Aug 15, 2022 4:33 pm

I thought only the 512 variant lacked the file system? I got the 1MB variant of the image working just fine once got the write flash configuration right, turned out I had to completely erase and then set the flash mode do DOUT for the ESP01 modules I have and the bootloader USB device I used. I am looking at my ESP01 test module with 1MB image loaded, and I see the boot.py on the file system in Thonny.
Last edited by Jibun no kage on Mon Aug 15, 2022 4:40 pm, edited 1 time in total.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: ESP01 1M Flash 512 and 1M MicroPython Neither Responds?

Post by Roberthh » Mon Aug 15, 2022 4:39 pm

That's also what I recall. The 1M flash version has a small file system. But since you flashed it, you have the proof.

Jibun no kage
Posts: 144
Joined: Mon Jul 25, 2022 9:45 pm

Re: ESP01 1M Flash 512 and 1M MicroPython Neither Responds?

Post by Jibun no kage » Mon Aug 15, 2022 4:42 pm

Yeah. Pretty much. I will need to generate my own flash image, limited to UART and MQTT scope (or as much as possible) to finish my solution design. Now to learn how do that is going to be interesting. My C is a bit rusty... ah, 'Rust' no pun intended, that is on the list to learn that as well. Reference https://www.rust-lang.org/

Post Reply