My Hardware has STM32L162VD as main processor and other modules on it like GPRS module SIM900. I noticed that when the hardware is under test after few hours the floating point numbers in RAM registers change only in '.' character to some other characters like 't' or space ' ' or '*' or '0'. I mean the numbers don't change but only the appearance of point changes. I can see the values in Graphical 128x64 LCD and also in the server computer that receives the data using GPRS TCP connection. The numbers change like following every few hours: 1.5 -> 1t5 12.54 -> 12t54 or 1.5 -> 105 12.54 ->12054 or 1.5 ->1 5 12.54 ->12 54
if I write the changed number into the EEPROM and reset the MCU then read it from EEPROM the number goes back to normal appearance. I don't know what is happening to MCU!
This could happen if you have memory corruption.
Remember that all code in the standard library is also "normal" code. So if your program causes memory corruption, then the CRTL functions may start to misbehave.
I haven't checked into Keils support for alternative locales - but if the library supports locales, then it's likely that they store the decimal separator in a variable to allow it to be changed depending on locale. Corruption of this memory byte would then make floating-point formatting produce numbers with a strange decimal separator character.
When I've seen issues like this it is always because the stack and heap crashed into each other and the stack ploughed through the locale data.
You need to check your stack sizing is adequate, the 1024 bytes normally allocated can be insufficient for scanf/printf + floating point. You should physically measure what you are using and see if that matches Keil's and your own static analysis of your code and the call trees. I'd suggest you place a marker value at the top of the heap, and see at what point that gets corrupted.
Thanks, good points for me. It seems the problem resolved by modifying stack size and some parts in code.