cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with a STM32F446 nucleo board, firmware doesn't work properly

MQuar.2
Associate

I'm currently having a problem with a STM32F446 nucleo board, I'm trying to write a Firmware that takes in data from some sensors connected to the board (velocity, ecc) and prints it every second. The code I wrote respects the specification, but the printed data is completely random and changes every time I unplug (and plug again) the board, and even if I print values that do not come from sensors (for example, if I manually set values in the array) it still prints random numbers.

Here's the code lines I use to print:

snprintf(str,sizeof(str),"x: %+.2f g \r\ny: %+.2f g \r\n z: %+.2f g \r\n\n\n",xacc[1],yacc[1],zacc[1]);

//format %+.2f used to read 2 numbers + its math sign

HAL_UART_Transmit(&huart2, str, strlen(str), 200);

Maybe I just need to initialize the board, it would be nice, if this was the case, to know how to do it.

What could be the problem? Thanks

1 REPLY 1
JTP1
Lead

Is Project > properties > c/c++ build > settings > mcu settings > use float with printf checked ? (If using cubeide)