This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

UART irq usage

Hi All

Probably a simple question but I am having a problem with uart irq implementation.

The platform is a TMS5501.
I am implementing a transmit interrupt (don't need receive at present).

Using the CSL routines as follows:

interrupt void tx_irq(void)
{

 IRQ_clear(IRQ_EVT_UART);
 if(tx_in_ptr != tx_out_ptr)
 {
  UART_RSET(URTHR, tx_buffer[tx_out_ptr++]);
  
  if(tx_out_ptr >= TX_BUF_SIZE)
  {
   tx_out_ptr =0;
  }
 }
 else
 {
  IRQ_disable(IRQ_EVT_UART);
 }
}


void uart_setup(void)
{

 memset((void *)tx_buffer, 0, TX_BUF_SIZE);
 tx_in_ptr=0;
 tx_out_ptr=0;
 UART_setup(&Params);
 
 IRQ_plug(UART_TINT,&tx_irq);
 IRQ_enable(UART_TINT);
 IRQ_clear(IRQ_EVT_UART);
 IRQ_globalEnable();
}

void serial_putc(char c)
{
  tx_buffer[tx_in_ptr++] = c;
  if(tx_in_ptr >= TX_BUF_SIZE)
  {
   tx_in_ptr =0;
  }
  IRQ_enable(IRQ_EVT_UART);
}

void serial_puts(char *s)
{
 Uint8 i;
 
 Uint8 l = strlen(s);
 
 for (i=0; i<l; i++)
 {
  tx_buffer[tx_in_ptr++] = s[i];
    
  if(tx_in_ptr >= TX_BUF_SIZE)
  {
   tx_in_ptr =0;
  }
 }
 
 IRQ_enable(IRQ_EVT_UART);
}

Got a little confused between using the UART_* functions and the IRQ_* functions.

No difinitive examples out there, so used those above.

Code works ok for a few chars then stops generating tx interrupts.

Am running code through a XD5510 JTAG emulator, could this be an issue?

More likely, a coding error in the above.

TIA

B