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.

RTOS/CC3200: Hard fault when calling sl_Start.

Part Number: CC3200
Other Parts Discussed in Thread: SYSBIOS,

Tool/software: TI-RTOS

Hi,

I've recently been trying to upgrade my project to 2.16.1. I've changed my configuration file to use TI-DRIVERS, but now sl_Start hard faults the device. 

ti.sysbios.family.arm.m3.Hwi: line 1095: E_hardFault: FORCED
ti.sysbios.family.arm.m3.Hwi: line 1172: E_busFault: PRECISERR: Immediate Bus Fault, exact addr known, address: 5b6e8dd0
Exception occurred in background thread at PC = 0x20014168.
Core 0: Exception occurred in ThreadType_Task.
Task name: {unknown-instance-name}, handle: 0x2001b8e8.
Task stack base: 0x2001b938.
Task stack size: 0x2000.
R0 = 0x5b6e8dd0 R8 = 0x00000000
R1 = 0x2001d2f0 R9 = 0xffffffff
R2 = 0x3b6d04e0 R10 = 0xffffffff
R3 = 0x200188f0 R11 = 0xffffffff
R4 = 0x00008d1d R12 = 0x20024960
R5 = 0x2001da50 SP(R13) = 0x2001d2e8
R6 = 0x00000000 LR(R14) = 0x20013829
R7 = 0x00000000 PC(R15) = 0x20014168
PSR = 0x01000000
ICSR = 0x0400f803
MMFSR = 0x00
BFSR = 0x82
UFSR = 0x0000
HFSR = 0x40000000
DFSR = 0x0000000b
MMAR = 0x5b6e8dd0
BFAR = 0x5b6e8dd0
AFSR = 0x00000000

The error appears to come from SPI_open(), which is called by sl_Start. This doesn't happen when I remove the ti.drivers module and instead link against oslib.

