BPI-Leaf-S3, update MicroPython 1.20.0 firmware, support ESP-NOW, solve small problems connecting to Windows platform

Recently, the MicroPython open source organization released version 1.20.0, and recently merged the ESP-NOW function into the mainline.

GitHub: MicroPython 1.20.0 Release

esp32: ESP-NOW support for ESP32 and ESP8266 by glenn20 Pull Request #6515 micropython/micropython (github.com)

Also I found a solution to a small problem connecting to the Windows platform.

When using multiple ESP32S3 development boards with the same firmware on the Windows platform, their built-in USB-CDC connection is unstable.

After connecting the first ESP32S3 development board in Windows, and then connecting the second or more, it will take about 3 seconds to be recognized as an available serial device by the Windows system.

And after using the mpremote devs command, you can see that the serial number (Serial String) of the subsequent connected USB device is different from the first one. And pull out all the development boards, when connecting each development board separately, their device serial numbers are the same.

This confirms that the problem exists only on the Windows platform, because on Linux systems, connecting multiple USB devices with the same serial number will not fail.

Because the Windows device driver gives each device a device ID (Device ID). The original intention of the design is to distinguish each device. The DeviceID naming rules for USB devices are very simple. For example, if the VID of a USB device is 0x1234, the PID is 0x5678, and the serial number is 00001, then its DeviceID is:

USB\VID_1234&PID_5678\00001

Since VID is the unique identifier of the USB manufacturer, PID is the unique identifier of the product defined by the manufacturer, and the serial number should theoretically be the unique identifier of similar products. So in theory, such a DeviceID can distinguish all USB devices.

If there is no serial number, Windows will replace the serial number part of the Device ID with a string of characters related to the HUB and its port, which can basically guarantee the uniqueness of the DeviceID. This kind of Device ID looks like:

USB\VID_1234&PID_5678\X&YYYYYYYY&Z

Among them, X is the level of the device, Z represents which port of the HUB the device is plugged into, and YYYYYYYY is a constant related to the HUB.

In the early Windows driver, if the access device has the same DeviceID, it can only crash. But now, after waiting for a few seconds, it is judged that the newly connected device does not have a serial number, and then replaces it with a new character as described above.

On development boards that can use the tinyUSB and USB-CDC functions, Espressif Systems provides a method to modify it via ESP-IDF.

Espressif IoT Development Framework Configuration

(Top) → Component config → TinyUSB Stack → Use TinyUSB Stack → Descriptor configuration

20230519144930

20230519145119

I found that simply deleting the default value 123456 here can make the USB-CDC lose the serial number, but it does not affect its function. However, in the Windows platform, there will be no need to wait, and new characters will be automatically replaced as described above.

The newly compiled BPI-Leaf-S3 has updated the MicroPython version, supports ESP-NOW, and canceled the USB serial number to ensure the stability of the Windows platform.

Firmware download page: https://github.com/BPI-STEAM/BPI-Leaf-S3-Doc/tree/main/micropython-firmware

BananaPi wiki: https://wiki.banana-pi.org/BPI-Leaf-S3

BPI-Steam Documentation: https://bpi-steam.com/Leaf_S3_doc/en/

BPI-Leaf-S3 Official AliExpress

For OEM&OEM customized service, please email: [email protected]

1 Like