Hi all,
I managed to create custom target configuration for NUCLEO-L452RE-P board (mostly by copying config from L432KC which looks very similar) and compiling, flashing and turning GPIO pins on and off works but wait/sleep functions aren’t waiting. I guess it’s something related to clocks and/or timer but I don’t know where to look any more.
So, if I just toggle the digital out and check the pin with the scope (basic blinky with ThisThread::sleep_for() removed) I get toggling at 220kHz. If I put sleep_for then the toggling happens at 13kHz (whatever number I put into sleep_for).
Can anyone give me any clue about this?
This is the custom configuration:
"NUCLEO_L452RE_P": {
"inherits": ["FAMILY_STM32"],
"core": "Cortex-M4F",
"extra_labels_add": [
"STM32L4",
"STM32L452xE",
"STM32L452RE"
],
"config": {
"clock_source": {
"help": "Mask value : USE_PLL_HSE_EXTC (need HW patch) | USE_PLL_HSE_XTAL (need HW patch) | USE_PLL_HSI | USE_PLL_MSI",
"value": "USE_PLL_MSI",
"macro_name": "CLOCK_SOURCE"
},
"lpticker_lptim": {
"help": "This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer",
"value": 1
}
},
"macros_add": [
"STM32L452xx",
"MBED_TICKLESS",
"EXTRA_IDLE_STACK_REQUIRED"
],
"overrides": { "lpticker_delay_ticks": 0 },
"detect_code": ["0770"],
"device_has_add": [
"ANALOGOUT",
"CRC",
"SERIAL_ASYNCH",
"TRNG",
"FLASH",
"MPU"
],
"release_versions": ["2", "5"],
"device_name": "STM32L452RE",
"bootloader_supported": true
},
EDIT: It’s definitely something clock related. If I start another thread with busy loop then sleep_for() in the main works as it should. But whenever The CPU goes to sleep it doesn’t wake up. For testing I added a serial print before the sleep_for() in the while loop and I get the text only once. This is a bit unfortunate as I need to build low power node