cancel
Showing results for 
Search instead for 
Did you mean: 

printf() not working

EthanMankins
Associate III

I have used this method many times on this board (Nucleo-H743ZI) to transmit printf() to usart3 using the following:

 

int __io_putchar(int ch) {
      /* e.g. write a character to the USART3 and Loop until the end of transmission */
      HAL_UART_Transmit(&huart3, (uint8_t*) &ch, 1, 0xFFFF);
      return ch;
}

[...]
printf("hello world\n")

 

However, it has now stopped working in my project. HAL_UART_Transmit() still works fine but printf never seems to call __ioputchar.

This same thing is working on my project with the STM32H7B3I-DK, using usart1.

Any Ideas what could've happened?

2 REPLIES 2

Review with a debugger?

Disassemble, check the library linkage, and understand where in the path from printf() to __ioputchar() it is failing.

syscalls.c ?  _write() ?

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

it looks like it goes from printf down into __sfputc_r wich looks like it is doing what __io_putchar should be doing...

__io_putchar does not appear in my disassembly, not sure why