2022-04-13 09:07 AM
Hello everyone,
I use NUCLEO STM32F446 and barometer MS5611 with I2C interface. I want to get temperature and pressure data but I am also getting damaged data from USART2. I haven't a problem about baud rate and it is 115200 Bit/s. What is the problem, have you any idea about that?
You can see here my serial screen data:
I used this code for getting data from UART:
I also refer this example code from Github: https://github.com/infinity1096/STM32_MS5611
Thanks.
2022-04-14 01:19 AM
It looks very much like the string in data has no terminating null character, which is why you get the remaining characters of the buffer from the second line on.
Please look at data byte by byte in the debugger to see if the last 0x09, 0x0D, 0x0A (or 0x09, 0x0A, 0x0D) is followed by 0x00. If this is not the case, you have to search whether sprintf is working correctly, whether you have side effects or similar.
Good luck!
Regards
/Peter