How do I dig deeper?

16 Sep 2015

I'm designing a board that will plug into a Freescale K22F development board, and I'd like to provide a nice high-precision external analog reference to it via the K22F's analog reference input pin. Then I wondered how I can control whether ADC will even use the external reference, and what the defaults are used by AnalogIn. I haven't been able to find this information yet. It's great to have the simple APIs to start with, but I'm having hard time figuring out how to dig deeper to modify the default settings to take advantage of the benefits of some of the peripherals. I'm new to mbed, CMSIS and ARM in general, and I have a basic question of where I find the syntax to modify specific registers. Am I wrong to hope that there is a straightforward way to tweak AnalogIn or the other mbed classes to take advantage of the hardware features that are specific to my hardware platform? Or are all special peripheral features wasted when using mbed because everything has to be compatible with the least-capable platform?

16 Sep 2015

The Mbed lib itself does not support all the special features: Then you would lose the whole point of an easy to use library compatible with different MCUs, if you have special functions for each MCU. But there is nothing stopping you from either using the Freescale KSDK functions or direct register access.

Here is the AnalogIn source of the K22f: https://developer.mbed.org/users/mbed_official/code/mbed-src/file/9c82b0f79f3d/targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS/analogin_api.c

If you want to use directly the registers instead of the KSDK functions like used there, here is the source of the K20 MCUs, which use an identical ADC afaik and use the registers directly, so you can do the same in your program: https://developer.mbed.org/users/mbed_official/code/mbed-src/file/9c82b0f79f3d/targets/hal/TARGET_Freescale/TARGET_K20XX/analogin_api.c

18 Sep 2015

Thanks, Erik.