I wrote a program that enables DMA(USART receiving mode) when an EXTI interrupt has occurred. When the line(EXTI) is going to high again it disables the DMA. There is a good time space between the two EXTI interrupts that ensure me that the USART transmits all bytes. My program works fine until a powering on/off is occurred. After powering on, sometimes, DMA1_Channel3_IRQHandler occurs but the sequence of the input data is missing. I need to know why after disabling/enabling the DMA, it doesn't start from the first characters. If there are any bytes in the USART register, while the DMA is disabled, after enabling the DMA, does it count the last bytes? if yes, how can solve this problem?
void DMA1_Channel3_IRQHandler(void){ // USART3_RX // Encoder
if(Buffer[0]==65 && Buffer[20]=='
')
{
....
}
DMA_ClearITPendingBit(DMA1_IT_TC3);
USART_ITConfig(USART3,USART_IT_RXNE,DISABLE);
DMA_Cmd(DMA1_Channel3, DISABLE);
DMA_SetCurrDataCounter(DMA1_Channel3,sizeof(Buffer));
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…