2013-06-07 12:16 AM
hoping someone knows the answer to this...
when I send a character on usart2, SR->IDLE flag is set for no reason, RXNE = 0 but I can see the data in the DR. what weirds me out is IDLEIE is 0. so far I simple can't get RXNE to set at all.this is on the stm32f107vc #usart-interrupt #usart-idle2013-06-07 04:51 AM
How exactly are you looking at this? If from a debugger be aware that it will read the DR clearing bits in SR, ie it has no magic way of looking in this register without changing the state.
It might be helpful to show the code you're having a problem with, ideally a self contained example.2013-06-07 06:58 AM
IDLEIE is used to gate an interrupt request when IDLE is asserted. It doesn't disable the IDLE flag in SR. What you are seeing is normal. IDLE is set when RX sees an idle condition, no data arriving. Reading DR when RXNE = 0 returns invalid data.
Jack Peacock2013-06-07 08:29 AM
Thanks, if that's the case how do you test irq handler?
My code follows these:void uart_handler(){ if(USART2->SR & USART_SR_RXNE) { data = USART2->DR; //do something }}but putting a breakpoint at the if statement will read and clear the RXNE?should i put the breakpoint after the DR read then?2013-06-07 09:41 AM
I was thinking of debugger based peripheral viewers.
I'd put the break-point on the data read. If you are not getting received data you'll need to check your clocks and baud rates, and how the data is delivered to the pin.