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.

TMS320F280049C: SCI B FIFO RX INTERRUPT ISSUE

Former Member
Former Member
Part Number: TMS320F280049C

Hi,

I am working on SCI communication between two TMS320F280049C. I have an issue with the RX FIFO interrupt, it never triggers.

Here is my code. (The same code is used in both TMS320F280049C)

void main(void)
{
    //
    // Initialize device clock and peripherals
    //
    Device_init();

    //
    // Disable pin locks and enable internal pullups.
    //
    Device_initGPIO();

    //
    // Disable sync(Freeze clock to PWM as well)
    //
    SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);

    //
    // Initializes PIE and clear PIE registers. Disables CPU interrupts.
    // and clear all CPU interrupt flags.
    //
    Interrupt_initModule();

    //
    // Initialize the PIE vector table with pointers to the shell interrupt
    // Service Routines (ISR).
    //
    Interrupt_initVectorTable();

    //
    Interrupt_register(INT_SCIB_RX, &INT_mySCIB_RX_ISR);
    Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP9);
    Interrupt_disable(INT_SCIB_RX);

    sci_gpio_init();
    sci_init();

#ifdef AUTOBAUD
    //
    // Perform an autobaud lock.
    // SCI expects an 'a' or 'A' to lock the baud rate.
    //
    SCI_lockAutobaud(SCIB_BASE);
#endif

    //
    //Enable SCIB interrupt
    //
    SCI_enableInterrupt(SCIB_BASE, SCI_INT_RXFF);
    Interrupt_enable(INT_SCIB_RX);

    //
    // Enable global Interrupts and higher priority real-time debug events:
    //
    EINT;  // Enable Global interrupt INTM
    ERTM;  // Enable Global realtime interrupt DBGM

    while(1)
    {
        sci_send_state(sciDataSend);
        DEVICE_DELAY_US(1000);
    }
}

__interrupt void INT_mySCIB_RX_ISR(void)
{
    sciDataReceived = SCI_readCharBlockingFIFO(SCIB_BASE);

    Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP9);
    SCI_clearInterruptStatus(SCIB_BASE, SCI_INT_RXFF);
}

//
//
//
void sci_init(void)
{
    SCI_performSoftwareReset(SCIB_BASE);

    SCI_disableModule(SCIB_BASE);

    SCI_setConfig(SCIB_BASE, 25000000, 9600, (SCI_CONFIG_WLEN_8 |
                                                          SCI_CONFIG_STOP_ONE |
                                                          SCI_CONFIG_PAR_NONE));

    SCI_disableLoopback(SCIB_BASE);
    SCI_resetChannels(SCIB_BASE);

    //
    // FIFO and interrupt configuration
    //
    SCI_enableFIFO(SCIB_BASE);
    SCI_clearInterruptStatus(SCIB_BASE, SCI_INT_RXFF);
    SCI_setFIFOInterruptLevel(SCIB_BASE, SCI_FIFO_TX1, SCI_FIFO_RX1);


    SCI_enableModule(SCIB_BASE);

    SCI_performSoftwareReset(SCIB_BASE);
}

//
//
//
void sci_gpio_init(void)
{
    EALLOW;

    GPIO_setMasterCore(SCIB_TX, GPIO_CORE_CPU1);            //
    GPIO_setMasterCore(SCIB_RX, GPIO_CORE_CPU1);            //

    GPIO_setPinConfig(GPIO_56_SCIB_TX);                     //
    GPIO_setPinConfig(GPIO_57_SCIB_RX);                     //

    GPIO_setDirectionMode(SCIB_TX, GPIO_DIR_MODE_OUT);      //
    GPIO_setDirectionMode(SCIB_RX, GPIO_DIR_MODE_IN);       //

//    GPIO_setPadConfig(SCIB_TX, GPIO_PIN_TYPE_STD);          //
//    GPIO_setPadConfig(SCIB_RX, GPIO_PIN_TYPE_STD);          //

    GPIO_setQualificationMode(SCIB_TX, GPIO_QUAL_ASYNC);    // No synchronization
    GPIO_setQualificationMode(SCIB_RX, GPIO_QUAL_ASYNC);    // No synchronization

    EDIS;
}

