Other Parts Discussed in Thread: EK-TM4C1294XL
Tool/software: Code Composer Studio
I have a TM4C129 which has sensors that I am trying to read from. I cannot read any other pins than the ones I used below in the code. In the code below, I am keep reading from temp. sensor. I do not need to write anything to MOSI. All I am trying to do is clocking and reading from the sensor.
But I cannot get the reading for some reason. Not sure what I am missing in the code. I have checked other examples (ti_master.c etc) There is nothing different than my code. Any idea what am I missing?
Thanks.
uint32_t ui32SysClock = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_OSC), 25000000); void init_sensor(void) { SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0); while (!SysCtlPeripheralReady(SYSCTL_PERIPH_SSI0)) ; SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); while (!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOA)) ; SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOH); while (!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOH)) ; GPIOPinTypeGPIOOutput(GPIO_PORTH_BASE, GPIO_PIN_0); // CS as output GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_2); // CLK as output GPIOPinTypeGPIOInput(GPIO_PORTA_BASE, GPIO_PIN_5); // MISO as output GPIOPinConfigure(GPIO_PA2_SSI0CLK); //CLK GPIOPinConfigure(GPIO_PA5_SSI0XDAT1); //MISO GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_5 | GPIO_PIN_2); SSIConfigSetExpClk(SSI0_BASE, ui32SysClock, SSI_FRF_MOTO_MODE_3, SSI_MODE_MASTER, 1000000, 8); SSIEnable(SSI0_BASE); } void read_sensor(void){ while (SSIBusy(SSI0_BASE)) ; SSIDataGet(SSI0_BASE, &dataRx[0]); } int main(void) { while(1){ read_sensor(); } }