AnsweredAssumed Answered

UART in ADSP 21489

Question asked by rama on May 26, 2010
Latest reply on Jun 18, 2010 by rama

Hi,

 

we are in need of some clarification regarding UART in SHARC 21489.
Our requirement is to Transmit and receive data through UART using

UART isr.

 

1. Two buffers (Tx_buffer and Rx_buffer) of size 256 each will be in internal memory.


2. In UART isr routine, a data from Tx_buffer will be written into UART0THR register. and also the data read from UART0RBR register will be written into Rx_buffer.

These two things will be done by reading the UARTxIIR register to know whether the interrupt has occured because of "TX buffer empty" or "RX buffer full" condition

because UART has two interrupts for receive and transmit, in I/O mode, all interrupts are grouped as a single receive


Sample code

----------------


void UARTisr()

{
  

//Check if  Rx interrupt.
  

if ((*pUART0IIR&4 ) == 4)
{
  
       //codefor rx interrupt
  
}
  

//Check if  Tx interrupt.

if ((*pUART0IIR&2 ) ==2 )
{
  
      //codefor tx interrupt
   
}


}

 

Is the method used above is correct?

 

3. Whether the UART interrupt will be generated periodically. If so based on what duration.Is there any condition based on which the tx and rx interupt will be generated.


As per our requirement, a data will be written to UART0THR register (transmit) only when a data is available in Tx_buffer (Internal buffer) .There is a

possiblility of skipping the writing to UART0THR register eventhough the UART Transmit interrupt comes.

 

4 When will these (transmit and receive) interrupts will be cleared.Whether the user has to force to clear or any conditions has to be checked.

Please refer attached

example code which consists of the UART_Init and UART_isr routine.

 

Could you please help us in this regard.

 

Regards,

Ramamoorthy M

Attachments

Outcomes