Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 21, 2024, 01:04:09 13:04


Login with username, password and session length


Pages: [1]
Print
Author Topic: CS5460 SW/HW problem  (Read 1008 times)
0 Members and 1 Guest are viewing this topic.
Hexer379
Newbie
*
Offline Offline

Posts: 16

Thank You
-Given: 21
-Receive: 0


« on: August 14, 2024, 08:15:23 08:15 »

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" Sad.
Does anyone have a tip or a solution for this?

Code:
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);
}
Logged
sam_des
Senior Member
****
Offline Offline

Posts: 256

Thank You
-Given: 128
-Receive: 151


« Reply #1 on: August 15, 2024, 05:54:06 17:54 »

Hi,

For both DC/AC offset calibration, you need to not just short, but ground both pins of ADC.
And you need to set Voltage/Current Gain registers to 1 & offset registers to 0, along-with stopping any on-going ADC conversions before starting calibration.
Check your Cycle Count register, AC calibration takes 6N+30 AD conversion cycles to complete, where N is value of cycle count.

Also there is App-note AN227, specifically for calibrating CS5460.

Hope that helps.

sam_des
Logged

Never be afraid to do something new. Remember Amateurs built the Ark, Professionals built the Titanic !
Hexer379
Newbie
*
Offline Offline

Posts: 16

Thank You
-Given: 21
-Receive: 0


« Reply #2 on: August 16, 2024, 06:56:38 06:56 »

Hi ,

THANK you very much !!!!
That was the problem ... set the registers and it works now !

Thomas ...
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC