-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
Is it suitable for delay in usart transmit ? #4
Comments
I dont underestand your problem :( |
Sorry for my bad English :( I think it's wrong for putting such a huge delay in USART transmission, It's OK for lower baudrate. What I mean is a 1s delay is too long for higher baudrate device, and if we use RTOS, USART transmission task may be suspend. |
why do you want to use delay? |
I mean your code in void atc_transmit(atc_t *atc, uint8_t *data, uint16_t len)
{
for (uint16_t i = 0; i < len; i++)
{
while (!LL_USART_IsActiveFlag_TXE(atc->usart))
atc_delay(1); ///< here
LL_USART_TransmitData8(atc->usart, data[i]);
}
while (!LL_USART_IsActiveFlag_TC(atc->usart))
atc_delay(1); ///< here
} |
Oh. I see. I can not remember. But i had a problem with freertos and solved via delay. |
atc/atc.c
Line 74 in 3d673c5
If the serial open with 115200 8N1, it will transmit a bit in
1/115200 = 0.000086805555555555555555555555555556 s
one frame take
11 * 1 / 115200 = 0.00095486111111111111111111 s
1 second is just enough.
But if we open the serial with higher baudrate, an one second delay may trigger a IDLE interrupt (if the receiver is a STM32).
And if we use RTOS, maybe some other high priority task will take the control and delay the transmit task.
Or maybe i am wrong (Im a still a noob in embedded development)
The text was updated successfully, but these errors were encountered: