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.

TMS320F280038C-Q1: CPU goes to an undefined state

Part Number: TMS320F280038C-Q1
Other Parts Discussed in Thread: C2000WARE

Hi,

Background information: I'm controlling a powerstage and also implemented CAN and UART communication on my C2000 at my application board. My system work as expected at normal operation. I have background tasks that is called at each 1msec,10msec and 100msec. I inited my watchdog and feed it after the end of each task.

I found a case that my MCU gets stucks and stops sending CAN msgs. I debugged and found some findings. It some times achieve to get WD reset, but sometimes no reset occurs as I explained below.

FAILURE MODE Instant: Disconnecting USB (RS485-to-USB converter). It is connected to my UART pins of MCU. Imagine that I have a PC and use USB port. RS485-to-USB converter and I have board that converters RS485-to-RS422. I use RS422 lines to communicate with my UART TX-RX pins on my MCU.

When I debugged, I found following register set. 

Normal operation mode:

normal_case_WDRegs.PNG

 

FAILURE CASE:

My MCU goes to an undefined mode. My CAN communication gets lost. I cannot no more communcation with my PC if I re-insert converter to USB port.

XRSN pin doesn't get LOW at this failure mode... That means, it doesn't go to Watchdog reset mode. It moves on counting.

WDCNTR: increases and decreases again and again, but my software doesn't work as expected.

failure_case_WDRegs.PNG

failure_case_CPUSysRegs.PNG

The below one , when my WD can achieve to go reset.

WDResetted_failure_case_CPUSysRegs.PNG

My Watchdog inits is as below.; I feed my watch dog at my tasks.

void InitWDT(void)
{
    SysCtl_setWatchdogMode(SYSCTL_WD_MODE_RESET);

    // 10us*4096*8*256=419ms

    SysCtl_setWatchdogPredivider(SYSCTL_WD_PREDIV_2048);
    SysCtl_setWatchdogPrescaler(SYSCTL_WD_PRESCALE_8);

    SysCtl_serviceWatchdog();
    SysCtl_enableWatchdog();

    SysCtl_setWatchdogMode(SYSCTL_WD_MODE_RESET);
}

Can you help me to identify what is happening to my application? 

Can you help me to find the root cause?

  • Hi,

    I have background tasks that is called at each 1msec,10msec and 100msec.

    Is this timer interrupt base ?

    I am assuming CCS is connected to MCU and you are able to check where the code gets stuck ? Disconnecting USB will cause some communication error and do we have SW handler in place to take care of this error ?

    Regards,

    Vivek Singh

  • Hi,

    Background tasks aren't timer interrupt based. I count a variable at ADC interrupt and call related task according to it. That means software counting based. Yes, I use CCS.

    I use SCI module to communicate with my USB to RS485 converter. I configured SCI to go interrupt at RXRDY case.

    __interrupt void sciaRxISR(void)
    {
        // Read a character from the RXBUF.
        ReceiveInterrupt(SCI_readCharBlockingNonFIFO(SCIA_BASE));
    
        // Acknowledge the PIE interrupt.
        Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP9);
    }

    At failure case, I cannot also get into ADC Interrupt. I also cannot get into SCI Interrupt.

    My code gets stuck at this while loop at failure instant: sci.h is TI's library.

    static inline uint16_t
    SCI_readCharBlockingNonFIFO(uint32_t base)
    {
        //
        // Check the arguments.
        //
        ASSERT(SCI_isBaseValid(base));
    
        //
        // Wait until a character is available in the receive FIFO.
        //
        while(!SCI_isDataAvailableNonFIFO(base))
        {
        }
    
        //
        // Return the character from the receive buffer.
        //
        return((uint16_t)(HWREGH(base + SCI_O_RXBUF) & SCI_RXBUF_SAR_M));
    }

    This is the caller funct.

    //*****************************************************************************
    //
    //! Waits for a character from the specified port when the FIFO enhancement
    //! is not enabled.
    //!
    //! \param base is the base address of the SCI port.
    //!
    //! Gets a character from the receive buffer for the specified port.  If there
    //! is no characters available, this function waits until a character is
    //! received before returning.
    //!
    //! \return Returns the character read from the specified port as \e uint16_t.
    //
    //*****************************************************************************
    static inline uint16_t
    SCI_readCharBlockingNonFIFO(uint32_t base)
    {
        //
        // Check the arguments.
        //
        ASSERT(SCI_isBaseValid(base));
    
        //
        // Wait until a character is available in the receive FIFO.
        //
        while(!SCI_isDataAvailableNonFIFO(base))
        {
        }
    
        //
        // Return the character from the receive buffer.
        //
        return((uint16_t)(HWREGH(base + SCI_O_RXBUF) & SCI_RXBUF_SAR_M));
    }

  • Hi,

    I use SCI module to communicate with my USB to RS485 converter. I configured SCI to go interrupt at RXRDY case.

    Have you configured SCI error interrupts as well so that if there is error it triggers that interrupt ?

    Having said that, if you are not servicing the WD because code get stuck in this loop, it should fire a reset. It is strange that WD counter is running but there is no reset. I also observed that in working case and non-working case your WD configuration has changed. Like WDPRECLKDIV and WDPS are configured in non-working case but in working case it's 0. Is that expected ?  

    Regards

    Vivek Singh

  • Hi,

    Have you configured an of SCI error interrupts as well so that if there is error it triggers that interrupt ?

    No, can you help on it? If there is an example sw, can you offer?

    I repost my normal operation mode:
    I updated the register by using "continous refresh" 
    Maybe previous one is misleading you.

  • look like the snapshot got missed. Can you re-post it.

    About SCI example, I will have to refer to other expert.

  • Hi,

    Can you refer to SCI expert please?

  • Hi Gokhan,

    Some information regarding the SCI:

    You can find all of our SCI software examples in the C2000Ware download here: {C2000Ware}\driverlib\f28003x\examples\sci; or online at this link. For instance, the sci_ex2_loopback_interrupts.c example in C2000Ware shows SCI interrupt usage and can be referenced for general interrupt implementation.

    The device technical reference manual (TRM) also has descriptions of how to implement SCI error interrupts and what registers are required:

    • You can enable SCI Receive Error interrupts (SCICTL1.RXERRINTENA)
    • You can also check/view the status of receive errors in the SCI Receive Status register (SCIRXST.RXERROR)
      • RXERROR is a logical OR of the break detect, framing error, overrun, and parity error enable flags (bits 5-2: BRKDT, FE, OE, and PE). You can also view these individual register fields to understand the SCI Receive Error source.
      • The TRM also describes clearing of SCI errors using a software reset 

    Best Regards,

    Allison