Part Number: EK-TM4C1294XL
Tool/software: Code Composer Studio
Hi, I am trying to use SSI peripheral for TM4C1294XL. I have referred to numerous website as reference to write my code. As of now, I have not connected any sensor to SPI pins(MOSI,MISO, SCLK, SS). I have just programmed the SSI peripheral, compiled it and probed the SCLK line of TM4C1294XL. However, I am not observing any clock pulse on the SCLK line. Do I need to connect a sensor first to observe the clock pulse on SCLK or am I missing something in my code? Any help is appreciated. Following is the code:
sys_clock = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |SYSCTL_OSC_MAIN |SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), CLOCK_FREQ); //CLOCK_FREQ is a macro defined as 120000000
SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
//Enable the GPIO that are used for SPI Interface Pins
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
//
// Configure Pins for SPI Interface
//
// Configure the muxing and GPIO settings to bring the SSI/SPI functions out to the pins
//PA4: Rx,PA5:Tx,PA2:SCLK,PA3:FSS
GPIOPinConfigure(GPIO_PA4_SSI0XDAT0);
GPIOPinConfigure(GPIO_PA5_SSI0XDAT1);
GPIOPinConfigure(GPIO_PA3_SSI0FSS);
GPIOPinConfigure(GPIO_PA2_SSI0CLK);
GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_5|GPIO_PIN_4|GPIO_PIN_3|GPIO_PIN_2);
SSIConfigSetExpClk(SSI0_BASE, sys_clock, SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 1000000, 8);
SSIEnable(SSI0_BASE);
spi_write(0x37,0x55);
}
void spi_write(uint8_t reg_addr, uint8_t data){
uint8_t temp = 0;
// while(SSIDataGetNonBlocking(SSI2_BASE, &temp));
SSIDataPut(SSI0_BASE,reg_addr);
SSIDataPut(SSI0_BASE, data);
while(SSIBusy(SSI0_BASE));
}