Any ideas? I've tested this on two different boards, so it's not a hardware issue.

  • Ian,

    Depending on which release your project was originally based on, you might need to make some changes to your board file (CC3200_LAUNCHXL.C). I suggest you import an example from your TI-RTOS CC32xx 2.16.1 product (e.g. tpcEchoCC3X00_CC3200_LAUNCHXL_TI_CC3200), build and run it. This will validate your hardware setup and give you a working baseline. Then compare all the board files to your project and make necessary update.

    ~Ramsey

  • Thanks for the suggestion. From the TCP example project (in the 2.16.00.08 examples), I copied CC3200_LAUNCHXL.{c,h}, pin_mux_config.h, rom_pin_mux_config.h, and cc3200v1p32.cmd into a blank project. I set it to link against driverlib.a, simplelink.a, and the inherited libraries from ti_rtos_config. I copied the TI-RTOS configuration file and put its contents inside the app.cfg file inside of ti_rtos_config.

    The main function calls a few initializing functions like PRCMCC3200MCUInit and VStartSimpleLinkSpawnTask, and then calls sl_Start(NULL, NULL, NULL). A hard fault then occurs. 

    I put the CCS project up at  if you want to take a look.

  • Ian,

    I downloaded your project but it will not build. It has a project reference to your ti_rtos_config project. Would you be able to share that as well?

    ~Ramsey

  • Hi,

    I pushed a "self-contained" version that should be easier for you to try (and doesn't require the ti_rtos_config project). Thanks for checking it out.

  • I am looking into it, but there will be a delay. Sorry.
  • Ian,

    I have your project working on my setup. I've attached the project for your inspection: 8473.cc3200-tiforum.zip.

    Your project does not look like a TI-RTOS example, but I see you did try to import some of the board files. Unfortunately, there were still some missing pieces. Most importantly, we have a new driver called WiFi. This driver must be configured and loaded before calling sl_Start(). In addition, we provide a file called sockets.c which encapsulates some startup functionality. You are not required to use this, but it comes in handy.

    Here is a summary of the changes I made.

    I added the following files; taken from the tcpEchoCC3x00 example:

    Board.h
    sockets.c
    sockets.h

    I changed your project include paths. I added the following:

    ${COM_TI_RTSC_TIRTOSCC32XX_INSTALL_DIR}/products/tidrivers_cc32xx_2_16_01_13/packages/ti/drivers/wifi
    ${COM_TI_RTSC_TIRTOSCC32XX_INSTALL_DIR}/products/tidrivers_cc32xx_2_16_01_13/packages/ti/mw/wifi/cc3x00
    ${COM_TI_RTSC_TIRTOSCC32XX_INSTALL_DIR}/products/tidrivers_cc32xx_2_16_01_13/packages/ti/mw/wifi/cc3x00/oslib
    ${COM_TI_RTSC_TIRTOSCC32XX_INSTALL_DIR}/products/tidrivers_cc32xx_2_16_01_13/packages/ti/mw/wifi/cc3x00/simplelink/include
    ${workspace_loc:/${ProjName}}
    ${COM_TI_RTSC_TIRTOSCC32XX_INSTALL_DIR}/products/CC3200_driverlib_1.1.0
    ${COM_TI_RTSC_TIRTOSCC32XX_INSTALL_DIR}/products/CC3200_driverlib_1.1.0/inc
    ${COM_TI_RTSC_TIRTOSCC32XX_INSTALL_DIR}/products/CC3200_driverlib_1.1.0/driverlib

    I changed your library paths. It looks like you were building the SimpleLink library yourself in another project. This comes in now through config.

    ${COM_TI_RTSC_TIRTOSCC32XX_INSTALL_DIR}/products/CC3200_driverlib_1.1.0/driverlib/ccs/Release/driverlib.a

    In main.c, I added the following include paths.

    //#include <WiFiCC3200.h>
    
    /* SimpleLink Wi-Fi Host Driver Header files */
    #include <osi.h>
    #include <simplelink.h>
    
    #include "pin_mux_config.h"
    #include "sockets.h"
    #include "Board.h"
    

    I removed the SimpleLink event handlers. They are now defined in sockets.c with some additional functionality.

    I re-worked the MainTask() function. Instead of calling sl_Start() directly, it uses the wrapper functions in socket.c.

    void MainTask(void *pvData)
    {
        bool running = true;
        void *netIF;
        volatile int i;
    
        printf("Calling the deadly function.\n");
    //  int ret = sl_Start(0, 0, 0);
    
        /* Open WiFi and await a connection */
        netIF = socketsStartUp();
    
        printf("MainTask: main loop\n");
    
        /* main loop */
        while (running) {
            /* do somw work here */
            for (i = 1; i <= 10000; i++) {
            }
        }
    
        /* Close the network - don't do this if other tasks are using it */
        socketsShutDown(netIF);
    }

    Finally, I re-worked the boot() function to call the board initialization functions. In particular, the Board_initWiFi() function loads the new WiFi driver. This must be done before the first call to sl_Start().

    static void boot(void)
    {
        /* Call board init functions. */
        Board_initGeneral();
        Board_initGPIO();
        Board_initWiFi();
    
    #if 0
        MAP_IntMasterEnable();
        MAP_IntEnable(FAULT_SYSTICK);
    
        PRCMCC3200MCUInit();
    
        PinMuxConfig();
    
        long lRetVal = VStartSimpleLinkSpawnTask(1);
    
        if (lRetVal < 0) {
            error("Could not start the SimpleLink task.", lRetVal);
        }
    #endif
    }

    When I run on my setup, I get the following output in the CCS Console:CIO window:

    Booting...
    Calling the deadly function.
    CC3X00 has connected to an AP and acquired an IP address.
    IP Address: 192.168.1.120
    MainTask: main loop

    Good luck. I hope you get your project up and running.

    ~Ramsey

  • Thank you for your reply. It now starts successfully.