This project support the MicroPython on WFI32E01PC (PIC32MZW1) Wi-Fi MCU module by running the MicroPthon library.
MicroPython is a Python 3 implementation with small subset of Python standard library. It run on embedded MCU to compile and interpreter the Python scripts.
With this feature, users can run python scripts on WFI32E01PC (PIC32MZW1) MCU to simplify the software development. MicroPython highly abstract the software of Rio2. Users can develop the code more easy with the high-level language.
This is good for rapid prototyping , quick evaluation and automated tests.
The MicroPython project can run on two PIC32MZW1 Evluation boards. They are the WFI32-IoT Development Board and the WFI32E Curiosity Board
Click here for the details of the board
Click here for the details of the board
-
MPLAB X IDE (v6.00 or later)
-
MPLAB XC32 (v4.30 or later)
-
- Note: The project was developed and tested using the MPLAB X v6.05 and MPLAB XC32 v4.30
Below table show the pin functionality on PIC32MZW1 module when it work with MicroPython. Some pins are configurable while some pins are fixed usage. Some pins are not availalbe as they are connected to some components on the board.
The right two columns show the posiion of the pin on the WFI32-IoT Development Board and the WFI32E Curiosity Board.
You can check this table to detemine the connection of your application.
Below are the MicroPython modules which supported in this project.
- gc - control the garbage collector
- uselect - wait for events on a set of streams
- socket - socket module
- utime - time related functions
- array – arrays of numeric data
- ucollections – collection and container types
- ustruct – pack and unpack primitive data types
- Build and program the project firmware/pic32mz_w1_curiosity_freertos.X into the hardware using MPLABX IDE
- Connect the board to the PC using the micro-USB cable
- If you are using WFI32-IoT board, the computer detect there are two virtual COM ports. One print the appliaction log when the other print Wi-Fi FW log.
Use a UART terminal (e.g. Teraterm) to open the COM port (baudrate: 115200 8N1) to read the application log.
If you are using Curiosity board, you can connect a USB-UART converter to the UART1 pins in the GPIO header(J207) of the Curiosity Board and open a UART terminal in the PC with settings 115200 8N1UART Tx and Rx pins are marked in the GPIO Header (J207) silkscreen
- When the board is power on, it emulated as a USB MSD. You can browser the USB drive (the name is "CURIOSITY") on the PC using the file browser.
- If you are using the WFI32-IoT board, You can also test by copying the example_scripts/gpio_on_off_led/main.py to the board
- Reboot the board, the python scripts will be executed. Yello LED on the WFI32-IoT board blink every 2 seconds, hardware timer is used to trigger the on/off of the LED.
Directory example_scripts/ contains different python scripts to demonstrate some basic use of the MicroPython
Below list introduce the use of each demo scrtips.
Directory | Usage | Modules |
---|---|---|
general_test | demonstrate the use of python packages, extract the email and author name | - |
gpio_on_off_led | turn on/ off Yellow LED on WFI32-IoT board with timer interrupt | umachine |
gpio_interrupt | demonostrate the use of gpio interrupt | umachine, utime |
tcp_client | act as TCP client, create socket to conect to the TCP server and exchange data | network, socket |
tcp_server_with_multiple_socket | create TCP server to handle multiple client socket simultaneously | network, socket, utime, gc, uselect |
http_get | TCP client send HTTP Get command to get the webpage contents of a website | network, socket |
http_server | set as softAP mode and run like a HTTP server. Remote device can connect to the softAP and browser the HTTP website | umachine, network, socket |
spi_read_sst26_flash | read SST26 SPI flash's manufacturer id and device id by using SPI bus | umachine, utime |
- umachine module support Class Pin, ADC, UART, SPI, I2C and Timer, and do not support class PWM, I2S, RTC, WDT, SD, SDCard and Signal
- Do not support the control of CAN bus, Ethernet and USB interface.
- Do not support Virtual File System (VFS) feature
- Do not support TLS secure connection