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.

TMS320F28386S: Uart Interrupt

Part Number: TMS320F28386S

i configure the uart as folow:

Gpio_CMUartInit ( );
SCI_performSoftwareReset ( SCIA_BASE );
SCI_setConfig ( SCIA_BASE, DEVICE_LSPCLK_FREQ, 57600, (SCI_CONFIG_WLEN_8 |
SCI_CONFIG_STOP_ONE |
SCI_CONFIG_PAR_NONE ) );
SCI_resetChannels ( SCIA_BASE );
SCI_enableFIFO ( SCIA_BASE );
SCI_enableModule ( SCIA_BASE );
SCI_enableInterrupt ( SCIA_BASE, SCI_INT_TXFF );
SCI_disableInterrupt ( SCIA_BASE, SCI_INT_RXERR );
SCI_setFIFOInterruptLevel ( SCIA_BASE, SCI_FIFO_TX0, SCI_FIFO_RX1 );
//SCI_performSoftwareReset ( SCIA_BASE );
Interrupt_register ( INT_SCIA_TX, Uart_TxInterrupt );
SCI_clearInterruptStatus ( SCIA_BASE, SCI_INT_TXFF );
Interrupt_clearACKGroup ( INTERRUPT_ACK_GROUP9 );

/***********************************************************************
* Function Name: Uart_TxInterrupt *
* Description : *
***********************************************************************/
__interrupt void Uart_TxInterrupt( void ){
if( Uart.Length >= 16 ){
Uart.Length -= 16 ;
Uart.Index += 16 ;
}
else Uart.Length = 0;

if( Uart.Length ){
SCI_writeCharArray( SCIA_BASE, &Uart.pData[Uart.Index], (Uart.Length >= 16) ? 16 : Uart.Length );
}
else{
PailotCamPosCom_TxFinish( );
Interrupt_disable ( INT_SCIA_TX );
}

SCI_clearInterruptStatus ( SCIA_BASE, SCI_INT_TXFF );
Interrupt_clearACKGroup ( INTERRUPT_ACK_GROUP9 );
}

/***********************************************************************
* Function Name: Uart_CMGetChar *
* Description : *
***********************************************************************/
Result_e Uart_SendArray( U16 Length, U8 *pData ){
if( Uart.Length )return( RES_IN_PROGRESS );

Uart.Index = 0 ;
Uart.Length = Length ;
Uart.pData = pData ;

SCI_writeCharArray( SCIA_BASE, &Uart.pData[Uart.Index], (Uart.Length >= 16) ? 16 : Uart.Length );

Interrupt_enable ( INT_SCIA_TX );
SCI_clearInterruptStatus ( SCIA_BASE, SCI_INT_TXFF );
Interrupt_clearACKGroup ( INTERRUPT_ACK_GROUP9 );

return( RES_SUCCESS );
}

When call to Uart_SendArray i get imidatly interrupt even the fifo is full

What im doing wrong?

  • Hi,

    You currently have the TX interrupt set to SCI_FIFO_TX0. This will trigger when the FIFO level == 0 on transmit. This is likely why you are seeing this (TX ISR triggering once the data is sent).

    Regards,

    Vince

  • Hi,

    i get interrupt immediately after  : 

    SCI_writeCharArray( SCIA_BASE, &Uart.pData[Uart.Index], (Uart.Length >= 16) ? 16 : Uart.Length );

    when the fifo length is more then 10 bytes. i know it because it stack on :

    while( SCI_getTxFIFOStatus(base) == SCI_FIFO_TX_15 )

    {

    }

    inside SCI_writeCharArray( SCIA_BASE, &Uart.pData[Uart.Index], (Uart.Length >= 16) ? 16 : Uart.Length ); in the interrupt

  • Hi,

    I may not be understanding your question then, so please correct my understanding below:

    * You have set the TX FIFO level to trigger when empty (SCI_FIFO_TX0).

    * When you send a byte, the FIFO goes up to TX1, then back down to TX0 when the byte finishes transmitting

    * This triggers a TX interrupt.

    All of the above are expected. If you don't want TX to trigger when it empties out, you can change the SCI_FIFO_TX# to any other number (16 for example).

    Let me know if I'm misunderstanding.

    Regards,

    Vince

  • Hi,

    i get an interrupt FIFO empty while the FIFO is more then one byte 

  • Hi,

    Can you provide the error status registers when this happens?

    Regards,

    Vince