cancel
Showing results for 
Search instead for 
Did you mean: 

USART DMA interrupt with USART interrupt at the same time

Erkan Ersoy
Associate II
Posted on February 15, 2017 at 11:48

Hello;

I am trying to add timeout to my USART reception.

I am using USART1 interrupt to start a timer (a sofware timer using system timer). disable interrupt and after time out i should get the data (data packet is short enough to finish before timeout). But USARt interrupt triggers after DMA interrupt. (I internsinally set it short to trigger an interrupt). And the data from USART1->DR is the first data received. So interupt is hold down while whole DMA process and after it is triggered. ANd the USART1->DR is holding first data and never get updated 

void USART1_IRQHandler(void) {

unsigned char ch;

if(USART_GetITStatus(USART1,USART_IT_RXNE)){

USART_ClearITPendingBit(USART1,USART_IT_RXNE);

ch = USART_ReceiveData(USART1);

deneme[i] = ch;

i++;

printf('a\n');

//Start timer

//disable interrupt

//printf('header:%x\n',ch);

//printf('patlican\n');

dataTime = msTicks;

isReceiving = 1;

USART_ITConfig(USART1,USART_IT_RXNE,DISABLE);

}

I couldn't find a document defining that behaviour.

Thank you

#dma #dma-interrupt #usart-interrupt #locking
0 REPLIES 0