Problem reading ADC on K60

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

Problem reading ADC on K60

514 Views
MWMinor
Contributor V

Hi

I have a requirement to sample one of the analogue inputs every 50us. I am using the lwadc_read() component to do this, but was getting some confusing results. Although the ADC is being clocked at 8MHz, the ADC appeared to be missing key events on the input. So I inserted the _lwadc_wait_next() component to ensure the data from the ADC was valid, before reading the result and although this went some way to fix the "missing" key events on the input, the length of time between samples became very long - approximately 130us..!!.

I tried increasing the frequency at which the ADC was clocked to 12MHz, and this reduced the time between valid samples from 130 to 70us but still significantly longer than expected.

The project is based on MQX4.1 and I am using Codewarrior V10.7.

The board is a custom but my starting point was the TWR-K60D100 and I used the BSP for this board as the starting point for the software.

Why is the ADC conversion time so long and more importantly, how do I change it from within the MQX environment...?

I'd really appreciate some help with this...!

Thanks

Ken 

0 Kudos
1 Reply

380 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Ken

I am afraid the ADC driver of MQX is not able to sample at your expected. The default sampling period is 5ms because this is the TICK timer period of the RTOS.

Therefore, in order to have your expected sampling rate, it will be required to add a ''bare-board' ADC driver inside MQX RTOS, and bypassing the ADC interrupt from MQX for using the "bare=board" ADC interrupt.

Have a great day,
Daniel

-----------------------------------------------------------------------------------------------------------------------
Note: If this post is helpful, please click the Correct Answer button or helpful. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos