W55MH32L-EVB MicroPython reference script
In this page, we will show all network and peripheral MicroPython script with simple setup.
Basic Setups
Use a USB type C cable to connect the DAP-LINK Port with your PC to provide power and serial communication with Thonny.
Go to Thonny and select the correct COM port and interpreter (MicroPython generic).
How to install micropython firmware for W55MH32L-EVB?
Connect DAPLINK USB port with your PC
Windows will pop-up a new disc called WIZLINK
Drag and drop the hex file to the WIZLINK window
WIZnet5K Networking
See network.WIZNET5K and socket
Setup:
Connect the board and PC with an Ethernet cable.
Set the IP address of the board and PC in the same IP segment.
Static IP
Script: GitHub
- Results:
It shows the IP address details set inside the script.
DHCP
Script: GitHub
- Setup:
Please connect the board to a router with an Ethernet cable.
- Results:
It shows the IP address details provided by DHCP server or router.
TCP Server (one time loopback)
Script: GitHub
- Setup:
Open a TCP socket tester and send data to the board using TCP client.
Suggestion:
WIZnet Socket Tester
- Results:
Receive loopback message from the board.
The TCP socket will be close after the connection has been disconnected.
Please run the script again after disconnected the TCP connection.
TCP Client (one time loopback)
Script: GitHub
- Setup:
Set your PC’s IP address to ‘192.168.1.100’.
Open a TCP socket tester and send data to the board using TCP Server in port ‘5001’.
Suggestion: Hercules
- Results:
The script will automatically connect ‘192.1681.1.100’ with port ‘5001’.
Receive loopback message from the board.
The TCP socket will be close after the connection has been disconnected.
Please run the script again after disconnected the TCP connection.
GPIO (General Purpose Input Output)
See machine.Pin.
Script: GitHub
- Setups:
Press the onboard button (PG6) to turn on and off the onboard LED (PD14).
- Results:
The onboard LED will turn on and off based on the button state.
ADC (Analog to Digital Conversion)
See machine.Pin and machine.ADC.
Script: GitHub
- Setups:
Connect PA4 with a potentiometer for ADC testing
- Results:
It shows the different results during changing the resistance value of the potentiometer.
DAC (Digital to Analog Conversion)
See machine.Pin and machine.DAC.
Script: GitHub
- Setups:
Connect PA4 with a multimeter for DAC testing
- Results:
The multimeter should show ~1.65V result
Bitstream
See machine and machine.Pin.
Script: GitHub
- Setups:
Provide power and connect WS2812 to a GPIO pin (PD5 for example)
- Results:
It will turn on 12 WS2812 LEDs into green color.
RTC (Real time clock)
See machine.RTC.
Script: GitHub
- Setups:
Input the datetime into the script.
- Results:
It shows the updated time every 3 seconds.
Timer
See machine.Timer.
Script: GitHub
- Setups:
The script has set TIM4 into 1HZ
- Results:
It shows the print result to show the timer is ticking
UART (Serial Bus)
See machine.UART.
Script: GitHub
- Setups:
Connect a USB-TTL module with W55MH32L-EVB’s PA2(TX) and PA3 (RX) for USART2 to communicate with the PC.
Open a serial terminal to receive and send data using UART
- Results:
The USB-TTL module serial terminal shows 10 sets of “abc” data.
The MicroPython serial terminal shows 1 set of “123” data.
I2C
See machine.I2C.
Script: GitHub
ahtx0 library: GitHub
SPI
See machine.SPI.
SPI bus (WIZ850io)
Script: GitHub
- Setups:
Connect the SPI(1) with WIZ850io module.
Please based on the follow table to connect the WIZ850io with W55MH32.
WIZ850io |
W55MH32 |
|---|---|
GND |
GND |
VCC |
3V3 |
SCLK |
PA5 (SPI1_SCK) |
MOSI |
PA7 (SPI1_MOSI) |
MISO |
PA6 (SPI1_MISO) |
SCSn |
PA4 |
RSTn |
PA3 |
- Results:
It shows the correct chip version from W5500 chip’s register.
SPI bus (ST7789)
Script: GitHub
st7789py library: GitHub
- Setups:
ST7789 |
W55MH32 |
|---|---|
GND |
GND |
VCC |
3V3 |
SCL |
PA5 (SPI1_SCK) |
SDA |
PA7 (SPI1_MOSI) |
RST |
PD6 |
DC |
PD5 |
CS |
PA4 |
BL |
3V3 (100% brightness) |
- Results:
It will display the following result.
SD Card
See machine.SDCard.
Script: GitHub
- Setups:
Insert a microSD card into the SD card slot on the W55MH32 board.
- Results:
A file named “testing.txt” is written to the “/sd/” directory on the SD card.
The content “Hi from W55MH32!” is written to the file.
The script reads the content back from “testing.txt”.
The content is printed on the MicroPython shell.
USB
Setups: Connect the USB cable to the USB device port on W55MH32.
USB VCP Mode (Virtual COM Port Only)
See machine.USB_VCP.
Script: GitHub
- Setups:
Turn on PuTTY (or any serial terminal).
Type and send a message from PuTTY to the board.
- Results:
The board will echo back whatever message was received.
USB MSC Mode (Mass Storage Only)
Script: GitHub
- Setups:
Run the script to enable USB MSC mode.
The board will appear as a USB flash drive on your computer.
- Results:
A file named “test.txt” is written to the USB flash drive.
The script reads the content back from “test.txt”.
The content is printed on the MicroPython shell.