basnotes

 

Micro:bit on Linux

tip

Using Micro:bit on a Linux machine is apparently not evident…

Micro:bit failed to connect

I’m using Microsoft MakeCode for Micro:bit to create applications to run on my Micro:bit.
When plugging in my Micro:bit using the USB connection, pairing fails with the above message. From the message, it is not evident why it fails.

After spending some time searching, I found the following: apparently Linux (Ubuntu in my case) does not allow open interaction with USB devices without proper permissions.

Chrome reports the following:

Chrome device log

The resolve this issue, you’ll need to create a rule:

sudo nano /etc/udev/rules.d/50-microbit.rules

With content:

#SUBSYSTEM=="usb", ATTRS{idVendor}=="0d28", ATTR{idProduct}=="0204", MODE="0660", GROUP="plugdev"

To get the vendor and product ID’s, run lsusb:

~/lsusb
Bus 003 Device 054: ID 0d28:0204 NXP ARM mbed

As can be seen, ID reports 0d28 which is the vendor ID and 0204 which is the product ID.

After saving the rule file and restarting Chrome, you can create a program in MakeCode and download it to your Micro:bit directly.

October 26, 2024