How do I get main.py to run when the WiPy board boots?
-
@robert-hh It seems it was uploaded to the board correctly, I checked with Filezilla (FTP client) and the main.py file on the board contained my code correctly.
-
@flatmop Then it should be executed, unless the device is in safeboot mode. That is caused by.
- booting with P12 at High level
- software reboot from REPL with Ctrl-F.
The latter method is used by pymakr, as far as I know (I'm not using pymakr). To exclude that, close pymakr and reboot by pushing the reset button on the device.
-
@robert-hh Ok, I tried resetting the device by pressing the pushbutton but it made no difference. I also tried grounding P12 with a wire but this also made no difference.
Is it possible to determine or change from the REPL whether or not the board is running in Safe Boot mode?
Might be worth mentioning that I have not updated the firmware yet as I don't have any expansion boards. I guess I will have to order an Expansion Board 2.0 and update to the latest firmware, see if that makes any difference.
-
-
This is my firmware version:

So I don't understand how main.py is not running unless there is a problem with the firmware...
-
@flatmop That's strange. And that version also does not reboot on Ctrl-F. Besides that, upgrading the firmware is advisable. You do not need an expansion board. Any USB/UART bride with TTL output at 3.3V level will do as well. You have to connect
GND,
RX(P0)->TX(bridge) and
TX(P1)->RX(bridge),
connect P2 to GND and push reset. Then the device is in upload mode and you can run the firmware updater to do its magic. -
@robert-hh I don't have a USB to UART bridge with 3.3V TTL output to hand at the moment. I though it safer to just order the Expansion Board 2.0. When it arrives (despatch tommorow and next working day delivery, so Monday...), I will update the firmware and see if that fixes the issue. If it doesn't I guess my board must have some hardware defect, perhaps ESD damage to the flash memory or something.
-
@flatmop I don't know whether you get an expansion board 2. AFAIK, they are not sold any more by PyCom. But distributors may have them still on stock.
-
@robert-hh I ordered from RS Components.
-
-
You need to update the firmware first.
The WiPy2 firmware that is flashed during production is very old and from what I remember there was indeed an issue with loading the
main.pyin that version. -
@james-matthews Ok thanks, created a boot.py with this code in it, and it now runs my RGB program when the WiPy is reset. Success! I feel as though this is some sort of hack or workaround however, as nowhere in the "Getting Started" guide does it say that you need a boot.py for this, it suggests as though main.py should run anyway.
-
@flatmop That is the expected behavior, which you should get after an update of the firmware.
-
@xykon I updated the firmware to the latest version with the Expansion Board 2.0, but that did not help. It was only when I tried @james-matthews's suggestion that I got it to work, which seems strange. The "getting started" guide gives the impression that once uploaded to the board, main.py should run automatically without needing a boot.py.
-
@robert-hh I see. Perhaps they should make this more obvious in the "Getting Started" guide.
-
Hi @flatmop,
That is the case,
main.pyruns automatically (just tried it) -
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login