2018-12-15 07:00 PM
Hi everyone!
I had a problem with timer interrupt. When i use 2 if statements in timer interrupt it't only do one of them. My if statements are in different condition.
Here brief of my code
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
if (htim->Instance==htim4.Instance)
{
if (first == TRUE)
CDC_Transmit_FS (data 1);
if (second == TRUE)
CDC_Transmit_FS (data 2);
if (third == TRUE)
CDC_Transmit_FS (data 3);
}
}
But when both first and second are TRUE. It't only transmit the first. If i set first = FALSE and it will transmit the second. It's the same for the third. Why this is happen. Many thanks to those who help me. P/S: My English not very good. Sorry for that.
UPDATE: I found out the answer from https://community.st.com/s/question/0D50X00009XkeSZSAZ/way-to-be-notified-on-cdc-transmit-complete
"Pavel A.
Sending takes time.
USBD_CDC_TransmitPacket() only queues the data for sending and returns immediately. Until the data has been sent, TxState flag is set, so your second call to CDC_Transmit_FS() returns USBD_BUSY and the 2nd data is not sent."