MKM34 ADC

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

MKM34 ADC

1,774 Views
dhruvonline
Contributor III

Hi Everyone,

I have designed the board with MKM34 Device(64-LQFP). I wanted to measure the AD0 to AD6 Channels simultaneously. The sensing inputs are connected to the channels directly. I am unable to find the example for the multiple channels scanning. Could anyone suggest me to configure the device for ADC triggering? I have to use the on-chip crystal for the above measurement. 

Looking for your valuable suggestions and example for the same. Please suggest..

Thanks&Regards, 

Dhruv 

Tags (1)
9 Replies

834 Views
MarMi
NXP Employee
NXP Employee

Hi Druv,

SAR ADC on MKM34 can perform up to four sequential conversions triggered by hardware (not simultaneous). Simultaneous conversion can be done only using SD ADC. If you want to trigger SAR ADC sequential conversion(s), you can use QuadTimer channel(s). For example, triggering SAR ADC from SD ADC is explained in this thread: MKM34Z256VLL7 ADC conversion.

Kind regards,

Martin M.

0 Kudos

834 Views
dhruvonline
Contributor III

Hi Martin,

Thanks for the support.

I have to measure the All the channels. There are no additional trigger signals available to trigger the channel. I have to use the SW_triggering. We have to measure the all the sensing signals(Temperatures) from all the channels serially or sequentially. I have referred the code shared by you. 

I have modified the code in that project as given below.

ADC_Init (ADC_MODULE_16B_SWTRG_XREF_CONFIG,
HWAVG_32,
ADC_CH_SE_POLL_CONFIG(AD7),
ADC_CH_SE_POLL_CONFIG(AD8),
ADC_CH_SE_POLL_CONFIG(AD9),
ADC_CH_SE_IRQ_CONFIG (AD10),
PRI_LVL0, (ADC_CALLBACK)adc_callback);

But I am not getting the output. Could you please suggest the changes required. Please suggest the suitable flow or code for that. 

Thanks,

Druv

0 Kudos

834 Views
MarMi
NXP Employee
NXP Employee

Hi Druv,

for measuring five or more channels you need to trigger conversions in software. I have attached adc_test.c example from bare metal drivers package that shows way of triggering conversion in software. For measuring more channels, you need to Start, Check completeness and Read conversion for each channel in a sequence as follows:

ADC_Start(CHA, AD7);
while(!ADC_Ready(CHA));
value_1 = ADC_Read(CHA);

ADC_Start(CHA, AD8);
while(!ADC_Ready(CHA));
value_2 = ADC_Read(CHA);

...

Kind regards,

Martin M.

834 Views
dhruvonline
Contributor III

Hi Martin,

Now I am getting the result with all the channels. But it's polling method. How to add interrupt based measurement with all the 5 channels.

Thanks, 

Druv

834 Views
MarMi
NXP Employee
NXP Employee

Hi Druv,

look at attached simple example.

Kind regards,

Martin M.

834 Views
dhruvonline
Contributor III

Hi Martin,

How to add DMA support with the given example.

Regards

Druv

0 Kudos

834 Views
MarMi
NXP Employee
NXP Employee

Hi Druv,

it doesn't make sense to use DMA in case when software need to jump to interrupt to start conversion on new channel. If you want optimize your use-case to lower power consumption you should consider two DMA transfers:

1) First to be triggered by PIT and used to kick off new conversion by loading ADC_SC1A register with new channel number; PIT trigger frequency will define ADC conversion rate.

2) Second to be triggered by ADC end of conversion to store result of conversion in a memory table.  

There are couple of DMA examples in: Kinetis M bare-metal drivers and software examples released - REV 4.1.6. Please refer to refman.html, Section DMA examples.

Kind regards,

Martin M.

0 Kudos

834 Views
dhruvonline
Contributor III

Hi Martin,

OK. I will check and add it.

Regards,

Druv

0 Kudos

834 Views
dhruvonline
Contributor III

Hi Martin,

It's working with my board. Thanks for the support.

Regards,

Druv

0 Kudos