I’m using TM4C123GH6PM, Tiva Launch Pad EK-TM4C123GXL to be more specific.
I have a SPI Master sending me commands, so I should parse the command and act accordingly.
I configure my chip as SPI Slave
void Ssi0Setup(void) { // The SSI0 peripheral must be enabled for use. SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0); // For this example SSI0 is used with PortA[5:2]. //SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); // Configure the pin muxing for SSI0 functions on port A2, A3, A4, and A5. GPIOPinConfigure(GPIO_PA2_SSI0CLK); GPIOPinConfigure(GPIO_PA3_SSI0FSS); GPIOPinConfigure(GPIO_PA4_SSI0RX); GPIOPinConfigure(GPIO_PA5_SSI0TX); // Configure the GPIO settings for the SSI pins.This function also gives GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_5 | GPIO_PIN_4 | GPIO_PIN_3 | GPIO_PIN_2); SSIConfigSetExpClk(SSI0_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, SSI_MODE_SLAVE, 2000000, 8); // Enable the SSI0 module. SSIEnable(SSI0_BASE); //enable interrupts SSIIntEnable(SSI0_BASE, SSI_RXFF | SSI_RXTO | SSI_RXOR ); // Read any residual data from the SSI port. This makes sure the receive // FIFOs are empty, so we don't read any unwanted junk. while(SSIDataGetNonBlocking(SSI0_BASE, &ssi_data_rx[0])) { } } int main() { ClockSetup(); GpioSetup(); UartSetup(); Ssi0Setup(); //Enable processor interrupts. ROM_IntMasterEnable(); //to see the chip alive UARTSendStr("Endat test\r"); while(1) { if(ssi_int_flag) { ssi_int_flag = 0; SSIDataGet(SSI0_BASE, &ssi_data_rx[0]); // Since we are using 8-bit data, mask off the MSB. ssi_data_rx[0] &= 0x00FF; ssi_command = (ssi_data_rx[0] & 0x00CF); switch(ssi_command) { case ENC_SND_POS_VAL: UARTSendStr("Encoder send position values\r"); Blink(1); break; case ENC_SEL_MEM_ARE: UARTSendStr("Selection of memory area\r"); Blink(2); break; case ENC_REC_PARAM: UARTSendStr("Encoder receive parameter\r"); Blink(3); break; case ENC_SND_PARAM: UARTSendStr("Encoder send parameter\r"); Blink(4); break; case ENC_REC_RST: UARTSendStr("Encoder receive reset\r"); Blink(5); break; default: UARTSendStr("Invalid command\r"); break; } //clear FIFO while(SSIDataGetNonBlocking(SSI0_BASE, &ssi_data_rx[0])) { } } } } //Interrupt for SSI0 void SSI0_ISR(void) { UARTSendStr("SSI Int\r"); //for debug uint32_t int_status; //Get the interrrupt status. int_status = ROM_SSIIntStatus(SSI0_BASE, true); // Clear the asserted interrupts. ROM_SSIIntClear(SSI0_BASE, int_status); if(int_status==SSI_RXFF) { ssi_int_flag = 1; } }
I get no interrupt also i see valid signal on SSI0Rx and SSI0CLK lines.