Hi everybody,
Could you please help me: i need to use an uart interrupt routine in a RTX code. I've already found some examples for the uart interrupt routine, but i cannot make it work using tasks. Has anybody an example to show me how to use it. Thanks
But the problem with having the read task polling for the rest of the characters, is that the read task must have a high enough prio to poll the UART so you don't miss characters. But if the task busy-loops while polling, then it would starve lower-prio tasks.
A better way is to have a state machine, where read task consumes the number of characters that are available and then wait for more data and continue. So instead of polling by checking the UART directly, you poll by calling the RTOS wait function.
Polling by using a timer would also be "wrong", since that would still give a poll frequency that must be done faster than the maximum character receive speed but without guaranteeing that there is a character available on next poll. Keeping the interrupts enabled and using the RTOS wait function means the task only gets enabled after a timeout (if specified) or when there are one (or more) character available.
Hi everybody, i left this thread for a couple of days and i'm very pleased. I've learnd a lot of thing reading your posts. But i still have a problem with my code. I cannot receive anything from the Uart. I wrote a very simple code: i want to receive a character sended from Hyperterminal (it works, i'v already tested it), read it and managed it in a specific task which print it on the LCD. I'm using an STM32F103ZE. I've looked at many example and i'm quite sure that the code is right and i make some mistakes in the settings, i've putted a flag inside the UART interrupt handler but it is never set to 1. What should i check?