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.

TMS320C5517: can't transmit all the " frame" data using UART

Part Number: TMS320C5517


 

I am using Uart1 for both transmitting and receiving data on c5517. And it may receive and transmit at the same time.

I use the interrupt mode. Sometimes, I can’t transmit all the data(the interrupt did not come?)

There is only one uart isr on 5517. In the Isr routine,gennerally IIR register is used to tell  which interrupt comes. But in IIR, INTID bits only indicates one interrupt source. What if two interrupts come?

I use LSR state register to do some additional handle.But the problem still exits. I still can’t transmit all the frame data. Why?

 

void uartISR(){

    //interrupt for UART(INT6)

 

    Uint16 eventId=UART_getEventId(hUart);

    Uint16 Lsr,id;

 

    IRQ_disable(UART_EVENT);

 

    if (((void (*)(void))(hUart->UART_isrDispatchTable[eventId])))

    {

        ((void (*)(void))(hUart->UART_isrDispatchTable[eventId]))();

    }

 

//the function above only handle one interrupt,so I add some additional handling

    Lsr = CSL_FEXT(hUart->uartRegs->LSR,UART_LSR_THRE);

    if(Lsr && eventId != UART_EVT_TBEI_IID && glTxOv){

        id = UART_EVT_TBEI_IID;

/** Transmitter holding register empty interrupt identification value*/

        if (((void (*)(void))(hUart->UART_isrDispatchTable[id])))

        {

            ((void (*)(void))(hUart->UART_isrDispatchTable[id]))();

        }

    }

 

 

    Lsr = CSL_FEXT(hUart->uartRegs->LSR,UART_LSR_DR);

    if(Lsr && eventId != UART_EVT_RBI_IID){

        id = UART_EVT_RBI_IID;

 /** Received data available interrupt identification value*/

        if (((void (*)(void))(hUart->UART_isrDispatchTable[id])))

        {

            ((void (*)(void))(hUart->UART_isrDispatchTable[id]))();

        }

    }

    IRQ_enable(UART_EVENT);

}

 

 

void UartTxStr()

{

    //transmit 1byte data

    CSL_Status status;

    char TxData;

    UartTxPos--;

    glTxOv = 1;

    TxData=UartTxBuff[UartTxPos];

    UtFrmCtrl.SendState = UART_SEND_BUSY;

    status = UART_fputc(hUart,TxData,0);

}

 

 

void uart_txIsr()

{/** transmiter holding register empty interrupt*/

    //uart tx interrupt

    if (UartTxPos > 0){

        UartTxStr();

    }else{//frame transmision over

        UtFrmCtrl.SendState = UART_SEND_IDLE;

    }

    glTxOv = 0;

}

  • Hi,

    I've forwarded this to the C55x team. Their feedback will be posted here.

    Best Regards,
    Yordan
  • When I change the interrupt handle a bit, the problem shows up otherwhere. For example, if I write:
    void uartISR(){
    //interrupt for UART(INT6)

    Uint16 eventId;
    Uint16 Lsr;

    IRQ_disable(UART_EVENT);

    eventId = UART_getEventId(hUart);

    if(eventId == UART_EVT_CTOI_IID){
    if (((void (*)(void))(hUart->UART_isrDispatchTable[eventId])))
    {
    ((void (*)(void))(hUart->UART_isrDispatchTable[eventId]))();
    }
    }


    Lsr = CSL_FEXT(hUart->uartRegs->LSR,UART_LSR_DR);
    if(Lsr){
    eventId = UART_EVT_RBI_IID; /** Received data available interrupt identification value*/
    if (((void (*)(void))(hUart->UART_isrDispatchTable[eventId])))
    {
    ((void (*)(void))(hUart->UART_isrDispatchTable[eventId]))();
    }
    }

    Lsr = CSL_FEXT(hUart->uartRegs->LSR,UART_LSR_THRE);
    if(Lsr){
    eventId = UART_EVT_TBEI_IID;/** Transmitter holding register empty interrupt identification value*/
    if (((void (*)(void))(hUart->UART_isrDispatchTable[eventId])))
    {
    ((void (*)(void))(hUart->UART_isrDispatchTable[eventId]))();
    }
    }



    IRQ_enable(UART_EVENT);
    }

    The program do not run into the places the day before, but run into another breakpoint which still indicates that the interrupt didn't come.

    And I let the transmitting machine keep transmitting.(in the test before the transmitting machine is not always transmitting, it transmits at times).
    The interrupt do not come after a while. And in the program I just re send again after some time.
    sometimes the interrupt will come after a while;
    sometimes the interrupt donot come up again. Then I check the registers and found that LSR=0X63, which means that overrun happens. Why?
  • In addition, I found that if the serial data comes before the UART_setup, LSR will be 0xE3 and the interrupt will not come up at all.
    Is this reasonable?

    Is anybody here?
  • Just now, I found that: when the interrupt do not come up, IIR = 4 FCR=4 and I read the rx data , the interrupt comes up again.
    So it is possible that I didn't read the rx data in time? but why? I read the rx data in the interrupt handle function, rx data should have been read out in time.  I use 9600 baud rate, so it takes 1ms or so to send a bype. there isn't any programm that would hold back the interrupt.

  • I didn't do much in my application program, but I'm using DSP/BIOS which may hold the interrupt.
    But I use 9600 baut rate, which means the receiving interrupt will come every 1ms or so. I don't think BIOS will have such an effect.

    But I let the transmitting machine delay some time when transmitting the next byte. the rx will not overrun.

    But if the transmitting machine do not delay when transmitting the next byte and the receiving machine do not transmit, the rx will not overrun.

    I can't understand why?