Skip to main content
Visitor II
April 13, 2022
Question

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

  • April 13, 2022
  • 1 reply
  • 1376 views

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.

    This topic has been closed for replies.

    1 reply

    Technical Moderator
    April 14, 2022

    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