cancel
Showing results for 
Search instead for 
Did you mean: 

USART3 Interrupt not being fired

tonyblake9
Associate II
Posted on May 24, 2017 at 14:37

Hey guys,

I'm using a serial terminal to communicate with USART3 on an STM32F1 via an FTDI USB-UART converter cable. I am successfully receiving data from USART3 in my serial terminal but when I try to send data to it the RX interrupt I have configured is not being fired. Here is my code:

void USART3_IRQHandler(void)

{

   if(USART_GetITStatus(USART3, USART_IT_RXNE) != RESET){

      // Read one byte from data register

      RxBuffer[RxCounter++] = USART_ReceiveData(USART3);

      if(RxCounter == 15){

         // Disable interrupt

         USART_ITConfig(USART3, USART_IT_RXNE, DISABLE);

      }

   }

}

, where RxBuffer is a u8 array[16] and RxCounter is u8 initially set to zero. I have configured USART3 like so:

USART_ITConfig(USART3, USART_IT_RXNE, ENABLE);

I'm using RealTerm as my serial terminal and can see that the TXD status light goes yellow when I type in some characters and click 'Send ASCII', i.e. the transmission is good. I've also checked the RXNE flag and it is not being set.

Can anyone help me with this? Have I left out some code?

Cheers,

Tony

#usart3 #stm32f1 #no-interrupt
2 REPLIES 2
Posted on May 24, 2017 at 15:53

>>Can anyone help me with this? Have I left out some code?

I only see one subroutine outside any context, so arguably yes.

Make sure you enable the interrupt in the NVIC.

If using C++ option or .cpp file extension, then use the extern 'C' void USART3_IRQHandler(void) form

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on May 25, 2017 at 11:14

Hi Clive,

Sorry I do have the interrupt enabled in the NVIC like so:

NVIC_InitStructure.NVIC_IRQChannel = USART3_IRQChannel;

NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority=0;

NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;

NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

NVIC_Init(&NVIC_InitStructure);

Is this ok?

Tony