EQADC in single scan mode

cancel
Showing results for 
Search instead for 
Did you mean: 

EQADC in single scan mode

62 Views
dineshmoka
Contributor III

hi the following below is my code for EQADC . i want to convert 5 channels at a time. when i am trying to execute in EQADC_CFCR SSE0 bit and SSE1 bit always taking 0 value even though i assigned 1 value to that bit. can you please verify and let me know the any errors in my code

void Init_ADC0(void){
EQADC_A.CFPR[0].R =0x80801001;
EQADC_A.CFCR0.R = 0x04100410;
EQADC_A.CFCR1.R = 0x04100410;
EQADC_A.CFCR2.R = 0x04100410;
while( EQADC_A.FISR[0].B.EOQFX != 1){
}
EQADC_A.FISR[0].B.EOQFX = 1;
}

void Send_Conv_Cmd(void){
EQADC_A.CFPR[0].R = 0x00001C00; /*conversion command: convert channel 28*/
EQADC_A.CFPR[1].R = 0x00101D00; /*conversion command: convert channel 29*/
EQADC_A.CFPR[2].R = 0x00201E00; /*conversion command: convert channel 30*/
EQADC_A.CFPR[3].R = 0x00301F00; /*conversion command: convert channel 30*/
EQADC_A.CFPR[4].R = 0x00402200; /*conversion command: convert channel 30*/
EQADC_A.CFPR[5].R = 0x80502A00; /*conversion command: convert channel 30*/
}

void Read_Result(void){

int Result,i;
float Result_Mv[3]={0};
while(EQADC_A.FISR[5].B.RFDFX != 1){
}
for(i=0;i<6;i++){
Result = EQADC_A.RFPR[i].R;
Result_Mv[i] = (uint32_t)((5000*Result)/0x3FFC);
}
EQADC_A.FISR[5].B.RFDFX = 1;
EQADC_A.FISR[5].B.EOQFX = 1;
}

0 Kudos
3 Replies

36 Views
dineshmoka
Contributor III

hi David, the following below is my code for EQADC which is using 5 channels

void Init_ADC0(void){
EQADC_A.CFPR[0].R = 0x00800201;
EQADC_A.CFPR[1].R = 0x82800201;
EQADC_A.CFCR0.R = 0x04100410;

EQADC_A.CFCR1.R = 0x04100410;
EQADC_B.CFCR2.R = 0x04100410;

while( EQADC_A.FISR[1].B.EOQFX != 1){
}
EQADC_A.FISR[1].B.EOQFX = 1;
}

 

void Send_Conv_Cmd(void){
EQADC_A.CFPR[0].R = 0x00000B00; /*conversion command: convert channel 11, buffer 0*/
EQADC_A.CFPR[1].R = 0x00100C00; /*conversion command: convert channel 12, buffer 1*/
EQADC_A.CFPR[2].R = 0x00200D00; /*conversion command: convert channel 13, buffer 2*/
EQADC_A.CFPR[3].R = 0x00300E00; /*conversion command: convert channel 14, buffer 3*/
EQADC_A.CFPR[4].R = 0x80400F00; /*conversion command: convert channel 15, buffer 4*/
EQADC_A.CFCR2.B.MODE4 = 1;
EQADC_A.CFCR2.B.SSE4 = 1;

while(EQADC_A.FISR[4].B.RFDFX != 1){
}

void Read_Result(void){

int Result=0,i;
float result_MV[5]={0};
for(i=0;i<5;i++){
Result = EQADC_A.RFPR[i].R;
result_MV[i] = (uint32_t)((5000*Result)/0x3FFC);
}
EQADC_A.FISR[4].B.RFDFX = 1;
EQADC_A.FISR[4].B.EOQFX = 1;
}

when i am using for single channel and 2 channels , i am getting the proper output. But when i am trying for 5 channels i am not getting output. can you please verify and let me suggest any solution? 

0 Kudos

17 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

It is because of CBuffer has 4 entries. Again, I would point out to mentioned example codes to see how to fill eQADC command by eDMA.

0 Kudos

52 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

I would recommend to see one of example in the list below I made for the purpose. Search for 'eQADC':

https://community.nxp.com/t5/MPC5xxx-Knowledge-Base/MPC5-software-example-list/ta-p/1102445

 

Hope it helps

 

 

0 Kudos