Tool/software:
Hello Team,
We're trying to print float data via UART in terminal, since the existing UART drivers are not having any provision to print float.
Is there any available example or drivers for printing float with UART?
Thanks in advance
What results are you getting now?
You might check to make sure that "Build Settings->Build->Compiler->Advanced->Language Options->Level of printf" is set to "full".
Once you do what Bruce says, sprintf() should work.
Of course, there is always K&R's itoa() example.
Hi,
Thanks to Bruce and Keith on their suggestions.
MSP432E SDK has UARTPrintf to print data out of the UART port but it does NOT support float. You can use C printf but that does not go out of UART but only to the CIO and will take up a lot of heap space.
You can use usprintf which is a lighter version of sprintf to first convert the float to string and then send out the string out of UARTPrintf.
Hello Charles,
As you've mentioned, i tried both sprintf and usprintf but it code is getting stuck in a default handler from the line 136 or 137 itself.
As per Bruce's suggestion, i checked Level of printf as well and it is set to "full" only.
Hello Keith,
Yes I tried increasing the stack size from 512 to 4096 and more as well in the .cmd file, still sprintf is getting stuck in default handler.
For using usprintf, i included the ustdlib.c, ustdlib.h in the project from https://github.com/yuvadm/tiva-c/tree/master/utils
I could see error for it