Forum: Mikrocontroller und Digitale Elektronik CS5460 Calibration Mode


von Thomas (thomashx)


Lesenswert?

Hallo an alle ...

Ich habe hier ein kleines Problem , bei dem ich nicht weiter komme .

HW: STM32 mit CS5460A für ein Messgerät . 
(https://www.farnell.com/datasheets/32393.pdf) Ab Seite 28 und 31 
(3.8.7.2 DC Offset Calibration Sequence)

Ich komme da nicht weiter bei der Kalibrierung des ICs.
Ich kann Daten der ADs abholen , die Werte entsprechen dem erwartbaren.
Auch die verschiedenen Modi funktionieren ... die SPI funktioniert also 
problemlos.

wenn ich aber die 2 ADs kurzschliesse für die OffSet-kal. dann kommt die 
Schleife nicht zum Ende , das Data_Ready bit kommt nicht :-( .
Hat dazu jemand einen Tip ?
1
cs5460.h:
2
// commands for calibrate control
3
#define CALIBRATE_CONTROL    0xC0
4
#define CALIBRATE_CURRENT    0x08
5
#define CALIBRATE_VOLTAGE    0x10
6
#define CALIBRATE_CURRENT_VOLTAGE  0x18    // both chan.
7
#define CALIBRATE_GAIN      0x02
8
#define CALIBRATE_OFFSET    0x01
9
10
#define POWER_UP_HALT_CONTROL    0xA0
11
#define DATA_READY      (0x01L<<23)
12
13
cs5460.c:
14
unsigned int cs5460_getStatus()
15
{
16
  return cs5460_readReg(STATUS_REGISTER);
17
}
18
19
void cs5460_clearStatus(uint32_t cmd)
20
{
21
  cs5460_writeReg(STATUS_REGISTER, cmd);
22
}
23
void cs5460_calibrate(uint8_t cmd)
24
{
25
  cmd = (CALIBRATE_CONTROL | cmd);
26
  printf("start cal with mask %i ... \n",cmd);
27
28
  printf("start with status ... %i \n",cs5460_getStatus());
29
  cs5460_send(POWER_UP_HALT_CONTROL);
30
  cs5460_clearStatus(DATA_READY);
31
  printf("now in status ... %i \n",cs5460_getStatus());
32
33
  cs5460_send(cmd);
34
delay_ms(1250);                
35
  while(!(cs5460_getStatus() & DATA_READY)) {    printf("wait toooooooo long ... %i \n",cs5460_getStatus());
36
  delay_ms(1000);
37
  };
38
  // wait until data ready;
39
  cs5460_clearStatus(DATA_READY);
40
}
41
uint32_t cs5460_calibrateACVoltageOffset()
42
{
43
  cs5460_calibrate(CALIBRATE_VOLTAGE | CALIBRATE_OFFSET);
44
  return cs5460_readReg(VOLTAGE_AC_OFFSET_REGISTER);
45
}
46
uint32_t cs5460_calibrateDCVoltageOffset()
47
{
48
  cs5460_calibrate(CALIBRATE_VOLTAGE | CALIBRATE_OFFSET);
49
  return cs5460_readReg(VOLTAGE_DC_OFFSET_REGISTER);
50
}

: Verschoben durch Moderator
Beitrag #7719519 wurde von einem Moderator gelöscht.
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.