The programming functionality on the micro:bit is implemented through the built-in DAPLink. DAPLink is a low-cost open-source programmer/debugger launched by ARM, commonly used for developing ARM chips. This year, DAPLink has undergone several improvements and upgrades, and the current version is already 0246, while many DAPLink firmware versions on the micro:bit are still at version 0241, which is relatively low and does not support some new features, such as WebUSB.
WebUSB is a very new thing, aimed at making it easier for USB devices to connect to the network, and can even be controlled directly through the browser. For micro:bit, in the future, it will be possible to complete programming, downloading, debugging, data transfer, and file management through the browser without any additional software, allowing for better hardware control. Although the micro:bit currently does not support development using WebUSB, it is foreseeable that this feature will be supported soon.
How to check the DAPLink version number on the micro:bit? First, connect the micro:bit to the computer via USB, and a MICROBIT disk will appear on the computer.
This disk contains two files; by opening the DETAILS.TXT file, we can see the version number and supported features.
If your micro:bit version is low, you will need to upgrade the firmware. The firmware can be downloaded from the community’s Documentation and Firmware Section.
During the upgrade, first press and hold the reset button on the back, then plug in the USB. At this point, a MAINTENANCE disk will appear, and you can copy the firmware file (HEX file) into it. After copying, the upgrade is complete, and the micro:bit will automatically reconnect to USB.
After the upgrade, you can open the DETAILS.TXT file on the micro:bit disk to compare the version numbers and differences in features.
Once the firmware has been upgraded, we can test the WebUSB functionality. Before using it, please ensure that you have successfully upgraded to the new version of the firmware and are using Google Chrome version V65 or above (or a Chromium-based browser).
-
First, open this test website in your browser.
https://armmbed.github.io/dapjs
-
Then, connect the micro:bit to the computer.
-
Click the Choose button in Step 1 of the webpage, select the DAPLink CMSIS-DAP device in the pop-up prompt box, and then click the connection button at the bottom of the prompt box.
-
Wait a moment, and the micro:bit will be displayed in Step 2. Then click the Connect button to connect.
-
Step 3 is to download the test program through the browser. The Flash Green program will display the word Green on the screen, while Flash Red will display the word Red.
-
Step 4 allows you to control the program’s run, pause, single-step, and read registers, etc.
-
Step 5 is the serial monitoring function, where you can input commands in the Serial Monitor box to control the micro:bit. Inputting the letter g and pressing enter will display Green; inputting the letter r and pressing enter will display Red.
Additionally, you can refer to another example provided by Moderator Hori, “Graduating from Blocks! Real Python Programming Project CodeSpace” http://www.micropython.org.cn/bbs/forum.php?mod=viewthread&tid=1204