Bluepill board support for Mbed OS 6

Hello,

the Bluepill (STM32F103C8) module is supported as a custom board for Mbed OS 6. You can find the repository at mbed-os-bluepill.

Best regards, Zoltan

3 Likes

Hi Zoltan

With mbed-os-6.1.0, Bluepill support should be even easier!
You should only keep PeripheralPins.c and PinNames.h,
then, custom_target has only to inherit from “MCU_STM32F103x8”

3 Likes

Hello Jerome,

Thank you for the notice and making life easier!

Best regards, Zoltan

Would it be possible for this to be updated for Mbed OS 6.2? I tried keeping only PeripheralPins.c and PinNames.h and changing the target inheritance as Jerome suggested, and I got blinky working but USB does not work for me.

Hello,

Thank you for the feedback. mbed-os-bluepill is now updated to Mbed OS 6.2.0.

Best regards, Zoltan

1 Like

Thank you for the update. I still seem to have a problem with USB. The following code works fine on the ST L475 board, but not on a Bluepill with your target configuration:

Here’s the Linux kernel output:

[3165.055171] usb 1-1.3: new full-speed USB device number 36 using xhci_hcd
[ 3165.135362] usb 1-1.3: device descriptor read/64, error -32
[ 3165.323206] usb 1-1.3: device descriptor read/64, error -32
[ 3165.511339] usb 1-1.3: new full-speed USB device number 37 using xhci_hcd
[ 3165.591343] usb 1-1.3: device descriptor read/64, error -32
[ 3165.779243] usb 1-1.3: device descriptor read/64, error -32
[ 3165.887440] usb 1-1-port3: attempt power cycle
[ 3166.491330] usb 1-1.3: new full-speed USB device number 38 using xhci_hcd
[ 3166.491515] usb 1-1.3: Device not responding to setup address.
[ 3166.699506] usb 1-1.3: Device not responding to setup address.
[ 3166.907313] usb 1-1.3: device not accepting address 38, error -71
[ 3166.987301] usb 1-1.3: new full-speed USB device number 39 using xhci_hcd
[ 3166.987486] usb 1-1.3: Device not responding to setup address.
[ 3167.195510] usb 1-1.3: Device not responding to setup address.
[ 3167.403314] usb 1-1.3: device not accepting address 39, error -71
[ 3167.403471] usb 1-1-port3: unable to enumerate USB device

Hello,

The BLUEPILL custom target is based on (inherits from) the officially supported MCU_STM32F103x8 target which does not implement a USBDEVICE. You can verify that in the mbed-os/targets.json at master · ARMmbed/mbed-os · GitHub file. By the way, neither the official NUCLEO_F103RB target implements a USBDEVICE. On the other hand, for the officially supported DISCO_L475VG_IOT01A target Mbed OS 6 implements a USBDEVICE. That’s why the #include "mbed.h"#include "USBMouse.h"//create mouse objectUSBMouse mous - Pastebin.com code compiles.

Best regards, Zoltan

The code compiles fine for both the BLUEPILL target and the NUCLEO_F103RB target, it just doesn’t work correctly. Is this something that could be added in the BLUEPILL target? Or must it be added in the base MCU_STM32F103x8 target?

Hello,

To make USB work update the TARGET_BLUEPILL directory in your project and add the following mbed_app.json file to the root directory of your project:

{
    "requires": ["bare-metal","drivers-usb", "events"],
    "target_overrides":{
        "*": {
            "target.clock_source": "USE_PLL_HSE_XTAL",
            "target.clock_source_usb": "1",
            "target.device_has_add": ["USBDEVICE"]
        }
    }
}

Best regards, Zoltan

1 Like

