I’m following the MicroPython programming course for ESP32. Initially I downloaded the blink program to the ESP32 and it ran. I modified it and tried to run it again. I have disconnected and reconnected the USB cable, burned the flash again, and basically followed all the steps again. I keep getting this:
Ready to download this file,please wait!
..
download ok
os.listdir(‘.’)
Traceback (most recent call last):
File “<stdin>”, line 1, in <module>
NameError: name ‘os’ isn’t defined
>>>
reflush tree false
What is wrong?
I am getting the same error as author above as well. And only solution is to re-flash device again.
I am also getting this error message on “hard restarting” device:
rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371
Are really ESP32 dev boards so unreliable or this can be fixed? Googl search didn’t give me any realiable answer ragardin this flash read error. Only something about encryption which I definetely haven’t switched on.
Thanks for your concerns and for mentioning those messages. Here’s what’s happening.
Error #3: After uploading a new script, if you see the following message:
>>> Ready to download this file,please wait! ... download ok os.listdir('.') Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'os' isn't defined
Or this message:
>>> Ready to download this file,please wait! ... download ok os.listdir('.') OSError: [Errno 98]
It means the new file was uploaded to your board successfully. You can notice that it printed the “download ok” message. The “download ok” message is all you need to look for after upload a new script. After that, press the ESP on-board “EN/RST” button to restart your board and re-run the new uploaded script from the beginning.
@Andris, if you see the error message mentioned above (“Error #3”), do not re-flash the firmware, because your board is fine. You just need to restart the ESP and it will run the code. The ESP basically has the debug mode on and any exception prints in the serial monitor. Sometime you need to just ignore some debugging messages.
About your error:
rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT) flash read err, 1000 ets_main.c 371
That error that you’re experiencing, it looks like you didn’t select to flash the ESP32 firmware on address 0x1000. Did you select that option? Can you double-check?
Thanks!
Rui,
I press the ESP on-board “EN/RST” button to restart the module, and it responds with:
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371
M[0m
[0;32mI (435) cpu_start: Pro cpu start user code[0m
[0;32mI (5) cpu_start: Starting scheduler on PRO CPU.[0m
It does not run the blink program after I press the button. When I disconnect and reconnect the power, and then try to connect the serial port to the module, I get: “Open serial error, please try again.” The Burn Firmware dialog box displays requiring me to flash the firmware. I choose the 0x1000 address and it seemed to successfully burn the firmware. This is followed by a STOP and DOWNLOAD & RUN sequence. Nothing.
My setup:
- uPyCraft V1.1
- Python V3.7.2
- ESP32 Board: https://www.ezsbc.com/index.php/featured-products-list-home-page/wifi01-35.html#.XEOhP817nup
I switched out the ESP32 board and get the same symptoms.
I’m not sure what is wrong. I’m I doing something out of sequence?
Joel
I think I got it.
I had to change the pin ID to 18 for the board I’m using, and I copied the script from the Github page rather from the ebook.
Is there an operator that indicates the end of the while loop?
Thanks for your help!
Joel
You’re welcome. It could only be something like that, because you were doing everything right. Unfortunately I didn’t think about it. I would say that 95% of ESP boards use GPIO 2 as the on-board LED…
I recommend always copying the code from GitHub, otherwise you might see syntax errors due to spacing mistakes.
No. With Python there’s nothing that indicates the end of a while loop, for loop or if statement. It’s all about the indentation.
You might consider using Thonny IDE to work with MicroPython on ESP32/ESP8266: Getting Started with Thonny MicroPython (Python) IDE for ESP32 and ESP8266
We’ve published that blog post yesterday to provide an alternative method to uPyCraft IDE.
- uPyCraft IDE prints all the debug information in the debugging window which can be confusing.
- Thonny IDE has a layer on top that doesn’t show all those errors, so it’s a bit more user friendly. We plan to add that method to the eBook in the next update.
We would like to gather some feedback on Thonny IDE. So, if you try let me know what you think.
Regards,
Rui
I have switched to the Thonny IDE. It has a better layout for me and I like seeing the variable window. It also seems to be more intuitive. Thanks for the lead.
Joel
Rui,
Just one question about Thonny – The debug feature of Thonny is greyed out. Any explanation for this?