Hello,
I have installed the ADS1248 in my system as shown:
It is only used for reading voltages and temperatures via the internal sensor. Reading voltages works okay so far, the only problem is the self-calibration. Apparently it does not work, when I hard-code the offset register before (in this case for example with 0x02, just to check if it is changing):
#define SELFOCAL 0x62 write_register(fd, OFC0, 0x02); write_register(fd, OFC1, 0x02); write_register(fd, OFC2, 0x02); self_off_calibration(fd, sps); printf("OFC0_after_cal: %02x\n",read_register(fd, OFC0)); printf("OFC1_after_cal: %02x\n",read_register(fd, OFC1)); printf("OFC2_after_cal: %02x\n",read_register(fd, OFC2)); static void self_off_calibration(int fd, uint32_t sps) { uint8_t tx[] = {SELFOCAL, }; spitransfer(fd, tx, NULL); time_filter(sps, 'c');
} static void write_register(int fd, uint8_t addr, uint8_t value) { uint8_t tx[] = {WREG|addr, 0x00, value, }; spitransfer(fd, tx, NULL); } static uint8_t read_register(int fd, uint8_t addr) { uint8_t tx[] = {RREG|addr, 0x00, NOP}; uint8_t rx[] = {0xFE, 0XFE, 0xFE}; uint8_t hex; int i; spitransfer(fd, tx, rx); hex = rx[2]; return hex; }
time_filter is just a delay function.
The output of the offset registers stays always 0x02, even though it should have been over-written.
Did I maybe forget anything regarding the self-calibration?
Thanks in advance,
Lukas