cancel
Showing results for 
Search instead for 
Did you mean: 

[STM32WL55] CTime locks Flash

LorenzoC
Associate

Hello everyone,

I'm having some issue with the ctime function time() in <time.h>.

This is used in a library we imported (and for various reason we CANNOT change it), but I noticed that when time() is called it returns -1 (which could be fine) but also sets the FLASH register SR->CFGBSY to 1.

The register is never cleared, and when our code tries to lock the flash (HAL_FLASH_Lock()) it will Hard Fault, since we cannot change FLASH->SR register with CFGBSY set.

I don't understand what could be.

I know the memory requires 64bit to write, and CFGBSY is set when first word is sent on bus, which makes me think the issue might be that some word is missing to write. I don't understand though, why would the time function interfere with the FLASH.

Can anyone help me out here?

Thank you!

1 REPLY 1
Amel NASRI
ST Employee

Hi @LorenzoC ,

Sorry to come back late to your question. I hope that you found already the explanation for the faced issue and succeeded to fix it. That would be interesting to share your findings in such case.

If not, as I don't have enough means to understand the full context and check the code, I suggest you have a look to the product errata sheet. It is possible that you are facing one of the know limitations. I'm thinking mainly about "2.2.10 SysTick trigger in debug emulation generates HardFault".

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.