cancel
Showing results for 
Search instead for 
Did you mean: 

sprintf issue on STM32F4xx serie

kai239955
Associate II
Posted on June 26, 2012 at 12:09

Hi,

I am converting from STM32F205 to STM32F405 and have an issue with printf.

I have updated the �C Library, use FPU, and updated OpenRTOS.

Are there some settings that I need to change to make printf to work with the following:

char buffer[100];

sprintf(buffer,''%.5f'',0.12345);

I got a very large number and not 0.12345

Thanks

Kai

#stm32f4xx
1 REPLY 1
Posted on June 26, 2012 at 14:42

Presumably it would depend on the compiler, settings, and the libraries selected. Check it has the right FPU settings, as the STM32F4 only supports 32-bit floats natively.

You could try sprintf(buffer, ''%lf'', 0.12345);

You should make sure you have a big enough stack.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..