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.

TMS320F280039C: Float Data transfer over UART using C2000

Part Number: TMS320F280039C

Hi community, 

I am currently facing an issue for transfer of float data over UART.

I tried to convert float to string using sprintf. But my code Hangs there.

Do you have any good way of transferring float data over UART. I am using C2000 MCUs.

 

Thanks 

  • Hi Faraz,

    UART protocol by nature only sends 8-bits of data at a time. To send a 32-bit float, you would usually break up the 32-bit value into 4 UART transactions. Are you just trying to visualize the float value in the COM port? In this case yes, you can convert it to a series of ASCII characters to send. Can you take a look at the below page for an example of this:

    Convert a floating point number to string in C - GeeksforGeeks

    For the F28003x SCI(UART) module, you can use this example code. Once the res array has been generated, you can call the SCI_writeCharArray() function and pass it in with its length. Let me know if this answers your question.

    Best Regards,

    Delaney

  • Hi Delaney,

    Thanks for providing guidance in the issue. I will implement the suggestion given by you. But I also need to check how much bandwidth is getting consumed using this approach. 

    Thank You.