TMS320F28379D: Issue Converting Float to String for SCI (UART) Transmission on C2000

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

Hi TI Team,

I am working with a C2000 device ([TMS320F28379D]) and using the SCI (UART) peripheral for serial communication.

Initially, I verified that SCI transmission is working correctly by sending normal strings. I was also able to convert integer values to strings and transmit them successfully.

After that, I tried to transmit floating-point values by first converting them into strings using sprintf and then sending them over SCI.

image.png

 

However, when I did this, I started observing abnormal system behavior. To isolate the issue, I then tried a simpler test by just printing the float using printf:

image.png

 

But even this did not work correctly. The output is empty, whereas the same is working fine for integer values.

From this, it seems:

  • SCI (UART) itself is working fine (verified with strings and integers)
  • The issue starts specifically when handling float values
  • Even basic float printing using printf is not working
  • Additionally, using sprintf with "%f" seems to affect system behavior

I also checked in Code Composer Studio for any option to enable float support (such as printf-related settings), but I could not find any such option.

Could you please help with:

  1. Whether float support is available in C2000?
  2. Why using sprintf with "%f" could lead to abnormal system behavior?
  3. How to correctly enable or handle float-to-string conversion in this case?
  4. Recommended method to safely transmit float values over SCI?

Thanks in advance for your support.

  • Hi Deepan,

    Yes, float support is available on C2000. To convert a float to a string, you can use the snprintf() function as you are doing. 

    To clarify, the printf() and sprintf() functions are from the standard IO library. printf() uses the stdout, which prints the string to the CCS console via the JTAG interface on the device. The SCI peripheral (UART protocol) sends messages through a separate physical connection that converts the UART protocol to USB to display to the serial terminal in CCS. These are different windows in CCS. Which are you trying to do?

    For the printf() / sprintf() functions, we have a tutorial here

    For the SCI peripheral, we have examples in the C2000ware SDK you can take a look at. Path: [C2000ware install]/driverlib/f2837xd/examples/cpu1/sci/. I would recommend trying sci_ex3_echoback. 

    Another note for this device, if using the LaunchPAD, make sure you have the _LAUNCHXL_F28379D predefined symbol defined in your project to configure the clocks properly. 

    Best Regards,

    Delaney

  • Hi,

    I am using printf to print a float value in the CCS console, and I have included the stdio.h library. The project also utilizes the UART protocol for data transmission. The SCI peripherals code is adapted from the examples in the C2000ware SDK.I have verified that the predefined symbol is correctly defined in the project; however, the issue still persists.

    Could you kindly suggest a solution or provide guidance on why printf and snprintf might not be displaying and transmitting float values correctly over UART?

    Thanks in advance for your support.

  • Hi Deepan,

    Can you show the console output you get? As I mentioned before, the printf() does not use the SCI module on the chip. It uses JTAG to print through the debugger interface.  

    Can you check your compiler setting for the --printf_support flag? This should be set to --printf_support=full to send floats. See documentation here.

    Best Regards,

    Delaney

  • Hi,

    Yes, I have already checked my compiler settings and confirmed that the --printf_support flag is set to full.


    However, I am still facing an issue where float values are not being printed in the console output. Even when I try printing a simple float value using printf, nothing appears in the console (screenshots attached).

    I am also experiencing a related issue when attempting to transmit float values as strings over UART (using snprintf). I have attached screenshots of the console output for both issues in my previous message.

    Could you kindly suggest what else I should check or try to resolve this issue?

    Thank you in advance for your support.

  • Hi Deepan,

    Apologies for the delay. A couple other things to try:

    • Can you check your map file to see which library is being used for the printf calls?
    • Can you try building your project with no optimization? High optimization levels may remove or inline the printf calls.

    Best Regards,

    Delaney 

  • Hi,

    Apologies for the delayed response.

    The library currently being used for the printf calls is rts2800_fpu32_eabi.lib. And I also attempted to build the project with optimization disabled, but the issue persists—float values are still not being printed correctly.


    Could you please suggest what I can try next to resolve this issue?

    Thank you in advance for your support.

  • Hi Deepan,

    Let me get back to you on this next week.

    Best Regards,

    Delaney

  • Hi Deepan,

    Just to update, I still haven't had a chance to look into this more for you. I am aiming to have a response early next week. Apologies for the delay.

    Best regards,

    Delaney

  • Hi Deepan,

    Just to update, I still haven't had time to look into this but will update when I do.

    Best Regards,

    Delaney

  • Hi TI Team,

    Thank you for the update. We understand there has been limited time to look into this; however, we would appreciate any opportunity to progress this further as we are awaiting a solution. Looking forward to your update.

    Thank you in advance for your support.

    Regards, 
    Deepan V.

  • Hi Deepan,

    Understood, I will try to find time to look into this tomorrow. Thank you for your patience.

    Best Regards,

    Delaney