W55MH32L-EVB MicroPython reference script

In this page, we will show all network and peripheral MicroPython script with simple setup.

Basic Setups

  1. Use a USB type C cable to connect the DAP-LINK Port with your PC to provide power and serial communication with Thonny.

  2. Go to Thonny and select the correct COM port and interpreter (MicroPython generic).

W55MH32L-EVB connection

WIZnet5K Networking

See network.WIZNET5K and socket

Setup:

  1. Connect the board and PC with an Ethernet cable.

  2. 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.

_images/static.png

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.

_images/DHCP.png

TCP Server (one time loopback)

Script: GitHub

Setup:
  1. Open a TCP socket tester and send data to the board using TCP client.

  2. Suggestion: Hercules

Results:
  1. Receive loopback message from the board.

  2. The TCP socket will be close after the connection has been disconnected.

  3. Please run the script again after disconnected the TCP connection.

_images/loopback_static.png

TCP Client (one time loopback)

Script: GitHub

Setup:
  1. Set your PC’s IP address to ‘192.168.1.100’.

  2. Open a TCP socket tester and send data to the board using TCP Server in port ‘5001’.

  3. Suggestion: Hercules

Results:
  1. The script will automatically connect ‘192.1681.1.100’ with port ‘5001’.

  2. Receive loopback message from the board.

  3. The TCP socket will be close after the connection has been disconnected.

  4. Please run the script again after disconnected the TCP connection.

_images/loopback_static_client.png

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.

_images/ADC_test.png

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.

_images/ADC_test.png

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

_images/multimeter.JPG

Bitstream

See machine and machine.Pin.

Script: GitHub

Setups:
  1. Provide power and connect WS2812 to a GPIO pin (PD5 for example)

Results:

It will turn on 8 WS2812 LEDs into green color.

_images/bitstream.JPG

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.

_images/RTC_test.png

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

_images/timer_test.png

UART (serial bus)

See machine.UART.

Script: GitHub

Setups:
  1. Connect a USB-TTL module with W55MH32L-EVB’s PA2(TX) and PA3 (RX) for USART2 to communicate with the PC.

  2. Open a serial terminal to receive and send data using UART

Results:
  1. The USB-TTL module serial terminal shows 10 sets of “abc” data.

  2. The MicroPython serial terminal shows 1 set of “123” data.

_images/UART.png

I2C

See machine.I2C.

Script: GitHub

ahtx0 library: GitHub

Setups:
  1. Using I2C(1) to communicate with the board’s AHT sensor.

  2. Pin PB6 (SCL) and PB7 (SDA) has connected internally with the sensor.

  3. ahtx0.py library needs to be save in W55MH32’s Flash

Results:

It shows the Temperature and Humidity result.

_images/AHT_I2C.png

SPI bus

See machine.SPI.

Script: GitHub

Setups:
  1. Connect the SPI(1) with WIZ850io module.

  2. W55MH32L-EVB’s Pin PA3 (Reset), PA4 (CSn), PA5 (SCK) , PA6 (MISO) and PA7 (MOSI) must connect correctly with WIZ850io.

  3. Provide 3.3V power supply to WIZ850io.

Results:

The serial terminal will get the correct chip version from W5500 chip’s register.

_images/spi_wiznet.png