AnsweredAssumed Answered

read single a/d channel on MPC5567

Question asked by Vance Neff on Apr 17, 2014
Latest reply on Apr 28, 2014 by Vance Neff



I must be missing something obvious.

We have a device that we have been using for quite a while and I'm trying to add the capability to read one of 16 a/d channels.

This is a multi-layered board with a 416 pin MPC5567; so, can't verify that the voltage signal is Actually getting to the processor.  But it was laid out with that in mind and I have verified that the signal I am trying to measure does exist at some point on the printed circuit board.


Here is my, very simple, code, mostly from the simple cookbook example:


EQADC.CFPR[0].R = 0x80800B01;           /* Send CFIFO 0 a ADC0 configuration command */
                                            /* enable ADC0 & sets prescaler= divide by 24*/
                                            /* assuming system clock = 132 Mhz*/
                                            /*  and target A/D clock to be < 6 Mhz */
EQADC.CFCR[0].R = 0x0410;               /* Trigger CFIFO 0 using Single Scan SW mode */
while (EQADC.FISR[0].B.EOQF != 1);
EQADC.FISR[0].B.EOQF = 1;               /* Clear End Of Queue flag */


EQADC.CFPR[0].R = 0x80000000 + ((channel_number & 0x0F)<<8);
                                            /* Conversion command: convert channel n */
                                            /* with ADC0, set EOQ, and send result to RFIFO 0*/
EQADC.CFCR[0].R = 0x0410;               /* Trigger CFIFO 0 using Single Scan SW mode */
// wait for and read result
while (EQADC.FISR[0].B.RFDF != 1);      /* Wait for RFIFO 0's Drain Flag to set*/
result = EQADC.RFPR[0].R;               /* ADC result */

//  result = (uint32_t)((5000*result)/0x3FFC);  /* ADC result in millivolts */

EQADC.FISR[0].B.RFDF = 1;               /* Clear RFIFO 0's Drain Flag */
EQADC.FISR[0].B.EOQF = 1;               /* Clear CFIFO's End of Queue flag */


please excuse the formatting, I haven't figure how to use the controls on this forum submission.


The symptoms are the result changes randomly when the voltage remains constant and the result does not have any relation to the voltage when I double it.



What have I overlooked?