This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Data sent through UART of MSP430F5508 gets corrupted after 128 bytes are sent at 9600 baud. How can it be rectified?

Prodigy 200 points

Replies: 23

Views: 2186

I am programming a MSP430F5508 chip and using it for Timer interrupts and then finally sending the processed data in an Array of 130 bytes through the UART.

The first 128 bytes are acccurately transmitted but the two bytes after are corrupted. They can be read properly in IAR when I debug the chip through it. However the transmission is failing. Is it an overrun error? What is it? How to rectify it?

23 Replies

  • Hardik,

    Is it constantly the 129th and 130th byte? Maybe an index is rolling over and pointing somewhere it shouldn't? Maybe a char as index? Please show your code for that.

    Dennis


  • In reply to Dennis Eichmann:

    - Yea, it is constantly the 129th and 130th Byte. I tried to rearrange the data as well. Still it was just the 129th and 130th Data byte that was corrupted. However I cannot share the code, it is a part of a Tradesecret. Anything else I should be looking for? Can it be an overrun error?
  • In reply to Hardik Katyarmal:

    Yes, possible. Think of a signed char which values range from -128 to 127. So if you are using an array with 130 elements, this array will be array[0] to array[129]. If your upcounting index variable now is a signed char, it can index array[127], which is the 128th byte of your array, but then it rolls over to -128, which will point to ????


  • In reply to Dennis Eichmann:

    ... Hi thanks for the support!

    I solved this problem. It was a char, I had allotted just two bytes to store the size of the data - which after 128 overflows and gives data size = 00 or 01 or 02

    However now I am facing another problem. I further increased that index. Now the UART transmission throws some 2 extra bytes of garbage data after all data I have allotted to the UART Buffer.

    What can this be because of ?

  • In reply to Hardik Katyarmal:

    Well, this is hard to say without having a look at the source code. If two more bytes are sent, then something seems to count wrong.


  • In reply to Dennis Eichmann:

    The while loop I use counts only 128 times to assign values to the buffer very clearly.
    The other data is not even found in any of the memory locations
  • In reply to Hardik Katyarmal:

    Hardik,

    I really would like to help you, but there could be a lot of error sources. No chance of posting at least that part of code that handles the UART transfer?

    Dennis


  • In reply to Dennis Eichmann:

    <Code>

  • In reply to Hardik Katyarmal:

    What datatype is i and dataXmitLength?


  • In reply to Dennis Eichmann:

    i is an int
    dataXmitLength is a short

This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.