2887 views|2 replies

71

Posts

0

Resources
The OP

F7 serial port sending problem---application of printf function [Copy link]

When compiling the F7 program with MDK, I found that the printf() function that can be used after redefining the C function on F103 cannot be used in F7. I spent a whole morning to solve the problem of sending the printf() function. Finally, I solved it. Direct solution#ifdef __GUNC__ #define PUTCHAR_PROTOTYPE int __io_putchar(int ch) #else #define PUTCHAR_PROTOTYPE int fputc(int ch,FILE *f) #endif PUTCHAR_PROTOTYPE { HAL_UART_Transmit(&uart1Handel, (uint8_t*)&ch, 1, 0xffff); return ch; } Add this function in the main function and you can use printf(“\r\n ************ \r\n ”) function directly! ! !
This post is from stm32/stm8

Latest reply

I don't see how to solve it. Both require redirecting the fput function. What's the difference?  Details Published on 2015-10-16 23:37

4170

Posts

8

Resources
2
Wouldn't it be nice if you could explain the difference between the printf functions in F103 and in F7?
This post is from stm32/stm8

1977

Posts

0

Resources
3
I don't see how to solve it. Both require redirecting the fput function. What's the difference?
This post is from stm32/stm8

Guess Your Favourite
Find a datasheet?

EEWorld Datasheet Technical Support

Related articles more>>

    EEWorld
    subscription
    account

    EEWorld
    service
    account

    Automotive
    development
    circle

    Robot
    development
    community

    Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
    快速回复 返回顶部 Return list