Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

CH59x printf does weird stuff on strings longer than 7 chars #565

Closed
biemster opened this issue Mar 15, 2025 · 4 comments
Closed

CH59x printf does weird stuff on strings longer than 7 chars #565

biemster opened this issue Mar 15, 2025 · 4 comments

Comments

@biemster
Copy link
Contributor

Apparently I did not test this well enough, this needs fixing. Just putcharring with a delay works, so probably printf does it too quick?

@TommyMurphyTM1234
Copy link
Contributor

TommyMurphyTM1234 commented Mar 15, 2025

Perhaps it needs some sort of "ready for transmit" handshake/checking like the non-CH59x case?

  • ch32fun/ch32fun/ch32fun.c

    Lines 1319 to 1329 in f1b8b67

    // single char to UART
    WEAK int putchar(int c)
    {
    #if defined(CH59x)
    R8_UART1_THR = c;
    #else
    while( !(USART1->STATR & USART_FLAG_TC));
    USART1->DATAR = (const char)c;
    #endif
    return 1;
    }

@biemster
Copy link
Contributor Author

Perhaps it needs some sort of "ready for transmit" handshake/checking like the non-CH59x case?

that is very possible, I just copied this from the EVT. Very possible that I missed something like this, thanks!

@cnlohr
Copy link
Owner

cnlohr commented Mar 17, 2025

Image

biemster added a commit to biemster/ch32fun that referenced this issue Mar 17, 2025
cnlohr added a commit that referenced this issue Mar 17, 2025
CH59x fix UART long printf issue #565
@biemster
Copy link
Contributor Author

this was fixed in #570 (i thought that gh would close this automatically after merge)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants