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.

TMS320F28379D: Force SCI to send bad data

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

Hi

Do you have any guide on how to setup SCI to generate output that contains errors

  • Parity Error
  • Framing Error
  • Break

This is for testing the error detection on the device in the other end. A test that is often forgotten.

  • Hi,

    Thanks for your question!

    We actually have a function for aggregating all of the interrupts/errors in C2000Ware driverlib's sci.c file, under C2000Ware_VERSION#\driverlib\f2837xd\driverlib\sci.c.

    See below:

    //*****************************************************************************
    //
    // SCI_getInterruptStatus
    //
    //*****************************************************************************
    uint32_t
    SCI_getInterruptStatus(uint32_t base)
    {
        uint32_t interruptStatus = 0;
    
        //
        // Check the arguments.
        //
        ASSERT(SCI_isBaseValid(base));
    
        //
        // Return the interrupt status.
        //
        if((HWREGH(base + SCI_O_CTL2) & SCI_CTL2_TXRDY) == SCI_CTL2_TXRDY)
        {
            interruptStatus |= SCI_INT_TXRDY;
        }
        if((HWREGH(base + SCI_O_RXST) & SCI_RXST_RXERROR) == SCI_RXST_RXERROR)
        {
            interruptStatus |= SCI_INT_RXERR;
        }
        if(((HWREGH(base + SCI_O_RXST) & SCI_RXST_RXRDY) == SCI_RXST_RXRDY)  ||
           ((HWREGH(base + SCI_O_RXST) & SCI_RXST_BRKDT) ==  SCI_RXST_BRKDT))
        {
            interruptStatus |= SCI_INT_RXRDY_BRKDT;
        }
        if((HWREGH(base + SCI_O_FFTX) & SCI_FFTX_TXFFINT) == SCI_FFTX_TXFFINT)
        {
            interruptStatus |= SCI_INT_TXFF;
        }
        if((HWREGH(base + SCI_O_FFRX) & SCI_FFRX_RXFFINT) == SCI_FFRX_RXFFINT)
        {
            interruptStatus |= SCI_INT_RXFF;
        }
        if((HWREGH(base + SCI_O_RXST) & SCI_RXST_FE) == SCI_RXST_FE)
        {
            interruptStatus |= SCI_INT_FE;
        }
        if((HWREGH(base + SCI_O_RXST) & SCI_RXST_OE) == SCI_RXST_OE)
        {
            interruptStatus |= SCI_INT_OE;
        }
        if((HWREGH(base + SCI_O_RXST) & SCI_RXST_PE) == SCI_RXST_PE)
        {
            interruptStatus |= SCI_INT_PE;
        }
    
        return(interruptStatus);
    }

    Once the interrupt status has been read, this can then be used with the defines (below) in sci.h to do checks on what specific error caused the issue.

    You can even or several together to lump them during your check as one "group" of errors.

    //*****************************************************************************
    //
    // Values that can be passed to SCI_enableInterrupt, SCI_disableInterrupt, and
    // SCI_clearInterruptStatus as the intFlags parameter, and returned from
    // SCI_getInterruptStatus.
    //
    //*****************************************************************************
    #define SCI_INT_RXERR          0x01U  //!< RXERR interrupt
    #define SCI_INT_RXRDY_BRKDT    0x02U  //!< RXRDY interrupt
    #define SCI_INT_TXRDY          0x04U  //!< TXRDY interrupt
    #define SCI_INT_TXFF           0x08U  //!< TX FIFO level interrupt
    #define SCI_INT_RXFF           0x10U  //!< RX FIFO level interrupt
    #define SCI_INT_FE             0x20U  //!< Frame Error
    #define SCI_INT_OE             0x40U  //!< Overrun Error
    #define SCI_INT_PE             0x80U  //!< Parity Error

    Let me know if any questions!

    Regards,

    Vince

  • Thank you for the reply. but it completely misses the point.

    I ám using the SCI functions including the getInterruptStatus() in my product. No issue there.

    I have done the proper implementation with handling of communications errors and so on!

    But then I ask "How to test that it works?"

    And i do not consider setups where the SW itself inserts the error-flag. You have to test on unmodified SW to know that it works out there in the wild.

    I need a tester device to send me communications on the SCI input containing the errors, so I can observe that my DUT (device under test) is able to detect those errors and handle them correctly.

    I was hoping that i could utilize my LANCHxxx board as the tester device

    Creating a single byte with parity error is quite easy as I can setup my tester with the opposite parity as my DUT.

    but then again I would need to do a lot of reading and research in the reference manual how to change that parity for a single byte in a stream of 20 bytes, without inserting pauses in the stream. And maybe that is not even possible on this MCU??

    Also the other error conditions i might be able to create, again requirering me to do a loot of research.

    So my question is do you have any documentation/example/white paper on how to do such a setup?

    I mean this should be a common setup, for testing your communications, unfortunately this is often skipped or forgotten as there is little info out there how to set it up.

    Remember we all have a testing area, some is fortunate enough to have a separate production area where customers roam.

  • Hi Martin,

    We unfortunately do not have anything written for doing non-SW checks specifically (we do have software interrupt assertion as you mentioned) though we can definitely look to create something like this in the future, limitations would be throughout obviously, but for testing that should be okay.

    As an FYI, we actually are actively closing this gap on current devices with our “Embedded Pattern Generator” (see here https://www.ti.com/lit/an/spracy7/spracy7.pdf)

    Essentially, this provides a built-in flexible hardware test platform for testing like you are describing.

    Regards,

    Vince