Closed lefebvresam closed 4 months ago
Hmm, how about making it a target option instead? e.g. here: https://github.com/mbed-ce/mbed-os/blob/master/targets/targets.json5#L4834
That would allow people to decide if they want LSCO via a mbed_app.json setting!
It is not related to your application with the battery? The LSCO is related to LSE and can be used for external devices. So its settings/register could have same behavior like LSE when Vbat is powered, mean it can be stored in backup domain.
I think you are right. I have a backup battery which is permanently connected. I agree to make it open for everyone and put it in an option, but I was wondering if there is a 'standardized' method for this. With other words, are other devices also exposing it as an option?
The strange thing is that HAL_RCCEx_DisableLSCO is never used for other CPU's.
Nothing strange, you do not need call disable when you never call enable. That seems be state of all clock settings of STM32 in Mbed.
So i see this like a project specific option. But i believe it could be handy to make a note about this in https://github.com/mbed-ce/mbed-os/tree/master/targets/TARGET_STM#low-power-clock
I'm going to close this since it seems like it's more of a prototyping level thing. But please do create a wiki page if you'd like to make sure other people can find this information!
In system_clock.c (TARGET_STM32U575xG) I made a test option to output the 32kHz signal to PA_2 pin:
But if you disable that option after using it, the register config survives a reboot and the 32KHz clock is still at the output pin. It makes it impossible to use that pin for digital I/O, Interrupt or Pwmout. I don't know why those register settings are permanent. I should expect to redo register settings after every reset.
My suggestion is to disable the LSCO before this call to ensure that the output is released when the debug option is put off:
I tested this and it works as expected. The strange thing is that HAL_RCCEx_DisableLSCO is never used for other CPU's. When OK I can make a PR for that.