void sci_send_state(uint16_t state)
{
    while(SCI_isTransmitterBusy(SCIB_BASE) == true);        //
    SCI_writeCharBlockingNonFIFO(SCIB_BASE, state);         // Send the current state of the Buck
}

Thank you in advance for your answer !

Lorend Dalloshi

  • Hi Lorend,

    I have an issue with the RX FIFO interrupt, it never triggers.

    Have you looked at the communication through a scope? Is the other device sending data properly? 

    Do you see data being received through the SCI registers?

    Best Regards,

    Marlyn

  • Hi Marlyn,

    Thanks for your response.

    Yes I have looked at the communication through a scope, the sending is working.

    When I looked at the receive registers after initialization that is what I got in both controller.

    My devices are sending 0.

    Best Regards,

    Lorend

  • Former Member
    0 Former Member in reply to Former Member

    I managed to clear the error flag by reducing the speed of the clock supplied to the SCI module. I can communicate with 1 way but the other way is still not working, this is what i got no matter what i send.

    Best Regards,

    Lorend

  • Hi Lorend,

    I managed to clear the error flag by reducing the speed of the clock supplied to the SCI module

    What error were you getting? What is your clock now?

    I can communicate with 1 way but the other way is still not working, this is what i got no matter what i send.

    So are you saying that one device can transmit and the other will receive but when you transmit from the other device, there is no reception?

    On the device where the RX ISR is not entered, can you please try a loopback scenario? This will help determine whether its an issue with how the software is setup on that device or not and will simplify debug. 

    Best Regards,

    Marlyn

  • Hi Marlyn,

    What error were you getting? What is your clock now?

    The error flags SCIFFFE and SCIFFPE, the clock was 2 500 000 instead of 25 000 000.

    So are you saying that one device can transmit and the other will receive but when you transmit from the other device, there is no reception?

    Yes, I managed to make it work if I initialize the communication by sending 255 instead of 0, with this method i can communicate with the 2 device (send and receive) but the problem now is that if one of them loose the connection or needs a reset the communication won't work anymore.

    On the device where the RX ISR is not entered, can you please try a loopback scenario? This will help determine whether its an issue with how the software is setup on that device or not and will simplify debug. 

    I tried the loopback on both devices and it works perfectly

    Best Regards,

    Lorend

  • Hi Lorend,

    Yes, I managed to make it work if I initialize the communication by sending 255 instead of 0, with this method i can communicate with the 2 device (send and receive) but the problem now is that if one of them loose the connection or needs a reset the communication won't work anymore.

    In this case, I would suggest clearing the buffers/data (read until the buffer is empty) and then clear the interrupts/errors. After this you should be able tor receive properly. 

    Best Regards,

    Marlyn

  • Hi Marlyn,

    I have tried to clear the buffers but it doesn't seem to work, it looks more like one of my device, the one I turn on first, doesn't synchronize or doesn't recognize the data send as SCI data.

    Best Regards,

    Lorend

  • Hi Lorend,

    the one I turn on first, doesn't synchronize or doesn't recognize the data send as SCI data

    At this point in the debug it seems to be more of an application issue rather than an SCI issue. Please let me know how else I can help but from a device and configuration point of view I don't have anymore suggestions. 

    Best Regards,

    Marlyn

  • Hi Marlyn,

    I think I found the problem. If one of the devices sends data before the other device has finished its initialization then the communication is blocked.
    I realized while debugging step by step that the communication was working fine if I run both devices after initialization.
    The problem now is that I don't see how to make sure that the devices are ready to start the communication.

    Best Regards,

    Lorend

  • Hi Lorend,

    The problem now is that I don't see how to make sure that the devices are ready to start the communication.

    You could add some delay after initialization to ensure both devices have finished their initialization, or set a gpio high to indicate that initialization is complete and have the other device check the status of that gpio. 

    Best Regards,

    Marlyn