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.

CC3200 Benjamin Cabe MQTT Demo with OOB example ending in FaultIsr

Other Parts Discussed in Thread: CC3200, CC3200SDK

hi friends,

I am working with the Benjamin Cabe MQTT demo on CC3200 copied into the oob example project.

I did everything as in the link, but now when i run i am ending up in an infinite loop namely FaultIsr(). 

Any idea how to debug this issue? When i did the single stepping i found that error occurs in the sl_socket() api.  please note: i am running cc3200 in station mode.

this is the link of the tutorial:

  • Vinu Gopalakrishnan said:
    Any idea how to debug this issue?

    http://www.ti.com/lit/pdf/spma043 has guidance for how to investigate why a FaultIsr occurred.

  • ok. thanks for responding. I went through the doc and found that i need to check the register NVIC_FAUT_STAT in CCS v6.
    please tell me how to view it? i tried the view register window but failed
  • Vinu Gopalakrishnan said:
    i tried the view register window but failed

    I am used to looking at the NVIC registers in Tiva devices where the NVIC registers are included in the list of device registers, in the targetdb XML files, and so appear in the register window.

    However, looking at the CCS 6 ccsv6/ccs_base/common/targetdb/devices/CC3200.xml file for the CC3200 device there is no reference to the NVIC registers and so they won't appear in the register window. This appears to an omission in the CC3200 device files.

    As a work-around, you have to use the CCS debugger memory view to look at the raw registers at the addresses given in the CC3200 Technical Reference Manual. e.g the NVIC FAULT_STAT register is at address 0xE000ED28

  • Thanks Gillon,. when i went through that address, its says that an imprecise bus fault occured. And such faults are difficult to debug as they dont show the exaact line where error ocurred.
  • The error occurs exactly at this line.
    (from socket.c file)
    VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&_SlSockSocketCmdCtrl, &Msg, NULL));
  • Vinu Gopalakrishnan said:
    when i went through that address, its says that an imprecise bus fault occured. And such faults are difficult to debug as they dont show the exaact line where error ocurred.

    If you set the DISWBUF bit in the Auxiliary Control (ACTLR) register this can help to diagnose such faults. The description of setting the DISWBUF bit is:

    Disables write buffer use during default memory map accesses.

    In this situation, all bus faults are precise bus faults but performance is decreased because any store to memory must complete before the processor can execute the next instruction.

    Note: This bit only affects write buffers implemented in the Cortex-M4 processor.

    [Note that the description of the DISWBUF bit is incorrect in the CC3200 TRM SWRU367B and I have submitted documentation feedback]

  • Hi Vinu,

    I am also using the cc3200 along with the Paho MQTT code. I used to run into the FaultISR() routine because I was using FreeRTOS. The Paho library is not built for multi-threaded operation as it makes use of the system timer interrupts. These interrupts are needed for context switching when using an RTOS like FreeRTOS.

    What needs to be done to fix this:
    1) Remove code in MQTT library that utilizes system timer.
    //SysTickIntRegister(SysTickIntHandler);
    //SysTickPeriodSet(80000);
    //SysTickEnable();
    2) Enable another interrupt on one of the timers and have it trigger every ms
    3) It's interrupt handler should increment a software timer (integer representing milliseconds)
    Use this variable for all timing functions

    If you think this is your issue and need more help, let me know.
  • Hi Vinu,

    See, if there are any wording mistake with you're code.

    I just followed the MQTT tuotrial by Benjamin Cabe. I did not get a Fault ISR, but I did not get an output at MQTTLens. The only part I changed is the IP address of the code and change it to the IP address of my CC3200 Launchpad.

    - kel
  • Thankyou very much Daniel, i was totally dissappointed at this issue...but now let me try once more.
    So you are saying that i should not create a second task for MQTT ?
    Please explain why step 2 and 3..why should we do that?
  • Vinu,

    I'm saying that if you have more than one task other than a dedicated MQTT task, then the Paho MQTT library won't work as is. In this case, the MQTT library requires modification. You can test this by putting everything in one task and seeing that it runs without hitting faultISR().

    FreeRTOS utilizes the system timer to perform context switching (the process of storing and restoring the state (context) of a process or thread so that execution can be resumed from the same point at a later time). The MQTT library also utilizes this system timer and overwrites the configuration and interrupt handler associated with it, basically it breaks FreeRTOS scheduling. MQTT requires a timing system in order to keep track of keep alive timers, ping timers, timeout timers for sending and receiving data, etc.

    Step 1 is to remove the code that utilizes the system timers from MQTT.

    Steps 2 and 3 are to recreate this code to instead utilize one of the general purpose timers on the CC3200, which has 4 instances of 32 bit user programmable general purpose timers. You can basically just modify "MQTTCC3200.h" and "MQTTCC3200.c" and your initialization code to accomplish this.

    2) Enable another interrupt on one of the timers and have it trigger every ms. This example uses timer A and makes its interrupt fire every ms.

    Use these functions from "timer_if.h" in the common folder of the CC3200SDK and add this to your initialization code
    //Init Timer
    Timer_IF_Init(PRCM_TIMERA0, TIMERA0_BASE, TIMER_CFG_PERIODIC, TIMER_A, 0);

    // Setup the interrupt for the timer timeouts.
    Timer_IF_IntSetup(TIMERA0_BASE, TIMER_A, milliIntHandler);

    //Start the timer (with 1 ms intervals)
    Timer_IF_Start(TIMERA0_BASE, TIMER_A, PERIODIC_TEST_CYCLES / 1000);

    3) It's interrupt handler should increment a software timer (integer representing milliseconds)
    This step is basically already done. As long as the interrupt handler defined in "MQTTCC3200.h" is named milliIntHandler like in step 2.

  • Hi Vinu,

    Did your queries got answered. If yes please press the "Verify Answer" button to close this thread.

    Thanks and Regards,
    Siddaram
  • please tell me in which file is this located. There are lot of library files.
  • Are you asking about timer_if.h? It is in C:\ti\CC3200SDK_1.0.0\cc3200-sdk\example\common
  • Hi Vinu,

    Did your queries got answered. If yes please press the "Verify Answer" button to close this thread.

    Thanks and Regards,
    Siddaram
  • Hi Vinu,

    I am closing this thread, if the issue still exists please open a new thread and add a link to this one for reference

    Thanks and Regards,
    Siddaram