This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ADS1248: Calibration

Other Parts Discussed in Thread: ADS1248

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

  • Lukas,


    Just to make sure that I understand, you write 020202h in to the offset calibration registers, run the self offset calibration and then read back the offset calibration registers only to find that they haven't changed and are still 020202h?

    I don't see anything glaringly wrong in the code. The 62h is the proper command to run the self offset calibration and the resulting value should be moderately small. However, I don't do much coding and I could miss an error.

    The best way to check this would be to get an oscilloscope or logic analyzer to see what the device is receiving. I would first look to the data write to the offset calibration register. While you seem to be getting this correct, it helps to see the transaction and if there might be problems with noise or speed of SPI. Then I would try to capture the SELFOCAL command.

    How long is the time filter that you use to wait after the calibration command? What is the data rate and the oscillator clock frequency that you are using (or do you use the on-board clock)? There is an equation in the datasheet on page 32 discussing the calibration timing and it's possible that you are not waiting long enough before reading back the register.


    Joseph Wu