Hello all,
I have two Problems.
I use an ADS1192 with an ArmSAM4E. My problem is the initialization of the ADS1192. I wrote a function for this but there is an issue.
1. problem
I ‘m able to set different sample rates with the "init" function. The DRDY – Pin toggles correctly.
But I can't change the gain or the MUX-register for channels. If the device starts in default mode it works fine. I can read the data out and see a externally applied sinus 20mVpp on channel 1 with gain 6.
If the ADS is initialized using my function the ADS data output stays at zero. It seems like the RDATAC Command at the End of the init fails.
2. problem
Can you explain please how the Command ADS1192_OFFSETCAL should be used. There are no detailed info’s in the data sheet.
SPI Clock 500kHz
SPI Mode: Data on falling edge
void init_ADS1192(void)
{
NVIC_DisableIRQ(PIOA_IRQn); // disable DRDY-PIN Interrupt
ADS1192_RESET_low;
wait_us(20); // wait µsek
ADS1192_RESET_high; // reset device
ADS1192_CS_low; // SPI CS low
wait_us(3); // wait µsek
send_Com_ADS1192(ADS1192_SDATAC); // change to SingleShot Mode (register unlocked for changing)
wait_us(20);
send_Com_ADS1192(WREG_MASK | CONFIG1);
wait_us(5);
send_Com_ADS1192(0x0A); // write 11 register
wait_us(5);
send_Com_ADS1192(SPS1000); // Config 1
wait_us(5);
send_Com_ADS1192(Bit7_must_SET ); // Config 2
wait_us(5);
send_Com_ADS1192(0x10); // LOFF - default
wait_us(5);
send_Com_ADS1192(Normal_Operation | Gain2 | MUX_normal); // CH1SET
wait_us(5);
send_Com_ADS1192(Normal_Operation | Gain2 | MUX_normal); // CH2SET
wait_us(5);
send_Com_ADS1192(0x00); // RLD_SENS - default
wait_us(5);
send_Com_ADS1192(0x00); // LOSS_SENS - default
wait_us(5);
send_Com_ADS1192(0x00); // LOFF_STAT - default
wait_us(5);
send_Com_ADS1192(0x02); // MISC1 - default
wait_us(5);
send_Com_ADS1192(0x80); // MISC2 - OffsetCal is on
wait_us(5);
send_Com_ADS1192(0x00); // GPIO - default
wait_us(5);
send_Com_ADS1192(ADS1192_OFFSETCAL); // after set gain must send ?????
wait_us(20); // how long???
ADS1192_START_high; // Startpin high
wait_us(3);
send_Com_ADS1192(ADS1192_RDATAC); // change to Continous Mode
wait_us(20);
ADS1192_CS_high; // SPI CS High
NVIC_EnableIRQ(PIOA_IRQn); // enable DRDY-PIN Interrupt
}
Best regards
Patrick