Run Toit on a Pycom Wipy board #90
nilwes
started this conversation in
Show and tell
Replies: 2 comments 11 replies
-
Thanks for the write-up! I also came across https://www.soracom.io/blog/internet-of-microcontrollers-made-easy-with-toit-x-soracom/ which makes it look a lot easier to flash the Pycom with the Toit firmware. Is there any downsides with using the instructions from the Soracom blog? |
Beta Was this translation helpful? Give feedback.
11 replies
-
But it seems like the flashing of Jaguar went well. A few things to verify:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Introduction
Pycom offers several ESP32-based boards ready for production, so it makes perfect sense to use one of these with Toit. I had a Wipy lying around so in this show-and-tell we’ll have a look at that one. It is a relatively simple process, even though it requires you to ensure the Wipy board is in “Boot mode” prior to flashing. In addition you’ll need an FTDI USB-to-Serial adapter and some jumper cables. Equipped with these basic tools, you’ll have your Wipy board up and running Toit code in a couple of minutes. No more MicroPython!
NOTE: This show-and-tell is for computers running Linux and macOS.
Setting up Toit on your computer
Here is a guide to getting Toit up and running on your computer. I’ll assume you have this set up already before continuing.
Also, you'll need the Toit CLI. Here are instructions on how to install what you need:
Required hardware
IMPORTANT: There are many FTDI breakouts and cables available out there. However, the most important thing is that the FTDI gear you use is made for 3.3V signal level. FTDI cables that use 5V signal level will probably fry your Wipy board.
Powering your Wipy
Even though it might be possible to power your Wipy board using power from the FTDI, you might end up with a brownout if the ESP32 as some point uses too high current. Therefore I used an external power supply to power the Wipy. You can for example pull the power from a LiPo battery, or you can do what I did: Scavenge an old USB cable, strip the 5V and GND cables, solder on a couple of jumper wires, and use these for powering the Pycom board via your computer USB port.
Hooking up your hardware
First let’s have a look at the pin-out diagram for the Wipy.
The P0 and P1 pins are used for Rx and Tx, respectively. This means that we should
Connect your power source to the 5V pin and the ground to the GND pin. Finally, plug your FTDI adapter to your USB port on your computer.
Listening to your Wipy
To get a better insight in what’s going on with the Wipy, it is helpful to monitor the serial output from the device. To be able to do this, we need to figure out which port we should use. Check your ports by typing
This will list your ports ordered from oldest to newest, so if you connect your Wipy via your FTDI adapter to the USB of your computer, the port will show up somewhere near the end of this list. On macOS the port is probably called something like
cu.usbserial-AB0JJ2KA
, and on Linux it is probably called something liketty-USB0
.Now you can monitor the serial communication with the Wipy by using the Toit command
This command will ask which port you want to listen to. Pick the port you just identified from the list of ports.
If you can’t see any output, try pressing the reset button on the Wipy. This should generate some output from the board.
Ensuring you have your Wipy in Boot Mode
The Wipy must be put into Boot Mode prior to every flash. In order to do this, follow these steps:
Below is an image of the Wipy with the blue Boot Mode jumper cable connecting P2 to GND:
To verify the Wipy is in Boot Mode:
toit serial monitor
and pick the corresponding port.The terminal should output something like
rst:0x1 (POWERON_RESET),boot:0x3 (DOWNLOAD_BOOT(UART0/UART1/SDIO_REI_REO_V2)) waiting for download
Making and running your first Toit program
Let’s start with the Hello World application, to ensure we have everything set up correctly. First we make it by running
NOTE: You have to enter the correct path to the folder to which you pulled Toit from Github.
Your Wipy board should be in Boot Mode, so we are ready to flash your Wipy. Do this by running the following juicy command
NOTE: You must change the path to your esp-idf folder as well as the serial port to your Wipy.
When the flashing is complete, remove the jumper cable that goes from P2 to GND and, power-cycle the device, and do
Power-cycle the Wipy board again, and it should spit out something like
Note the
Hello, World!
message in the serial output. You're now ready to start playing with Toit on a Pycom Wipy board!Stepping it up a bit...
The
Hello, World!
program is truly amazing. But its counterpart in the world of IoT is the blinking LED. Even better, the Wipy comes equipped with a multicolor RGB LED powered by the WS2812 chip. Luckily, there is a Toit package for driving this LED. Check out the package here.The package contains an example,
gpy.toit
specifically made for the RGB LED on the Pycom Wipy, but the driver can of course drive any WS2812-based RGB LED strip.Happy tinkering!
Beta Was this translation helpful? Give feedback.
All reactions