The Web USB API facilitates communicating with USB devices from the browser. The API is currently available in Chrome based browsers and is supported in the MakeCode Editor and the beta branch of the Python Editor. This enables you to flash your micro:bit straight from the browser without the need to save the .hex file first, and use serial communication between the micro:bit and the editor.


As it is still in a beta phase of testing, you may experience issues in using it. Here is some troubleshooting advice for using webUSB with the micro:bit and the editors.


General

  • If you see the message 'no compatible devices found' when you try to connect, you may need to update the micro:bit firmware.

  • The micro:bit should show up in the browser as 'BBC micro:bit CMSIS-DAP'. The first time you pair the micro:bit using webUSB it may show up as 'LPC1768' and thereafter as  'BBC micro:bit CMSIS-DAP'. This does not affect the operation. See this issue on GitHub for further explanation.

  • If you are moving between editors eg Python > MakeCode, you may find that flashing via webUSB takes longer if the micro:bit already contains a program created in the previous editor.


MakeCode

For further information regarding bugs and features in the MakeCode editor see issues tagged with webusb on Github.


Python Editor

error when trying to connect micro:bit or use serial

  • You will see an error if you try and use webUSB functions in an incompatible browser. As WebUSB is only available in Chrome based browsers, including the latest Edge beta, you will not be able to use the connect, flash and serial features in other browsers that do not support them.

  • Due to a technical limitation in the software you may experience data loss if you are sending data over serial at a high rate. Try adding a sleep() to the program as a workaround.

For further information regarding bugs and features in the Python editor see issues tagged with webUSB on Github.


Linux

  1. Close Chrome
  2. Create a file at
    /etc/udev/rules.d/50-microbit.rules
     with the following content:
    SUBSYSTEM=="usb", ATTR{idVendor}=="0d28", MODE="0664", GROUP="plugdev"
  3. Add your user to the plugdev group (replace with your username): 
    sudo adduser your_username plugdev 
  4. Restart the udev rules 
    sudo udevadm control --reload-rules 
  5. Open Chrome and try to pair again 


Windows

  • WebUSB is only supported in Windows 8.1 or above.

  • If you have upgraded from a previous version eg Windows 7 > Windows 10 you may experience a confict with an old driver. If the Mbed Serial driver has been manually installed (by downloading and executing the .exe) it might interfere with the Windows 8/10 automatic installation of the WebUSB driver.

To check if you have this driver already:

  1.  Open Windows Device Manager and see if the micro:bit USB device is shown. If it is...

  2. find the mbed Composite Device entry, right click on it and select Uninstall device.

  3. A new window will open, mark the Delete the driver software for this device box and click Uninstall.

  4. Unplug and replug your micro:bit and it should appear under USB devices.