I am trying to receive data from an SPI master (specifically a Raspberry Pi SBC) using a TM4C123GH6PM as an SPI slave. Data is being placed on the SPI3 MOSI pin, a clock is present on the SPI3 CLK pin and an active LOW frame select signal is present on SPI nFSS.
On every nFSS event I am getting an interrupt and the SSIDataGet function stops blocking. However, regardless of the data communicated, the data received is always zero.
The eventual plan is to use DMA to receive the data into an internal buffer. However for now I decided to just get it working using interrupts and polling, to prove the SPI module can receive data.
The initialisation routine I am using:
void init_ssi3() { SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI3); SSIDisable(SSI3_BASE); GPIOPinTypeSSI(GPIO_PORTD_BASE, GPIO_PIN_3 | GPIO_PIN_2 | GPIO_PIN_1 | GPIO_PIN_0); GPIOPinConfigure(GPIO_PD0_SSI3CLK); GPIOPinConfigure(GPIO_PD1_SSI3FSS); GPIOPinConfigure(GPIO_PD2_SSI3RX); GPIOPinConfigure(GPIO_PD3_SSI3TX); SSIConfigSetExpClk(SSI3_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, SSI_MODE_SLAVE, RASPI_SPI_RATE, 8); SSIIntEnable(SSI3_BASE, SSI_RXFF); SSIIntRegister(SSI3_BASE, SSI3InterruptRequest); SSIEnable(SSI3_BASE); }
RASPI_SPI_RATE is set to a nominal 500kHz (value 500000). The master is transmitting at ~430kHz. I have tried setting the SPI rate to 430000 Hz but this makes no difference. However I would like the clock rate to be non critical i.e. the master will be clocking the slave and that rate may vary if the CPU is under more or less load.
Scope screenshots are attached; Cyan is clock, Yellow is MOSI, Purple is nFSS and Blue is MISO (slave not transmitting).
As a data point - I have tried transmitting upon receiving an interrupt however nothing happens. It does not block or transmit data. If the nFSS or clock is missing the function blocks so it does appear to depend on this being present.
Thanks for any suggestions,