Stamp-P4: Flash Firmware & Run Code
1. Preparation
- Refer to the UIFlow2 Web IDE Tutorial to understand the basic workflow of UiFlow2, and complete the installation of the M5Burner firmware flashing tool.
- Log in and register in M5Burner. After successfully flashing the device, the device information will be bound to that account.
2. Firmware Flashing
- Download the firmware compatible with
Stamp-P4 in M5Burner, as shown below.
- Connect the device to your computer via USB cable. In M5Burner, click the
Burn button for the corresponding firmware, select the device port, then click Start.
Note
If this is the first time connecting your device, you will need to bind the device to your account.
- Fill in the required configuration information, then click
Next to start flashing.
- Server: The server address the device connects to
- WIFI SSID/WIFI Password: The Wi-Fi name and password for the device
- SNTP Server
- SNTP0: Alibaba Cloud NTP server (China)
- SNTP1: Japan NTP server pool
- SNTP2: Global public NTP server pool
- Timezone: Timezone configuration
- Boot Option
- run main.py directly: Run main.py directly
- show startup menu and network setup: Display the startup screen (MENU) and network settings
- only net work setup: Network setup only
When the prompt Burn successfully, click here to return appears, the flashing has completed successfully. Restart the device at this point to apply the flashed configuration.
3. Log in to UiFlow2
Go to the UiFlow2 page and click the user icon in the upper-right corner to log in to your UiFlow2 account.
UiFlow2 Account
This account must be the same account used to log in to M5Burner. Once logged in, devices connected to a valid Wi-Fi network under this account can be viewed by clicking Select Device. To transfer device ownership, the binding between the device and the account must first be removed.
4. Entering the Programming Interface
Stamp-P4 can connect to UiFlow2 via USB, Wi-Fi, or Pair Code, and then enter the programming interface. The following tutorial uses Stamp-P4 paired with the Stamp-AddOn C6 For P4 Wi-Fi expansion module as an example. The specific steps are as follows:
Wi-Fi Mode
- Ensure Wi-Fi has been configured: When flashing the firmware, configure the Wi-Fi and other settings in the M5Burner
Configure section.
- Open the device list.
- Select an online device and click
Confirm.
- Set the
Mode to Cloud at the bottom of the interface.
You have successfully entered the UiFlow2 programming interface for the device.
Pair Code Mode
Set the Mode to (Cloud)Pair Code at the bottom of the interface.
Ensure Wi-Fi has been configured: When flashing the firmware, configure the Wi-Fi and other settings in the M5Burner Configure section.
Connect Stamp-P4 to your computer via USB cable.
Click Web Terminal in the lower-left corner of the interface. In the dialog box, select the serial port for Stamp-P4, then click Connect to open the serial monitor.
After a few seconds, the pairing code will be displayed automatically.
- Click
Select Code. In the dialog that appears, enter the Pair Code and click Add Device to connect Stamp-P4 to UiFlow2.
Pair Code Notes
1. Switching browsers, using private/incognito mode, or clearing the UiFlow website cache will invalidate the existing pairing state.
2. Simply closing the tab, restarting the browser, or logging in/out of the account will not affect an existing pairing.
3. Once a device is paired by another browser, the pairing in the original browser will be immediately invalidated.
USB Mode
- Connect Stamp-P4 to your computer via USB cable. Select the Stamp-P4 device module from the device list, then click
Confirm.
- Set the
Mode to USB at the bottom of the interface.
- Click the
WebTerminal button.
- In the dialog box, select the serial port for
Stamp-P4 and click Connect.
When the WebTerminal screen displays Connected to Serial Port!, the USB connection is successful and you may proceed to the UiFlow2 programming interface.
5. RUN
With all the above steps completed, you can now start programming with UiFlow2.