Hello, mbed newbie here. Just installed mbed studio and imported your project. Can’t build or set target.
Here is an output:
c:\Users\DmG\Mbed Programs\bluepill>mbed compile -t GCC_ARM -m bluepill
[mbed] Working path “c:\Users\DmG\Mbed Programs\bluepill” (program)
Traceback (most recent call last):
File “c:\Users\DmG\Mbed Programs\bluepill\mbed-os\tools\targets_init_.py”, line 151, in target
resolution_order = get_resolution_order(json_data, name, )
File “c:\Users\DmG\Mbed Programs\bluepill\mbed-os\tools\targets_init_.py”, line 139, in get_resolution_order
order = get_resolution_order(json_data, par, order, level + 1)
File “c:\Users\DmG\Mbed Programs\bluepill\mbed-os\tools\targets_init_.py”, line 137, in get_resolution_order
parents = json_data[target_name].get(“inherits”, )
KeyError: ‘MCU_STM32F103x8’

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “c:\Users\DmG\Mbed Programs\bluepill\mbed-os\tools\make.py”, line 421, in
main()
File “c:\Users\DmG\Mbed Programs\bluepill\mbed-os\tools\make.py”, line 311, in main
mcu = extract_mcus(parser, options)[0]
File “c:\Users\DmG\Mbed Programs\bluepill\mbed-os\tools\options.py”, line 145, in extract_mcus
update_target_data()
), exc)
File “c:\Users\DmG\AppData\Local\Mbed Studio\mbed-studio-tools\python\lib\site-packages\future\utils_init_.py”, line 398, in raise_from
exec(execstr, myglobals, mylocals)
File “”, line 1, in
tools.utils.NotSupportedException: target BLUEPILL has an incomplete target definition
[mbed] ERROR: “c:\Users\DmG\AppData\Local\Mbed Studio\mbed-studio-tools\python\python.exe” returned error.
Code: 1
Path: “c:\Users\DmG\Mbed Programs\bluepill”
Command: “c:\Users\DmG\AppData\Local\Mbed Studio\mbed-studio-tools\python\python.exe -u c:\Users\DmG\Mbed Programs\bluepill\mbed-os\tools\make.py -t GCC_ARM -m bluepill --source . –
build .\BUILD\BLUEPILL\GCC_ARM”
), exc)
File “c:\Users\DmG\AppData\Local\Mbed Studio\mbed-studio-tools\python\lib\site-packages\future\utils_init_.py”, line 398, in raise_from
exec(execstr, myglobals, mylocals)
File “”, line 1, in
tools.utils.NotSupportedException: target BLUEPILL has an incomplete target definition
[mbed] ERROR: “c:\Users\DmG\AppData\Local\Mbed Studio\mbed-studio-tools\python\python.exe” returned error.
Code: 1
Path: “c:\Users\DmG\Mbed Programs\bluepill”
Command: "c:\Users\DmG\AppData\Local\Mbed Studio\mbed-studio-tools\python\python.exe -u c:\Users\DmG\Mbed Programs\bluepill\mbed-os\tools\make.py -t GCC_ARM -m bluepill --source . –
), exc)
File “c:\Users\DmG\AppData\Local\Mbed Studio\mbed-studio-tools\python\lib\site-packages\future\utils_init_.py”, line 398, in raise_from
exec(execstr, myglobals, mylocals)
), exc)
), exc)
File “c:\Users\DmG\AppData\Local\Mbed Studio\mbed-studio-tools\python\lib\site-packages\future\utils_init_.py”, line 398, in raise_from
exec(execstr, myglobals, mylocals)
File “”, line 1, in
tools.utils.NotSupportedException: target BLUEPILL has an incomplete target definition
[mbed] ERROR: “c:\Users\DmG\AppData\Local\Mbed Studio\mbed-studio-tools\python\python.exe” returned error.
Code: 1
Path: “c:\Users\DmG\Mbed Programs\bluepill”
Command: “c:\Users\DmG\AppData\Local\Mbed Studio\mbed-studio-tools\python\python.exe -u c:\Users\DmG\Mbed Programs\bluepill\mbed-os\tools\make.py -t GCC_ARM -m bluepill --source . –
build .\BUILD\BLUEPILL\GCC_ARM”
Tip: You could retry the last command with “-v” flag for verbose output

Hello Dmitry,

  • Open the Target drop-list.
  • Type BLUEPILL (upper case!) into the Search targets edit box and select BLUEPILL from the drop-list.
  • Click on the button with a hammer icon on it (Build program).

Although the bluepill board is a good choice for Mbed OS 2, because of it’s relatively small SRAM (20 kBytes) and flash size (64/128 kBytes) it isn’t very suitable for Mbed OS 6 (especially when RTOS is used).

To learn Mbed OS 6 the blackpill (128 kBytes SRAM, 512 kBytes flash memory) is a much better choice (still at a quite low price).

Best regards, Zoltan

having the same issue as dmitry here even though i did all that: just installed mbed studio, imported the mbed6 bluepill example blinky project, selected BLUEPILL as the target, compiling fails with:

KeyError: 'MCU_STM32F103x8'
tools.utils.NotSupportedException: target BLUEPILL has an incomplete target definition

(those are the actual errors thrown in between a bunch of python stacktrace that’s most likely irrelevant)

almost sounds to me like MCU_STM32F103x8 doesn’t exist in whatever list it’s trying to find compatible MCUs?

1 Like

Hi all
Note I just added BLUEPILL support in this new repo:

5 Likes

Hello Jerome,

Thank you for the STM32 custom targets support! It makes life easier for users and I hope it will motivate the other Mbed partners to provide such support too.

With best regards, Zoltan

great starting point also for using custom_targets with CLI2 and cmake.

1 Like

anyone help to install it

Hello alma_mohmoud,

Visit GitHub - ARMmbed/stm32customtargets: Enable the support of your custom boards in mbed-os 6 and have a look at the Usage and BLUEPILL sections.