L432 Ticker class problem

Hello everyone,
I’m using a NUCLEO-L432KC board programmed with Mbed studio 1.4.5 and the library mbed-os-6.16.0-rc1.

I’d like to use the Ticker class for a project but I encountered some problems.

Trying to solve the problem I ended up testing the reference example that should toggle a led. To my surprise even the example does not work. Here is the code I tested:

#include "mbed.h"

Ticker flipper;
DigitalOut led1(LED1);

void flip()
    led1 = !led1; //the led does not blink in the callback 

int main()
    flipper.attach(&flip, 200ms); // the address of the function to be attached (flip) and the interval (2 seconds)

    // spin in a main loop. flipper will interrupt it to call flip
    while (1) {
        // led1 = !led1; //removing this comment the led blinks correctly

Am I doing something wrong? Is the ticker not supported for this board?
Thanks in advance for any help!


I did copy & paste of your code into Keil Studio Cloud and it works as expected, the led toggling few times per second.

  • Keil Studio Cloud
  • Nucleo-L432KC
  • MbedOs 6.16

BR, Jan

Thank you for testing.
On my side I discovered it works only the LowPowerTicker class, executing as expected. When using the normal Ticker class it does not work.
Quite strange.

Thank you for your time!