Hi –
I bought the book Micropython programiming with ESP32 and ESP8266
I installed uPyCraft IDE (Win 10) and my ESP8266 com port enumerates as COM3. I can prove using RealTerm terminal program that I can open COM3 when the ESP8266 is connected and I can even see the following start up text using RealTerm :(with baud rate 9600) – when I press the reset button.
NodeMCU custom build by frightanic.com
branch: master
commit: c8037568571edb5c568c2f8231e4f8ce0683b883
SSL: false
modules: cjson,file,gpio,net,node,pwm,tmr,uart,wifi
build built on: 2016-03-14 02:10
powered by Lua 5.1.4 on SDK 1.4.0
—————————————————
But when I use uPyCraft IDE, and I select com3 (my realterm is now closed) – I get the connect error:
“open serial error, please try again” (by the way, the baud rate set in uPyCraft is 115200 – I tried making it 9600, doesn’t help)
regards
Russell
UPDATE: I tried using Thonny – same problem:
I select under Port: Silicon labs CP210X USB to UART Bridge (COM3) and I get:
Could not connect to REPL.
Make sure your device has suitable firmware and is not in bootloader mode!
Bytes read: b’\x00\x00\x00\x00\x00\x00\x00\x00′
Disconnecting.
Check the configuration, select Run → Stop/Restart or press Ctrl+F2 to try again.
(On some occasions it helps to wait before trying again.)
Hello, thanks for posting the update. It looks like you didn’t complete the previous step successfully.
- Did you flash your ESP with MicroPython firmware?
Because according to the message that you’ve posted it looks like it’s still running Lua firmware and that won’t work with uPyCraft or Thonny IDE.
Hi – thanks for the reply. I did manage to sort it out. Yes I had to flash the firmware, but this is where I couldn’t get past the error message originally.
I will explain what I did further below and have a few questions about the explanation in the book (maybe some others will find this helpful)
The instructions starting from page 39 ask me to select the serial port – that was where the problem started, it kept giving that problem (open serial error…), so I couldn’t even start to erase and then program the MicroPython firmware – did I do something wrong here?
Ok, what I did do was to use the pytool from the command prompt.
I tried to follow in the book from page 324 – but had some problems.
Here’s what worked: To erase – From a windows command prompt do: (I use COM3)
C:\Python37\Scripts\esptool.exe --port COM3 erase_flash
(I did not press “BOOT/FLASH” on the board – it seemed to cause problems if I did)
Then:
C:\Python37\Scripts\esptool.exe --port COM3 –baud 460800 write_flash –flash_size=detect 0 C:\ path>\esp8266-xxxx.bin
(again no button pressed on the board)
After that, I can use uPyCraft – but you need to remember to press the ‘connect link’ button, then the >>> prompt appears. I got the led server working fine too.
One last question: when working with a boot.py and a main.py file –
Is the procedure to do an upload of one of then and then press STOP after that then select the other and upload that one? It seems to work, but I’m trying to make sure that is right when doing operations on the two files in a project.
How does the IDE know where to separately place each file in the mcu? Is it is file name that tells it? ( boot and main)
Is there a shorter way to upload both files?
Thanks again – I am up and running
regards
Russell
Sorry for taking so long to get back to you, but I was without internet for the last couple of days during a trip.
I’m not sure if I understood the first part… What I have to say is that uPyCraft for some boards is a bit unreliable and keeps asking to re-flash the firmware (it only happens to me very rarely), but that’s why I recommend using Thonny IDE.
When erasing the memory of flashing the firmware, you need to hold down the “BOOT/FLASH” button to put the ESP in flashing mode. However, some boards do have built-in circuit that automatically puts them in flashing mode.
Yes, before saving/uploading a new file, you should press the Thonny IDE “STOP” button once or twice to make your ESP available to receive the new content.
Exactly, each file that you save in your board is always referenced by the file name. I don’t think so, you’ll need to always upload the files separately.
Thanks for your patience!
Rui
Hi – thanks for reply. I can use Thonny or uPycraft IDEs without problems.
There isn’t too much documentation for uPycraft – for example once I have completed a project in a workspace.
How do I open a new workspace? Or close the existing workspace, If I want to create and use a new one?