Eqadc 8 bits ADC Resolution

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

Eqadc 8 bits ADC Resolution

1,256 Views
jorgeramon
Contributor II

In the configuration of the EQADC in the micro MPC5634 as I can change the resolution of the ADC to 8 bits. 

EQADC.CFPR[0].R = 0x80040C00;                        /* Conversion command: convert channel 12--->0C// 16 bits */
EQADC.CFCR[0].R = 0x0410;                            /* with ADC0, set EOQ, and send result to RFIFO 0 */

while (EQADC.FISR[0].B.RFDF != 1){}                           /* Wait for RFIFO 0's Drain Flag to set */
Tps = EQADC.RFPR[0].R;                                        /* ADC result */

TpsMv = (uint32_t)((5000*Tps)/0x3FFC);                   /* ADC result in milivolts */

EQADC.FISR[0].R = 0x10020000;

Thank you

5 Replies

1,000 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

If I understand well you want to change resolution to 8-bit.

It can be done by choosing Conversion Command Format for Alternate Configurations, it the such one having 0x08-0x0F on LSB place.

pastedImage_2.png

For instance 0x08 choose Alternate configuration 1 that is related to ADC_ACR1 register

pastedImage_1.png

I would recommend to see following example code:

Example MPC5674F eQADC+eDMA Single_Scan CW210 

 

I am using there header file called eQADC_macros_MONACO.h which you possibly simplify you configuration.

 

For instance mentioned example uses following command queue

 

// Conversion Command Queue 0

uint32_t CQueue_0[] =

{

    ( CHANNEL(0)  | B0 | MESSAGE_TAG(RFIFO0)       ),

    ( CHANNEL(1)  | B1 | MESSAGE_TAG(RFIFO0) | EOQ )

};

In you case it would like this

 

// Conversion Command Queue 0

uint32_t CQueue_0[] =

{

    ( ALT_CONFIG_SEL(ALT_CONF_1) | CHANNEL(0)  | MESSAGE_TAG(RFIFO0)       ),

    ( ALT_CONFIG_SEL(ALT_CONF_1) | CHANNEL(1)  | MESSAGE_TAG(RFIFO0) | EOQ ),

};

It is not all necessary changes but I hope it helps a bit.

One yet note about result format (as it be possibly confusing) - it is basically placed in the middle of result register like in this examples :

pastedImage_1.png

874 Views
berat24
Contributor III

What is the resolution of eQADC in standart configuration? @davidtosenovjan 

0 Kudos

856 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

No, 12-bit is a standard configuration.

0 Kudos

1,000 Views
jorgeramon
Contributor II

thanks for answering

I change it in Alternate configuration 0x08 but the values I get remain the same as 14 bits as the image.

pastedImage_1.png

I have the code as well.

pastedImage_2.png

pastedImage_3.png

pastedImage_4.png

Does not change to 8bit

It is better a resolution of 14 bits as the one I get or 8 bits is for the calculation of the times of injection of a motor

0 Kudos

1,000 Views
davidtosenovjan
NXP TechSupport
NXP TechSupport

It is needed to mask results as I depicted by red color. otherwise you have just 14-bit result but never 14-bit accuracy.

The only reason for choosing 10/8bit is shorter conversion time by one/two adc cycles.

pastedImage_1.png

0 Kudos