2 years, 1 month ago.

Why we cannot use FastPWM.h with NUCLEO-F031K6 ???

Hi everyone,

This morning, I meet a problem with using the FastPWM librairy with the NucleoF031K6.

Only with writing :

  1. include "FastPWM.h"

it cannot compile and I have this error :

Error: Undefined symbol getChannel(TIM_TypeDef*, PinName) (referred from FastPWM_STM_TIM.NUCLEO_F031K6.o).

The code is really simple :

  1. include "mbed.h"
  2. include "FastPWM.h"

FastPWM clock_system(A6,1);

int main() { clock_system.period_us(0.24f); period : 0.24µs clock_system.write(0.50f);; duty cyle 50% }

I don't know if there are mistakes but if you have the answer to my problem, I'll take it !

Thanks by advance!

Question relating to:

Affordable and flexible platform to ease prototyping using a STM32F031K6T6 microcontroller.

1 Answer

2 years, 1 month ago.

Your Board isn't supported by the library, however you can add yours as described in


under the section 'Adding other microcontrollers '

You have to add your microcontroller in the file FastPWM_STM_TIM_PinOut.cpp in the folder 'Device' within the imported library FastPWM

Change line 3 from

#if defined (TARGET_NUCLEO_F030R8) || (TARGET_DISCO_F051R8)


#if defined (TARGET_NUCLEO_F030R8) || (TARGET_DISCO_F051R8 ||(TARGET_NUCLEO_F031K6))