MKM34Z256VLL7 ADC conversion

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

MKM34Z256VLL7 ADC conversion

882 Views
davidmalovrh
Contributor I

We are using Kinetis MKM34Z256VLL7 device. AFE is set to software trigger continuous conversion mode. XBAR is used to trigger PDB with AFE COCO and the ADC conversion result is read in AFE callback. After about half a minute conversion results from ADC freezes although the AFE COCO interrupt is still occurring. Code and settings are from example DRM162 - Three Phase Power Meter Reference Design (REV0) from 2015. What could be wrong?

Labels (1)
0 Kudos
2 Replies

508 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, David,

I suppose that the PDB module has error, As you know that the example uses two ADC converter:SD-AFE and SAR ADC, can you enter the SAR-ADC interrupt? if you can not, pls check the PDB0_CHnS, I suppose that the PDB has error, PDB can not trigger SAR ADC.

If it is PDB error, you can consider the solution as martin said.

Hope it can help you.

BR

Xiangjun rong

0 Kudos

508 Views
MarMi
NXP Employee
NXP Employee

Hello David,

The problem is probably caused by the big phase shift between voltage and current (the calibration value ramcfg.delayX is to big).

 

You can try change constant in the file “mk32z256_3ph.h”

 

#define ASD_L1M        0

#define ASD_L1M        4

#define ASD_L1M        8

 

But the best way should by to use the SW phase shift compensation method. You should by phased PDB, so to directly connect SD to SAR

 

/* AFE module                                                               */

  SIM_SelAfePllClk (SIM_MCG_PLL_CLK);

  AFE_ChInit (CH0,

                AFE_CH_SWTRG_CCM_PGAOFF_CONFIG(DEC_OSR1024),

                (0 * SAR_SCT),

                PRI_LVL0,

                (AFE_CH_CALLBACK)afech0_callback);

  AFE_ChInit (CH1,

                AFE_CH_SWTRG_CCM_PGAOFF_CONFIG(DEC_OSR1024),

                (1 * SAR_SCT),

                PRI_LVL0,

                (AFE_CH_CALLBACK)afech1_callback);

  AFE_ChInit (CH2,

                AFE_CH_SWTRG_CCM_PGAOFF_CONFIG(DEC_OSR1024),

                (2 * SAR_SCT),

                PRI_LVL0,

                (AFE_CH_CALLBACK)afech2_callback);

  AFE_Init      (AFE_MODULE_RJFORMAT_CONFIG(AFE_PLL_CLK, AFE_DIV2, AFE_CLK)); 

  

  /* ADC module   */

  ADC_Init      (ADC_MODULE_DIV4_16B_HWTRG_IREF_CONFIG,

                 HWAVG_OFF,

                 ADC_CH_SE_POLL_CONFIG(ADC_SE0),

                 ADC_CH_SE_POLL_CONFIG(ADC_SE1),

                 ADC_CH_SE_POLL_CONFIG(ADC_SE2),

                 ADC_CH_DISABLE_CONFIG,

                 PRI_LVL0,

                 (ADC_CALLBACK)NULL);

 

  /* SD to SAR connection                                                     */

  XBAR_Path     (XBAR_AFE0COC, XBAR_ADCTRGCHA);              // SAR start triger

  XBAR_Path     (XBAR_AFE1COC, XBAR_ADCTRGCHB);              // SAR start triger

  XBAR_Path     (XBAR_AFE2COC, XBAR_ADCTRGCHC);              // SAR start triger

 

And calculate phase shift by the library function

 

rotation = METERLIB3PH_ProcSamples(&mlib,u24_samplePh1,i24_samplePh1,u24_samplePh2,

                                        i24_samplePh2,u24_samplePh3,i24_samplePh3,shift);

 

where the “shift” is defined

 

static frac16  shift[] = { METERLIB_DEG2SH(-5.5, 50.0),

                           METERLIB_DEG2SH(-5.5, 50.0),

                           METERLIB_DEG2SH(-5.5, 50.0) };

 

Where “-5.5” is angle for compensation and “50” is nominal line frequency….

 

Regards Lukas

0 Kudos