can you help me? I'm a new one. How to use this ''xprintf''? I have connected my uart2, but it's no use. Should I choose the MicroLib in keil? Or rewrite the _wrtie() and _read()? I didn't use the semihostings(use #program to removed the semihostings mode), Thank you.

P.s. My ide is keil5, and use the stm32f429 to do it. And I downloaded xprintf.c/.h from https://github.com/tmk/elm-chan_xprintf/blob/master/xprintf.c

  • \$\begingroup\$ I have no ideas to solve this problem, please provide some helps or informations, thanks all. \$\endgroup\$ – Kenneth Dec 13 '16 at 12:24

Register the functions that send\receive one character to UART.

Read the last paragraph here. Download the Examples and take a look at the stm32 folder. http://elm-chan.org/fsw/strf/xprintf.html

Here's what I did using the HAL drivers and STM32Cube generated project.


void uart_putc(char c){
  HAL_UART_Transmit(&huart2, (uint8_t*)&c, 1, 0xFFFF);
void uart_getc(char c){
  HAL_UART_Receive(&huart2, (uint8_t*)&c, 1, 0xFFFF);
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.