8 years, 8 months ago.

Manually configure the ADC Module of K64F

Hi Everyone,

I would like to manually configure the ADC of the K64F by programming the registers directly. Currently, I haven't made it very far because I believe the MCU throws an exception when I try to write to the registers. I believe this is because I haven't "turned on" the ADC module yet. However, I do now know how to do this. Has anyone tried to manually configure any of the registers in the K64F? I would like to do this so I can setup interrupts between the timer module and the ADC module.

Thanks!

Damien

Question relating to:

The Freedom-K64F is an ultra-low-cost development platform for Kinetis K64, K63, and K24 MCUs.

Just figured it out, classic:

You need to enable the module's clock in the SIM_SCGC6 or SIM_SCGC3 register. Therefore the code would be:

// Turn on ADC0:
SIM_SCGC6 |= SIM_SCGC6_ADC0_MASK;
// Turn on ADC1:
SIM_SCGC3 |= SIM_SCGC3_ADC1_MASK;

The attached file is a nice summary of how to manually configure the ADC.

/media/uploads/defrost/frdm-k64_adc_configuration.pdf

posted by Damien Frost 29 Jul 2015

Here is a library I wrote to use the A/D in differential mode, you can use it as a template. https://developer.mbed.org/users/JimCarver/code/AnalogIn_Diff/file/7b36e4381d83/AnalohIn_Diff.cpp

posted by Jim Carver 29 Jul 2015
Be the first to answer this question.