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.

TM4C SPI Problem with Loader Exit

Other Parts Discussed in Thread: CC1101, EK-TM4C1294XL

I am attempting to interface a TM4C-1294NCPDT microcontroller with a CC1101 radio using SPI. My launchpad is the EK-TM4C1294XL. My compiler is CCS 6.0.1. The radio board (CC1101EM 3.0) is connected to the board via the EM Adapter BoosterPack such that I have the following connections:

CC1101 Name

TM4C1294 Name

TM4C1294 Port/Pin

Purpose

CSn

GPIO

PP5

Radio control (Hi/Lo)

SCLK

SCLK

PQ0

Clock

SI

SSI3TX/SSI3XDAT0

PQ2/A3

MOSI

SO

SSI3RX/SSI3XDAT1

PQ3/A2

MISO

I used the gpiointerrupt_TivaTM4C1294NCPDT example from the "Getting Started" menu to start with, and added "Board_initSPI();" (which links to EK_TM4C1294XL_initSPI()) to the beginning of my main program. There was an earlier discussion about SPI here: https://e2e.ti.com/support/microcontrollers/tiva_arm/f/908/p/343529/1201514, that I am trying to parallel the initialization from. My issue is that adding the lines "SSIDisable(SSI3_Base);" or "SSIClockSourceSet(SSI3_Base, SSI_CLOCK_SYSTEM);" causes the compiler to get stuck in exit.c infinitely:

How can I avoid this problem? See full SPI Initialization code below:

void EK_TM4C1294XL_initSPI(void)
{

SysCtlClockSet(SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_25MHZ);

SSIDisable(SSI3_BASE);
// Set IO clock as SSI clock source
//
SSIClockSourceSet(SSI3_BASE, SSI_CLOCK_SYSTEM);

/* SSI3 */
SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI3);

GPIOPinConfigure(GPIO_PQ0_SSI3CLK);
GPIOPinConfigure(GPIO_PQ1_SSI3FSS);
GPIOPinConfigure(GPIO_PQ2_SSI3XDAT0);
GPIOPinConfigure(GPIO_PQ3_SSI3XDAT1);

GPIOPinTypeSSI(GPIO_PORTQ_BASE, GPIO_PIN_0 | GPIO_PIN_1 |
GPIO_PIN_2 | GPIO_PIN_3);

EK_TM4C1294XL_initDMA();
SPI_init();
SSIEnable(SSI3_BASE);
}

  • Matthew Gutierrez said:

    SSIDisable(SSI3_BASE);
    // Set IO clock as SSI clock source
    //
    SSIClockSourceSet(SSI3_BASE, SSI_CLOCK_SYSTEM);

    /* SSI3 */
    SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI3);

    The SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI3) call needs to be before the other two. The reason is that SysCtlPeripheralEnable enables access to a peripheral, and attempting to access a peripheral which has not been enabled leads to a hard fault exception.

    I think TI-RTOS installs a handler for a hard fault, which ends up calling loader_exit.

    i.e. try:

    /* SSI3 */
    SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI3);
    
    SSIDisable(SSI3_BASE);
    
    // Set IO clock as SSI clock source
    //
    SSIClockSourceSet(SSI3_BASE, SSI_CLOCK_SYSTEM);

  • Thank you very much!