The Nodate printf routines do not appear to work correctly when printing floating point values with a NUCLEO-F103RB board. The resulting values frequently appear as "0.000". This behavior seems to be limited to STM32F1 - correct operation is seen with F0, F4, and F7 series. The following is the test code used:
// printf STM32F1 test for Nodate's STM32 framework.
include <usart.h>
#include <io.h>
#include "printf.h"
void uartCallback(char ch) {
// Copy character into send buffer.
USART::sendUart(USART_2, ch);
}
int main () {
SystemCoreClockUpdate();
// nucleo-f103rb
USART::startUart(USART_2, GPIO_PORT_A, 2, 0, GPIO_PORT_A, 3, 0, 9600, uartCallback);
// Set up stdout.
// nucleo-f103rb
IO::setStdOutTarget(USART_2);
USART_devices my_usart = USART_2;
volatile int t1 = 4;
printf("Int test: %i.\n", t1);
printf("Int to Float test: %f.\n", t1);
volatile float t = 4.23;
printf("Float test: %f.\n", t);
while(1) {
//
}
return 0;
}
The Nodate printf routines do not appear to work correctly when printing floating point values with a NUCLEO-F103RB board. The resulting values frequently appear as "0.000". This behavior seems to be limited to STM32F1 - correct operation is seen with F0, F4, and F7 series. The following is the test code used: