Hi
I'm trying to communicate with a ADS1256 from my TM4C123.
I try to write the DRATE register and I want to read it back in order to make sure the command works.
Unfortunately I always get back 4 bytes and the value changes each time.
Has someone already tried to use this chip?
SPI works on other sensors:
SSIConfigSetExpClk(SSI0_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 1000000, 8);
SSIEnable(SSI0_BASE);
Here my init code
Optimization is off.
int i;
GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_0, GPIO_PIN_0);//CS up
GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_0, 0);//CS down
//Empty Input buffer
uint32_t data[2];
while(SSIDataGetNonBlocking(SSI0_BASE, &data[0])){}
//reset ADS1256
SSIDataPut(SSI0_BASE, 0b11111110);
while(SSIBusy(SSI0_BASE))
{
}
for(i=0; i<1000;i++);
//SDATAC Stop continous reading
SSIDataPut(SSI0_BASE, 0b00001111);
while(SSIBusy(SSI0_BASE))
{
}
for(i=0; i<1000;i++);
//WREG DRATE
SSIDataPut(SSI0_BASE, 0x53);
while(SSIBusy(SSI0_BASE))
{
}
SSIDataPut(SSI0_BASE, 0x00);
while(SSIBusy(SSI0_BASE))
{
}
SSIDataPut(SSI0_BASE, 0xC0);
while(SSIBusy(SSI0_BASE))
{
}
for(i=0; i<1000;i++);
//WREG MUX
SSIDataPut(SSI0_BASE, 0x51);
while(SSIBusy(SSI0_BASE))
{
}
SSIDataPut(SSI0_BASE, 0x00);
while(SSIBusy(SSI0_BASE))
{
}
SSIDataPut(SSI0_BASE, 0x01);
while(SSIBusy(SSI0_BASE))
{
}
for(i=0; i<1000;i++);
//RREG DRATE
SSIDataPut(SSI0_BASE, 0x13);
while(SSIBusy(SSI0_BASE))
{
}
SSIDataPut(SSI0_BASE, 0x00);
while(SSIBusy(SSI0_BASE))
{
}
//wait 12.5us min 6us
for(i=0; i<1000;i++);
SSIDataGet(SSI0_BASE, &data[0]);
GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_0, GPIO_PIN_0);//CSLens up