Can't compile code with the Servo library with a Blackpill (STM32F401CCU6)

I wrote some code to test a ESC I bought for my sumo robot. To control the motors with an Arduino, I would use the writeMicroseconds() function from the Servo library with a value ranging from 1000 to 2000 (with 1500 being neutral) as a parameter.

Now, instead of an Arduino nano, I’m using a Blackpill (STM32F401CCU6). And when I try to compile the code, I get the following error:

In file included from src/main.cpp:3:
.pio/libdeps/blackpill_f401cc/Servo/src/Servo.h:77:2: error: #error "This library only supports boards with an AVR, SAM, SAMD, NRF52 or STM32F4 processor."
   77 | #error "This library only supports boards with an AVR, SAM, SAMD, NRF52 or STM32F4 processor."
      |  ^~~~~

I don’t understand why it doesn’t work because the error says that the SMT32F4 platform is supported.
I’ve seen that it is possible to generate the signal I want with different methods, but I want to make this one work because of its simplicity.

I’m sort of new to development on microcrontrollers, so if this question seems naive, it’s because it is.

Full platformio.ini?

[env:blackpill_f401cc]
platform = ststm32
board = blackpill_f401cc
framework = arduino
monitor_speed = 115200
upload_protocol = dfu
build_flags = 
	-D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC
	-D USBCON
	; -D ARDUINO_ARCH_STM32F4
lib_deps = 
	z3t0/IRremote@3.5.0
	arduino-libraries/Servo@^1.1.8

No. This line should be removed and the .pio directory should be deleted for a clean rebuild.

The Arduino core already has the correct Servo library built in. Core built-in libraries need not be declared. You’re forcing the wrong Servo library into the build.

2 Likes