2013-09-05 07:06 AM
Attached is the pic showing the ustart1 registers. I do not see why i get usart1 irq, but it is ... What am I missing? My isr is stuck because something needs to be cleared.
void serial_port::isr_x() { if (USART_GetITStatus(m_usart, USART_IT_RXNE) != RESET) { uint8_t b= USART_ReceiveData(m_usart); // . . . } if(USART_GetITStatus(m_usart, USART_IT_TXE) != RESET) { if (have data ...) USART_SendData(m_usart, outByte); else // Disable the USART Transmit interrupt disableTxInterrupt(); } }2013-09-05 07:59 AM
Consider if the debugger is interfering with the peripheral, ie reading USART1->DR changes USART1->SR.
Don't park a debugger watch over the peripheral if you want to know what's going on inside. Add your own instrumentation, and understand the side-effects. Consider using the SWV channel. Interrupts can also be cleared explicitly USART_ClearITPendingBit(USART1, USART_IT_RXNE); /* Clear the USART RXNE interrupt */