cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f105 usart interrupt generated only once times.

vivek
Associate II

when program started interrupt is called but its read only one character and repeatedly read same character.most time getting garbage value.

RXNE Flag also set. my application is to handle data send by ATMEGA16 in while condition.

program:

void USART2_IRQHandler(void)

{

//Local variable

unsigned char data=0,i=0;

unsigned char TEMP[5];

if(USART_GetITStatus(USART2, USART_IT_RXNE) != RESET)

{

data = USART2->DR;

if(i<5)

{

TEMP[i]=data;

i++;

}

}

}

2 REPLIES 2

The holding buffer and index presumably need to be static variables.

Auto variables will hold junk from the stack.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
vivek
Associate II

yes now its work.but sometime i got single character