0
\$\begingroup\$

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

\$\endgroup\$
  • \$\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
1
\$\begingroup\$

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.

xdev_out(uart_putc);
xdev_in(uart_getc);

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);
}
\$\endgroup\$

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.