I have been fighting with sprintf outputting floats. I need to be able to print formatted floating point data. I created a gatekeeper task for the serial port and put sprintf under that task. sprintf can only run within the gatekeeper task.
As a test case I modified the sprintf statement to
sprintf( OutString, "% 06.2f", 23.456 );
and I get " 00.00" in OutString. Any float value returns a zero. Modifying for integers works fine.
I have researched this problem and found the two most common comments are stack size and reentrancy. I have made sure that the stack for the task is large enough, 1500 words are unused on the stack according to the high water mark routines. To test for reentrancy issues, I ensured that the gatekeeper is the highest priority, and even have gone as far as putting sprintf within a critical area and turned off interrupts. Nothing has worked.
This same sprintf line works fine before I start the scheduler, so it is not a library issue.