2024-04-17 09:46 AM
I am having issues using sprintf in an application on a STM32H743 using Azure RTOS. The function works correctly the first time it is used to convert a float to a string but after the first use, it inserts garbage characters where the decimal point should be while the digits are as expected. The garbage characters continue to show up on subsequent calls to the routine where the sprintf is used and show up in other routines that use sprintf. The garbage characters are always the same and only appear for float values that have digits to the right of the decimal point. An example is when printing the conversion for the internal battery measurement which comes out as ...MCU Bat : 3.15 V on the first pass, then comes out as ...MCU Bat : 3"KOq@=xZ15 V on the second pass. It is repeatable. The format string is ...MCU Bat : %.2f V\r. Changing the format string does not seem to effect the result.
I have gone over numerous posts regarding sprintf and RTOS but none seems to match with what I have implimented and what I am seeing. There are no hard faults or crashing.
Version info:
STM32CubeIDE - Version: 1.14.1 - Build: 20064_20240111_1413 (UTC)
STM32CubeMX - STM32 Device Configuration Tool - Version: 6.10.0-RC9 - Build: 20231120-2037 (UTC)
Linux LMint 21
Solved! Go to Solution.
2024-04-20 06:02 AM - edited 2024-04-20 06:06 AM
A good debugger is much more important than editor and builder. You can easily find a free editor; good debugger is priceless.