1

I have micro:bit attached to my laptop on which running Xubuntu 18.04.4 LTS.

After I attached micro:bit an icon appeares on XFCE4 Desktop which can to use to mount this device to

/media/MyUserName/MICROBIT/

This way I can pair the device 'BBC micro:bit CMSIS-DAP' and my laptop by using https://python.microbit.org/v/2.0 in my Google Chrome browser.

But in mu-editor I can't do this, can't use neither REPL, nor FILE because I get this message box:

"Colud not find an attached device

Please make sure the device is plugged into this computer.

It must have a version of MicroPython (or CircuitPython) flashed onto it before the REPL will work.

Finally, press the device's reset button and wait a few seconds before trying again."

$ lsusb

ID 0d28:0204 NXP LPC1768

This line above is for the micro:bit attached.

$ ls /dev/ | grep tty

In the output of the command above there is not a /dev/ttyACM0 or other ACM* device out there.

Why is not there such a device /dev/ttyACM* out there?

I suspect mu-editor does not find the device because there is no such device /dev/ttyACM* out there.

How can I solve the problem for mu-editor?

Pal Csanyi
  • 101
  • 1
  • 9

2 Answers2

0

I use Debian Linux. There are two things you may need to do:

  1. I had to update the firmware on the micro:bits recently to be able to continue using the mu-editor. The instructions on how to do this are here:

[https://microbit.org/get-started/user-guide/firmware/]

  1. Mount the micro:bit. This can be done by double clicking on the 'MICROBIT' shown in e.g. Nautilus, or from the command line using udisksctl. Please find a bash script below called microbit_mount.sh which uses udisksctl to mount and dismount a microbit. To mount a microbit, use the command:

microbit_mount.sh mount

To unmount a microbit, use

microbit_mount.sh unmount

I have these commands aliased to mm amd md.The microbit will appear in /media/MICROBIT. You may need to remount the microbit after each flash.

#!/bin/bash
# microbit_mount.sh
# mount and unmount microbit
# modified from https://askubuntu.com/questions/342188/how-to-auto-mount-from-command-line

BASEPATH="/media/$(whoami)/"
MICRO="MICROBIT"

if [ $# -eq 0 ]
then
    echo "no argument supplied, use 'mount' or 'unmount'"
    exit 1
fi

if [ $1 == "--help" ]
then
    echo "mounts or unmounts a BBC micro:bit"
    echo "args: mount - mount the microbit, unmout - unmount the microbit"
fi

# how many MICRO found in udisksctl dump
RESULTS=$(udisksctl dump | grep IdLabel | grep -c -i $MICRO)

case "$RESULTS" in

0 )     echo "no $MICRO found in 'udkisksctl dump'"
        exit 0
        ;;

1 )     DEVICELABEL=$(udisksctl dump | grep IdLabel | grep -i $MICRO | cut -d ":" -f 2 | sed 's/^[ \t]*//')
        DEVICE=$(udisksctl dump | grep -i "IdLabel: \+$DEVICELABEL" -B 12 | grep " Device:" | cut -d ":" -f 2 | sed 's/^[ \t]*//')
        DEVICEPATH="$BASEPATH""$DEVICELABEL"
        echo "found one $MICRO, device: $DEVICE"

        if [[ -z $(mount | grep "$DEVICE") ]]
        then
            echo "$DEVICELABEL was unmounted"
            if [ $1 == "mount" ]
            then
                udisksctl mount -b "$DEVICE"
                exit 0
            fi
        else
                echo "$DEVICELABEL was mounted"
                if [ $1 == "unmount" ]
                then
                    udisksctl unmount -b "$DEVICE"
                    exit 0
                fi
        fi
        ;;

* )     echo "more than one $MICRO found"
        ;;

    esac

echo "exiting without doing anything"
Oppy
  • 2,662
  • 16
  • 22
  • I just did the firmware update but still can't use mu-editor to use REPL or access the filesystem by using Files button of mu-editor. – Pal Csanyi Jul 22 '20 at 14:31
  • I extended my answer to include how to mount the microbit using udisksctl through a bash script. Hopefully this helps. – Oppy Jul 22 '20 at 19:03
0

I installed Xubuntu 20.04 and on this system mu-editor works in the Files mode and REPL mode with the attached micro:bit.

Pal Csanyi
  • 101
  • 1
  • 9