Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[Bug] Paste sometimes misses characters on STM32 #7

Open
cosmikwolf opened this issue Dec 1, 2021 · 4 comments
Open

[Bug] Paste sometimes misses characters on STM32 #7

cosmikwolf opened this issue Dec 1, 2021 · 4 comments

Comments

@cosmikwolf
Copy link

I have non blocking reads and writes set up over UART using HAL_UART_Transmit_IT and HAL_UART_Receive_IT, and when I paste into the terminal, it sometimes misses characters.

I have adjusted buffer sizes, and various UART settings to no avail.

Would be happy to gather some data to help troubleshoot this issue, but I am not entirely sure where to start.

@cosmikwolf
Copy link
Author

I have also attempted to adjust my terminal settings to add up to a 50ms delay between characters, and it helps, but it will still miss characters maybe 1 / 10 times

@cosmikwolf
Copy link
Author

awesome library btw :D I like it alot! I will be trying to implement a command history, so I will do a pull request if I can get it to work!

@cosmikwolf
Copy link
Author

cosmikwolf commented Dec 1, 2021

Ok, I found the cause was that there was something else that was blocking in the main loop where ush_service is running.
This may indicate that the ush_service() would run best in an interrupt context on a single threaded MCU

@marcinbor85
Copy link
Owner

marcinbor85 commented Dec 1, 2021

Yes, library is not thread-safe, so be careful in multi-thread environment.
And calling ush_service from interrupt context is a very bad idea...

Regarding the missing characters, please make sure that in the read/write interfaces You will return 0 in case of not successful write (e.g. buffer overflow) and 1 in case of success (see examples). If You return 0 library will take to write/read attempt on the next service loop.

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

No branches or pull requests

2 participants