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).
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: Hercules
- 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.
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.
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 8 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
- Setups:
Using I2C(1) to communicate with the board’s AHT sensor.
Pin PB6 (SCL) and PB7 (SDA) has connected internally with the sensor.
ahtx0.py library needs to be save in W55MH32’s Flash
- Results:
It shows the Temperature and Humidity result.
SPI bus
See machine.SPI.
Script: GitHub
- Setups:
Connect the SPI(1) with WIZ850io module.
W55MH32L-EVB’s Pin PA3 (Reset), PA4 (CSn), PA5 (SCK) , PA6 (MISO) and PA7 (MOSI) must connect correctly with WIZ850io.
Provide 3.3V power supply to WIZ850io.
- Results:
The serial terminal will get the correct chip version from W5500 chip’s register.