MPC5744p ADC calibration fail

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MPC5744p ADC calibration fail

1,096 Views
chaifelix
Contributor I

I try to test ADC calibration function, but when calibration over, the ADC_CALBISTREG.TEST_FAIL is set.

I don't know why. The following is source code.

 

p_ADC->MCR.B.PWDN = 1;
while(p_ADC->MSR.B.ADCSTATUS != 1); /* wait for powerdown */

p_ADC->MCR.B.ADCLKSEL = 0; /* ADC clock frequency is half of bus clock */
p_ADC->CALBISTREG.R = CAL_HIGH_ACCURACY_MODE | CAL_22_CYCLES | CAL_512_SAMPLES | CAL_AVAG_EN | CAL_TEST_FAIL_CLEAR;

p_ADC->MCR.B.PWDN = 0; /* power up */
while(p_ADC->MSR.B.ADCSTATUS != 0); /* wait for power up */

p_ADC->CALBISTREG.B.TEST_EN = 1; /* enable calibration */

/* wait for calibration complete, MSR.ADCSTATUS or CALBISTREG.C_T_BUSY */
while(p_ADC->CALBISTREG.B.C_T_BUSY){
;
}
/* get calibration result */
cal_result = p_ADC->CALBISTREG.B.TEST_FAIL;

Labels (1)
Tags (1)
0 Kudos
Reply
1 Reply

699 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

Hi, I haven’t tried it yet, but the sequence mentioned in section “36.5.10.1 Calibration (High Accuracy mode)” says little bit different sequence:

  1. Configure the ADC to 40 MHz.
  • Put the ADC in power down mode: set MCR[PWDN]
  • Configure clock divider selection: reset MCR[ADCLKSEL]
  • Power-up the ADC: reset MCR[PWDN]
  1. Configure the Calibration, BIST Control, and Status Register (CALBISTREG). The

default values are set for maximum accuracy (recommended).

  1. Start calibration: set CALBISTREG[TEST_EN].
  2. Wait for calibration to complete. Check MSR[ADCSTATUS] or till

CALBISTREG[C_T_BUSY] becomes 0.

  1. Check the value of MSR[CALIBRTD] to determine whether calibration was

successful.

  1. If MSR[CALIBRTD] = 1, calibration was successful; otherwise, it failed, and

CALBISTREG[TEST_FAIL] = 1.

  1. If required, reconfigure the ADC clock frequency for normal operation.

 

This sequence first do power-up of the ADC and in next step it configures CALBISTREG. It would be good to check it.

 

RM say that:

“The calibration routine sets the fail flag (CALBISTREG[TEST_FAIL]) to indicate:

  • A fault in ADC
  • A premature abort of the calibration

 

Calibration is aborted if a normal conversion is initiated during calibration; this is called

premature termination. The terminating conversion and the immediate next one to it will

have invalid result in this case.”

 

Conversions without calibration works fine to you or not?

0 Kudos
Reply