Other Parts Discussed in Thread: TM4C129ENCPDT
Hi,
I am just a beginner to the SPI protocol, I am trying to program TM4C controller using CCS IDE and EK-TM4C129-EXL Board to interface the ADS1220 ADC. I have tested SPI interface in loop back and it is happening, The configurations i have used for spi and communicating to ADC is listed below, register read back is not happening from the ADC, I request you for some help to troubleshoot the issue.
Thank you
////////////////////////////////////////////////////////////////////////////////////////////////////////// SPI configuration
Interrupt_flag = 0xFF; // set flag initially
#if defined(TARGET_IS_TM4C129_RA0) || \
defined(TARGET_IS_TM4C129_RA1) || \
defined(TARGET_IS_TM4C129_RA2)
#endif
ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
SYSCTL_OSC_MAIN |
SYSCTL_USE_PLL |
SYSCTL_CFG_VCO_480), 120000000); // Set the clocking to run directly from the crystal at 120MHz.
SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
GPIOPinConfigure(GPIO_PA2_SSI0CLK);
GPIOPinConfigure(GPIO_PA3_SSI0FSS);
GPIOPinConfigure(GPIO_PA4_SSI0XDAT0);
GPIOPinConfigure(GPIO_PA5_SSI0XDAT1);
GPIOPinTypeGPIOInput(GPIO_PORTA_BASE, GPIO_PIN_6 ); // Interrupt
GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_5 | GPIO_PIN_4 | GPIO_PIN_3 |
GPIO_PIN_2);
#if defined(TARGET_IS_TM4C129_RA0) || \
defined(TARGET_IS_TM4C129_RA1) || \
defined(TARGET_IS_TM4C129_RA2)
SSIConfigSetExpClk(SSI0_BASE, ui32SysClock, SSI_FRF_MOTO_MODE_1,
SSI_MODE_MASTER, 1000000, 8);
#else
SSIConfigSetExpClk(SSI0_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_1,
SSI_MODE_MASTER, 1000000, 8);
#endif
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////// ADC configuration
SSIEnable(SSI0_BASE);
SSIDataPut(SSI0_BASE, ADC_Reset); // Resetting the ADC
Delay_ms(1); // definite delay
pui32DataTx[0] = 0x43; // WREG command to write register
pui32DataTx[1] = 0x01; // Register0 data value
pui32DataTx[2] = 0xD4; // Register1 data value
pui32DataTx[3] = 0x00; // Register2 data value
pui32DataTx[4] = 0x00; // Register3 data value
for(ui32Index = 0; ui32Index < 5; ui32Index++)
{
SSIDataPut(SSI0_BASE, pui32DataTx[ui32Index]);
}
while(SSIBusy(SSI0_BASE))
{
}
Delay_ms(1);
SSIDataPut(SSI0_BASE, 0x23); // Read register
while(SSIBusy(SSI0_BASE))
{
}
for(ui32Index = 0; ui32Index < 4; ui32Index++)
{
SSIDataGet(SSI0_BASE, &pui32DataRx[ui32Index]);
pui32DataRx[ui32Index] &= 0x00FF;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////