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.

TivaWare SSIDataGet() always returns 0

Other Parts Discussed in Thread: TM4C1236H6PM

I am using a TM4C6H6PM microcontroller. I am trying to get the SSI module to work, for testing I have connected together pins F0 (SSI1Rx) and F1 (SSI1Tx) in an attempt to read in what I am sending.

When running the code below my variables a, b, and c are always 0; d and e are always 1. When run with the blocking version I am still receiving 0. 

I can see on my oscilloscope that I am sending correctly and my Rx and Tx lines are tied together, so I know non-zero data is going to the microcontroller.

I've run this on a launchpad, and 2 boards that I built in house and get the same results on all 3.

Any ideas why SSIDataGet() is only returning 0?

#include <stdint.h>
#include <stdbool.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include "inc/hw_types.h"
#include "inc/hw_memmap.h"
#include "inc/hw_i2c.h"
#include "inc/hw_ssi.h"
#include "inc/hw_gpio.h"
#include "driverlib/gpio.h"
#include "driverlib/pin_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/i2c.h"
#include "driverlib/ssi.h"
#include "driverlib/fpu.h"
#include "inc/tm4c1236h6pm.h"

//**************************************************************************
// Initialize SPI Peripheral including all GPIO configuration
// Parameters: NONE
//**************************************************************************
void InitSPI(void)
{
// Enable the SSI1 pheripheral and GPIO Pins
SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI1);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);

// Wait until the SSI1 module is ready
while(!SysCtlPeripheralReady(SYSCTL_PERIPH_SSI1));

// Set up pin muxing for SSI module
GPIOPinConfigure(GPIO_PF0_SSI1RX);
GPIOPinConfigure(GPIO_PF1_SSI1TX);
GPIOPinConfigure(GPIO_PF2_SSI1CLK);
GPIOPinConfigure(GPIO_PF3_SSI1FSS);

// Set GPIO pins as type SSI
GPIOPinTypeSSI(GPIO_PORTF_BASE, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3);

// Configure the SSI
SSIConfigSetExpClk(SSI1_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_1, SSI_MODE_MASTER, 100000, 8);

// Enable the SSI module
SSIEnable(SSI1_BASE);
}

int main(void) {

// Initialize System clock
SysCtlClockSet(SYSCTL_SYSDIV_8 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);

InitSPI(); // Initializes SSI module 1

unsigned long a,b,c,d,e;

while(SSIDataGetNonBlocking(SSI1_BASE, &c)); // Clear FIFO

while(1)
{
SSIDataPut(SSI1_BASE,0xFF);
d = SSIDataGetNonBlocking(SSI1_BASE,&a);
SSIDataPut(SSI1_BASE,0x44);
e = SSIDataGetNonBlocking(SSI1_BASE,&b);
}
}