I can burn the firmware on an ESP32 according to the guidance but don’t get the boot.py file created under ‘device’ ?
I don’t need to hold down the boot button on the ESP32 board before clicking Ok but have tried it both ways?
If I load code from the ‘workspace’ it runs, and if I load the same code with Thonny this also runs – and shows the firmware version on the ESP32 (which is correct)
But nothing is displayed under ‘device’ on uPyCraft ?? That is no ‘boot.py’ file, just a message that Not really a problem but something is clearly not correct?
Running version 1.1 of uPyCraft on Windows 10 64bit
Hello Chris, I would probably just stick to Thonny IDE, because it has been proven to be more reliable for most people. Basically, there are two scenarios:
- Send the code to run in your ESP
- Upload/save the script in your ESP as main.py, boot.py, or your_library.py
- If you use option #1, after your restart the board the code will be deleted.
- If you use option #2, the code will remain on your board and run after a reset.
To erase the ESP and flash the micropython firmware you need to hold down the BOOT/FLASH button.
However, you can’t hold down the boot button to run/upload scripts. Just press the Stop button to make your board available to receive new code… Then let me know what happens when you try the following:
Uploading the Script
Go to Device and select Upload current script as main script.
It should write the following on the Shell.
Note: uploading the code as main script will save the current file with the name main.py on the ESP, even if you have saved it in your computer with a different name. The same happens for the boot.py file.
Important: when the ESP restarts, first it runs the boot.py file and afterwards the main.py.
Yes, this worked – when the code was loaded as main.py then restarting (unplugging and reconnecting) the board did not run the main.py script but it did as boot.py (as you would expect…) That is if there was no boot.py the main.py did not run?
So I guess the answer is to stick with Thonny and start the main.py script from boot.py?
Doesn’t look as if you can burn the firmware with Thonny though?
Yes, I recommend using Thonny IDE (instead of uPyCraft IDE). You can have the two files boot.py and main.py… Or just one of them.
- When the ESP starts, it will try to run the boot.py first
- Then, it runs the main.py file
If you only have the main.py, it will only run that file.
No – if I do not have, or have an empty boot.py but _do_ have a main.py them unplugging the board and re-plugging it in does not run the main.py script…
Sorry – I am wrong…there was a typo in the main.py script ‘Sleep’ not ‘sleep’ which is why it did not run…I had corrected this in the boot.py script!
It works as you say although I find the interface a little strange – you cannot delete a script you have uploaded, I had to upload a blank one??
Yes, unfortunately Thonny IDE doesn’t support that file management feature (you would need to upload a blank file)… If uPyCraft IDE works fine in your computer, it has more features.
I prefer uPyCraft IDE and it works perfectly for me, but a lot of people have trouble establishing a connection with the ESP board. So, I recommend Thonny IDE, because it’s a bit easier to use and more reliable in establishing the serial communication.