cancel
Showing results for 
Search instead for 
Did you mean: 

unexpected ustart1 isr

denis
Associate II
Posted on September 05, 2013 at 16:06

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();

    }

}

1 REPLY 1
Posted on September 05, 2013 at 16:59

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 */
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..