In this guide, I will explain how to start blinking LEDs using the STM32 sensor board mezzanine running ARM mbed OS. For information on mbed OS see https://www.mbed.com/en/platform/mbed-os.
First I will cover installing the board. The board does not come with spacers included; you will need to purchase some separately. I have the HiKey SBC and, unfortunately, the mounting holes in the HiKey are slightly misaligned with the mezzanine. Fortunately, the mezzanine has a micro-USB port that can be used instead of the high-speed connector. First, attach the mezzanine to the low-speed pin headers. I couldn’t use screws as fasteners because of the alignment problem; instead, I threaded a short (approx. 5cm) length of solid-core hookup wire through the mounting hole of the mezzanine, standoff, and mounting hole on the HiKey and twisted the ends of the wire together. I used nylon standoffs, 8mm tall with a 3mm inside diameter; specifically, Keystone Electronics PN 25509 purchased from Mouser (Mouser PN 534-25509). Now plug a USB cable into the type-A port on the SBC and the type-B micro-USB port on the mezzanine.
To test if the mezzanine is connected correctly, power up your SBC and watch LED LD1 (located below the 96Boards silkscreen logo). If the low-speed connector is aligned correctly, LD1 will begin blinking red during the boot phase of the SBC - this means that power is supplied to the mezzanine. Once the SBC has finished booting and finished USB enumeration, LD1 should stop blinking and emit a constant red light. If LD1 never stops blinking, there is a problem with the USB connection.
Now that the mezzanine is installed, we can use the mbed online IDE to write and compile a program. Go to https://developer.mbed.org and sign up for an account. Once you are logged into your account, go to https://developer.mbed.org/platforms/ST-B96B-F446VE. Click on the “Add to your mbed compiler” link (on the right-hand column below the ST logo). Now the link should change to “open mbed compiler” - click on it. You will be taken to the mbed compiler and the “create a new program” dialog box will appear. Click on the “template” drop-down menu and select “Blinky example for mbed OS 5.0 clone of https://github.com/” then click Okay.
NOTE you will need to edit “main.cpp” and change “LED1” to “PD_10”. LED1 should be the same PinName as PD_10, but it isn’t.
To compile the program, press the key combination: “CTRL-D”. The program will be compiled on the mbed servers and the *.bin file will be downloaded by your browser.
Finally, we need a way to flash the *.bin file to the STM32 MCU. This is easily done using https://github.com/texane/stlink. Clone the repository and “cd” into the root directory. Run “make release” to compile the application. To perform a system-wide installation, run (from the root directory) “cd build/Release; sudo make install”. You may get a message saying “cannot open shared object file”; if this happens, run “sudo ldconfig”. This will install the “st-flash” application. To flash the *.bin file to the STM32 MCU, run the command ‘sudo st-flash write “/path/to/my/BinFile.bin” 0x8000000’ where BinFile.bin is the file you downloaded from the online compiler.
If everything was successful, you should have a red blinking LED in the bottom right corner of your board.
Please reply with any errors or problems you encounter so that I can correct and clarify them.
Feedback is always appreciated!