L432 MSI clock configuration issue
I got an issue with a STM32L432 project, were the MCU doesn't seem to behave according to the reference manual.
This is the first time I deal with an L4xx variant, so I lack the experience with the clock tree of this devices.
The sample code is a minimal Segger Embedded Studio application, with some printf() calls and an endless loop.
The code works so far, I can flash and debug it.
What doesn't work are my modifications to the clock configuration.
Hardware is the L432 Nucleo-32 I got recently, just to mention it.
The clock tree setup is basically the standard code, leaving MSI enabled in the default configuration (MSI, MSIRANGE=6, 4MHz), via functions SystemInit() and SystemCoreClockUpdate() in system_stm32l4xx.c.
As modification, I tried to set a higher clock frequency, as MSI can be set in a range from 100kHz to 48MHz.
However, I am not able to set a frequency higher than 8MHz (RCC->CR [MSIRANGE] = 7), writes to higher values are simply ignored.
The code basically works (MSION = 1, MSIRGSEL = 1, MSIRDY = 1), since I can set the MSIRANGE value from 0x06 to 0x07.
"Basically works" means I can watch the RCC->CR values change in the debugger when MSIRANGE=7, but MSIRANGE remains at 6 (default) for higher values.
Section 3.3.3 of the RM states I need increase the Flash latency in respect to the core clock frequency (and supply voltage).
But even if I set the maximum of 4 waitstates, I cannot set any MSIRANGE value greater than 7 in RCC->CR.
Of course I checked the Flash->ACR, and I can see the updated WS value written to the register.
Not sure what I am missing here...
