Skip to main content
papageno
Associate III
Mar 15, 2021 7:56 PM UTC
Solved

float correctly displayed in debug but not in release.

Dear experts,

i try to use the float library with printf or vsnprintf. The option nano has been checked, the -u _printf_float too. The latest version of STM32cubeIDE, the proc is STM32F446RE. The value of floats are correctly displayed in debug but in release, it displays a wrong value. The value are mean and median computed values. I suppose there is a problem with a library in release. I really thank you for your help.

Regards,

pap

This topic has been closed for replies.
papageno
papagenoBest answer
Associate III
Mar 16, 2021 1:10 PM UTC

Erratum: My apologies, the float lib in nano is ok. After searching a little, i found that the problem I had was incorrect data from upstream capture using IT and ISR: the data processed was corrupted in release configuration but all was ok in debug. The reason: I was calling the HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_1 ) function from ISR. Replacing this call by htim->Instance->CCR1 inside the ISR solved my problem and data in the array is now correct and the mean and median functions can process correct data and give correct float results. I let the solution of my problem which was not a real problem on the forum, maybe it can help somebody else.

Sorry for the inconvenience.

2 replies

papageno
papagenoAuthorBest answer
Associate III
Mar 16, 2021 1:10 PM UTC

Erratum: My apologies, the float lib in nano is ok. After searching a little, i found that the problem I had was incorrect data from upstream capture using IT and ISR: the data processed was corrupted in release configuration but all was ok in debug. The reason: I was calling the HAL_TIM_ReadCapturedValue(htim, TIM_CHANNEL_1 ) function from ISR. Replacing this call by htim->Instance->CCR1 inside the ISR solved my problem and data in the array is now correct and the mean and median functions can process correct data and give correct float results. I let the solution of my problem which was not a real problem on the forum, maybe it can help somebody else.

Sorry for the inconvenience.

ST Technical Moderator
Mar 17, 2021 7:41 PM UTC

Hi @papageno​ ,

Glad to know that your issue is solved :smiling_face_with_smiling_eyes: and thanks for sharing the solution, it should be helpful for the Community.

Imen

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks