how to use three adc in MK60F120

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

how to use three adc in MK60F120

776 Views
qinchenghu
Contributor I

now ,i have developed a board based on MK 60F120, in my board,i want to use ADC1,ADC2 and ADC3, total is 6 channel ADCs with PDB trigle it . when i configure only one ADC with two channels,they work well, but when i configured all the six channel ,only the two channels based on ADC1 is working well,the other four channels can work no more than 100 circles. when system reset,i can read data some times,the read function  returned with 0. i can not get any data.

0 Kudos
3 Replies

483 Views
soledad
NXP Employee
NXP Employee

Hi qin chenghu,

Please check the below threads:

How to add channels in mqx adc example?

Re: A/D Driver Unable to Open Channel


Have a great day,
Sol

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

483 Views
qinchenghu
Contributor I

thanks soledad,

     now ,the there adcs with six channel is working,but some of the adc results is lost,

in my project the adc period is 625us, with a 20ms PIT interrupt ISR,i read the ADC result,most of time, the read return is 32 results,but some times,the read return is 31 results,that is to say ,on result is lost.

my configuration is show below:

const ADC_INIT_CHANNEL_STRUCT adc3ch1_channel_param =

{

    ADC3_SOURCE_AD17, /* physical ADC channel */

    ADC_CHANNEL_MEASURE_LOOP | ADC_CHANNEL_START_TRIGGERED, /* runs continuously after IOCTL trigger */

    1,             /* number of samples in one run sequence */

    0,              /* time offset from trigger point in us */

    625,         /* period in us (= 625us ) */

    0x10000,        /* scale range of result (not used now) */

    ADC_BUFFER_SIZE,             /* circular buffer size (sample count) */

    MY_TRIGGER,     /* logical trigger ID that starts this ADC channel */

#if MQX_USE_LWEVENTS

//     &evn,

//     0x01            /* mask of event to be set */

  NULL

#endif

};

const ADC_INIT_CHANNEL_STRUCT adc3ch1_channel_param =

{

    ADC3_SOURCE_AD16, /* physical ADC channel */

    ADC_CHANNEL_MEASURE_LOOP | ADC_CHANNEL_START_TRIGGERED, /* runs continuously after IOCTL trigger */

    1,             /* number of samples in one run sequence */

    300,              /* time offset from trigger point in us */

    625,         /* period in us (= 625us ) */

    0x10000,        /* scale range of result (not used now) */

    ADC_BUFFER_SIZE,             /* circular buffer size (sample count) */

    MY_TRIGGER,     /* logical trigger ID that starts this ADC channel */

#if MQX_USE_LWEVENTS

//     &evn,

//     0x01            /* mask of event to be set */

  NULL

#endif

};

0 Kudos

483 Views
qinchenghu
Contributor I

what is the reason for this problem?

0 Kudos