cancel
Showing results for 
Search instead for 
Did you mean: 

Getting damaged data with using STM32F4 and barometer MS5611 on serial screen

marsupilami
Associate II

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:

0693W00000LxtgxQAB.png 

I used this code for getting data from UART:

0693W00000LxthWQAR.png 

I also refer this example code from Github: https://github.com/infinity1096/STM32_MS5611

Thanks.

1 REPLY 1
Peter BENSCH
ST Employee

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

In order 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.