Initialisation ADC channels in MQX

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

Initialisation ADC channels in MQX

537 Views
utsavikalpesh
Contributor V

Hi,

I am working with CodeWarrior v10.6 and of MQX v4.0.

In my project I take a demo of ADC of MQX. Demo works perfectly.

Now i want to understand the each term of ADC_INIT_CHANNEL_STRUCT.

In adc.h file, parameters are defined with single line comment.

I do googling but seems helpless to get any document for understanding each parameters of ADC_INIT_CHANNEL_STRUCT.

Also there are lots of question i want to know. Here is a list of that all.

1. What is difference between ADC_CHANNEL_START_NOW and ADC_CHANNEL_START_TRIGGERED?

(Say I put ADC_CHANNEL_START_TRIGGERED flag but defined time_offset to 0 then.. What exactly difference between these two flags .?  )

2. What is the relation between time_offset and time_period and flags?

As ADC conversion time is appx 6 usec, and I put time_period of 15usec with ADC_CHANNEL_START_TRIGGERED flag and 1000 usec time_offset ....But seems not working for me...!!

(In my project I am using 12 channels for ADC and for each channel initialization I am putting 15usec time_period with 1000 usec time_offset  and ADC_CHANNEL_START_NOW flag except for channel 1 and 2. ........ for channel 1 and 2 i need to put 150usec time_period then it works for me...Why this is so?   )

3. Is it necessary that at least a single channel among 12 channels must be initialize with ADC_CHANNEL_START_TRIGGERED flag?

Please help me to get rid of this confusions...!!

Regards,

Utsavi Bharuchwala

0 Kudos
1 Reply

247 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Utsavi Bharuchwala:

ADC_CHANNEL_START_TRIGGERED:  Measurement starts after trigger is fired or  after using the IOCTL_ADC_RUN_CHANNEL iotcl command, this flag is mutually exclusive with ADC_CHANNEL_START_NOW.

ADC_CHANNEL_START_NOW: Measurement starts immediately after fopen(). initiating with the IOCTL_ADC_RUN_CHANNEL ioctl command. This flag is mutually exclusive with ADC_CHANNEL_START_TRIGGERED.

The old ADC driver in MQX has some overhead, it only allows 2 channels per ADC, now it is removed from MQX from MQX4.1.

I suggest you use MQX lwadc driver for this purpose. It is much easier to use, especially in case you need to scan more than 2 channels. Example is given in

C:\Freescale\Freescale_MQX_4_2\mqx\examples\lwadc

Regards

Daniel