Hello to all Users ...
I have a problem with this IC and configuration.
HW: STM32 and CS5460A as an measuring device.
(
https://www.farnell.com/datasheets/32393.pdf) from site 28 and 31 (3.8.7.2 DC Offset Calibration Sequence)
I can retrieve data from the ADs, the values correspond to the expected values.
As a result to a single AD shot , i get the Data_Ready bit without problems.
The different modes also work ... so the SPI is working without any problems.
But I can't get any further with the calibration of the IC. -> cs5460_calibrateACVoltageOffset()
If I shorted the 2 ADs for the offset-cal. then the loop does not come to the end , the Data_Ready bit does not switch to 1 ... the status-bytes are "0"
.
Does anyone have a tip or a solution for this?
cs5460.h:
// commands for calibrate control
#define CALIBRATE_CONTROL 0xC0
#define CALIBRATE_CURRENT 0x08
#define CALIBRATE_VOLTAGE 0x10
#define CALIBRATE_CURRENT_VOLTAGE 0x18 // both chan.
#define CALIBRATE_GAIN 0x02
#define CALIBRATE_OFFSET 0x01
#define POWER_UP_HALT_CONTROL 0xA0
#define DATA_READY (0x01L<<23)
cs5460.c:
unsigned int cs5460_getStatus()
{
return cs5460_readReg(STATUS_REGISTER);
}
void cs5460_clearStatus(uint32_t cmd)
{
cs5460_writeReg(STATUS_REGISTER, cmd);
}
void cs5460_calibrate(uint8_t cmd)
{
cmd = (CALIBRATE_CONTROL | cmd);
printf("start cal with mask %i ... \n",cmd);
printf("start with status ... %i \n",cs5460_getStatus());
cs5460_send(POWER_UP_HALT_CONTROL);
cs5460_clearStatus(DATA_READY);
printf("now in status ... %i \n",cs5460_getStatus());
cs5460_send(cmd);
delay_ms(1250);
while(!(cs5460_getStatus() & DATA_READY)) { printf("wait toooooooo long ... %i \n",cs5460_getStatus());
delay_ms(1000);
};
// wait until data ready;
cs5460_clearStatus(DATA_READY);
}
uint32_t cs5460_calibrateACVoltageOffset()
{
cs5460_calibrate(CALIBRATE_VOLTAGE | CALIBRATE_OFFSET);
return cs5460_readReg(VOLTAGE_AC_OFFSET_REGISTER);
}
uint32_t cs5460_calibrateDCVoltageOffset()
{
cs5460_calibrate(CALIBRATE_VOLTAGE | CALIBRATE_OFFSET);
return cs5460_readReg(VOLTAGE_DC_OFFSET_REGISTER);
}