[update] PhaseParaA to 2 Bytes

This commit is contained in:
Taylor Liao
2021-09-01 22:35:27 +08:00
parent f57397cb38
commit 4d7f3054b1
4 changed files with 27 additions and 14 deletions
@@ -692,16 +692,16 @@ static void AutoGainChangeVin(int32_t RealVin){
//EIS Function//
static int32_t read_LPTIA_Iin(){
static int32_t dftdat, Iin;
dftdat = neg_18bit(ReadRealZ()) + 4242;
dftdat = neg_18bit(ReadRealZ()) + 4140;
if (instru.ADCGainLv == 0) {
Iin = -(dftdat * 867 + 256) / 512.1 / 0.038;
Iin = -(0.867 * dftdat * 1000 + 256) / 512.1 / 0.033;
}
else if (instru.ADCGainLv == 1) {
Iin = - (dftdat * 1086 + 6)/ 12.1 / 2.7;
Iin = - ((dftdat + dftdat * 0.086) * 1000 + 6)/ 12.1 / 1.75;
}
else if (instru.ADCGainLv == 2) {
Iin = - (dftdat * 1040 + 2) / 4.1 / 7.49;
Iin = - ((dftdat + dftdat * 0.04) * 1000 + 2) / 4.1 / 5.43;
}
else if (instru.ADCGainLv == 3 || instru.ADCGainLv == 4) {
Iin = - (dftdat * 1000 + 105) / 210 / 0.102;
@@ -1230,7 +1230,7 @@ static void SetSamplingTime(uint32_t freq){
BpSINC3(1);
SetADCDataRate(ADC800Ksps);
SetSinc2OSR(Sinc2OSR533);
SetDFTNUM(DFTNUM1024);
SetDFTNUM(DFTNUM2048);
// select_REG(0x2044); //0x2044
// w32_REG(0x00000311); //ADC data rate = 800KHz | SINC2 89 | SINC3 5
@@ -161,7 +161,7 @@ static uint32_t CalcDelayTime(uint32_t freq){
// 10Hz
else if (freq >= 1000) {
decadeSamplingTime = 20000;
decadeSamplingTime = 13645;
}
// 1Hz
@@ -25,9 +25,10 @@ static void SendCaliValue(void) {
cali_buf[index++] = (uint8_t) CaliTable.PhaseParaA & 0xFF;
cali_buf[index++] = (uint8_t) (CaliTable.PhaseParaB >> 8) & 0xFF;
cali_buf[index++] = (uint8_t) CaliTable.PhaseParaB & 0xFF;
cali_buf[index++] = (uint8_t) (CaliTable.HSRTIA200R >> 8) & 0xFF;
// cali_buf[index++] = (uint8_t) (CaliTable.HSRTIA200R >> 8) & 0xFF;
cali_buf[index++] = (uint8_t) CaliTable.HSRTIA200R & 0xFF;
cali_buf[index++] = (uint8_t) (CaliTable.HSRTIA5K >> 8) & 0xFF;
@@ -1,7 +1,7 @@
#ifndef EIS_CALI_TABLE
#define EIS_CALI_TABLE
#define BOARD_A4_DA_32_D4_ED_BF
#define BOARD_A4_DA_32_D4_E7_D2
//typedef struct _EISCali{
// uint32_t CutoffFreq;
@@ -17,9 +17,9 @@
struct _CaliTable{
char DeviceName[25];
uint32_t CutoffFreq;
int32_t PhaseParaA;
int32_t PhaseParaB;
uint16_t HSRTIA200R;
uint8_t PhaseParaA;
int16_t PhaseParaB;
uint8_t HSRTIA200R;
uint16_t HSRTIA5K;
uint16_t HSRTIA20K;
uint32_t HSRTIA160K;
@@ -28,9 +28,9 @@ struct _CaliTable{
#ifdef BOARD_TEST
{
.DeviceName = "BOARD_TEST",
.CutoffFreq = 70000,
.CutoffFreq = 250000,
.PhaseParaA = 1500,
.PhaseParaB = 90000,
.PhaseParaB = -90,
.HSRTIA200R = 200,
.HSRTIA5K = 5000,
.HSRTIA20K = 20000,
@@ -53,7 +53,7 @@ struct _CaliTable{
{
.DeviceName = "BOARD_A4_DA_32_D4_ED_BF",
.CutoffFreq = 85600,
.PhaseParaA = 18, //1e6
.PhaseParaA = 15, //1e6
.PhaseParaB = -83, //1e3
.HSRTIA200R = 200,
.HSRTIA5K = 5100,
@@ -61,6 +61,18 @@ struct _CaliTable{
.HSRTIA160K = 160000
};
#elif defined(BOARD_A4_DA_32_D4_E7_D2)
{
.DeviceName = "BOARD_A4_DA_32_D4_E7_D2",
.CutoffFreq = 265000,
.PhaseParaA = 14, //1e6
.PhaseParaB = -8726, //1e2
.HSRTIA200R = 200,
.HSRTIA5K = 5000,
.HSRTIA20K = 20000,
.HSRTIA160K = 160000
};
#endif
#endif