FCLK, stop mode 2 and processing time STM32L476 nucleo
Hello,
I am testing the processing time of a STM32L476 chip on a Nucleo board.
Here below is the code:
uint8_t algo_principal(s16 xin, s16 yin, s16 zin)
{
uint8_t retour;
uint32_t i;
uint32_t test;
test = (uint32_t )xin + (uint32_t )yin + (uint32_t )zin;
TESTA11_ON;
for (i=0; i < 25000; i++)
{
test *= test;
}
TESTA11_OFF;
if (test < 85695)
retour = 0;
else
retour = 1;
return (retour);
}This code is called every 20ms (external accelerometer interuption) and the microcontroler is in stop mode 2 when not busy => Function EnterStop2Mode() from the LL exemple.
To configure the clock, I use CubeMx to be sure not to badly configure the device.
I measure the time between TESTA11_OFF-TESTA11_ON.
For the 8MHz configuration:

CubeMx sets : LL_FLASH_SetLatency(LL_FLASH_LATENCY_0);

The processing time is 6.28ms
I change the configuration to 16MHz by CubeMx:

CubeMx sets : LL_FLASH_SetLatency(LL_FLASH_LATENCY_0);
The processing time is always 6.28ms.
Even if I change the clock to 80MHz (latency set to 4 this time), the processing time is always 6.28ms.
This time is always the same whatever the clock frequency used. How could it be possible?
Even with to different clock frequencies (8 and 16 MHz) and the same flash latency (0), the processing time is the same.
How could I correct that?
If I do not set the STM32L476 in stop mode 2 when CPU not busy I have:
8 MHz: processing time: 12.56ms
16 MHz: processing time 6.28ms
80 MHz: processing time 1.26ms.
At 8 or 80 MHz, why the processing time of a function which lasts many ms depends of the stop mode 2 when the CPU is not busy?
At 8 MHz, why the processing time is faster when the CPU enters the Stop Mode 2 while inactive?
Best regards
Mich