AnsweredAssumed Answered

STM34F411-Nucleo USART stop TX interrupt advice

Question asked by narsutis.dainius on Feb 10, 2016
Latest reply on Feb 11, 2016 by narsutis.dainius
Hi,

I'm trying to get comms between USART1 and USART6 working. I can send from USART1 to USART6 using interrupts and it works. What I am trying to do now is control the sending interrupt, but I think I am missing something.
So the IRQ1handler just goes through a send buffer and send data, great no problem, but I cannot seem to stop it.

This is my IRQ1Handler
void USART1_IRQHandler(void)
{
  
  if (USART_GetITStatus(USART1, USART_IT_TXE) != RESET) // Transmit the string in a loop
  {
    USART_SendData(USART1, StringLoop[tx_index++]);
         
    if (tx_index >= BUFFER_SIZE)
    {
      tx_index = 0;
      USART_ITConfig(USART1,USART_IT_TXE,DISABLE); //When all data received, stop interrupt for TXE flags
    }
  }
}

and this is my main
int main(void)
{
    RCC_Configuration();
      
    GPIO_Configuration();
     
    NVIC_USART1_Configuration();
    NVIC_USART6_Configuration();
     
    USART1_Configuration();
    USART6_Configuration();
     
    while (1)
    {
        Delay(2000);
        USART_ITConfig(USART1,USART_IT_TXE,ENABLE);
    }
}

So basically I am trying to enable the transmission every 2 seconds, not continuously send it.

Any advice would be appreciated. Thanks

Outcomes