Search code examples
adalibusbbbc-microbit

Ada on the microbit: scrolling text example not working, no libusb library found


I followed the adacore tutorial on displaying scrolling text (https://blog.adacore.com/ada-for-microbit-part-1-getting-started) but can't get it working on my microbit.

Maybe my microbit is a more recent version that is not yet supported? The reason I suspect this is that my board id (9904) was not supported the first time I tried to flash to the board. I used the fix described here: Unable to get the Ada scrolling text demo working on the microbit on GNAT 2019 community edition and added the following line in board_ids.py:

"9904": BoardInfo( "micro:bit", "nrf51", "l1_microbit.bin", ),

After doing this, I was able to flash the scrolling text example to the board, but I had the following warning:

0000601:WARNING:common:STLink and CMSIS-DAPv2 probes are not supported because no libusb library was found.

The problem now is that only one LED lights up. It seems as though that single LED lights up correctly according to the input text based on its blinking pattern. I'm not sure whether the libusb warning is what is causing the problem.

I'm using the GNAT 2020 version of x86_64 and the arm-elf. I've been stuck on this for a while and would appreciate any suggestions. Thanks!

Edits:

I'm on windows 10.

I don't think the problem is to do with pyocd/libusb because I no longer get any warnings when flashing to the board, after ensuring I have a libusb dll in the same directory as the python exe in GNAT. The scrolling text example is still not working (only one LED lighting up).

I also tried this on a different computer, with the same result.

From https://github.com/AdaCore/Ada_Drivers_Library/issues/379 it looks like the new versions of the board are not supported by the ada drivers library? But that issue concerns the accelerometer version, I'm not sure if it's the cause in my case.


Solution

  • Your LED problem is going to be that the V2 board has reworked the relationship between GPIO pins and LEDs (now hugely more useful!)

    The microbit.org page here says

    The LED matrix is physically laid out as a 5x5. On the V2 board this is implemented as a 5x5 matrix, but in the V1, this is implemented as a scanned matrix of 9x3 (i.e. 9 columns by 3 rows). Row 2 Col 8, and Row 2 Col 9 are not used.

    You’ll need to rework Ada_Drivers_Library/boards/MicroBit/src/microbit-display.adb in the section marked "Pixel to IO Pins".