9 years, 3 months ago.

mbed can't handle all ADC pins in Freescale K22

Freescale Kinetis K22 has quite a few pins to be used in AD conversion. Seems that mbed api can't be used to read all of them.

First: PTE0/ADC1_SE4a or PTE1/SDC1_SE5a. When I try to read from those pins, I just get an error "pinmap not found for peripheral". Seems that ADC1_SE4a, or any other a channel is not listed in PeripherialNames.h

Second: ADC1_SE16 or ADC0_SE16 or ADC1_SE18 It should be possible to read this pin also, but how to do this in mbed? There's are not any GPIO Pin name assigned to these? These are solely for ADC or DAC use.

Any tips? Should I just go directly to register level, while the rest of the SW is relying on mbed?

Question relating to:

1 Answer

9 years, 3 months ago.

Without checking it myself specifically: The first type you can just add to the pinmap file and they should work. When verified you can also submit a pull request on the mbed github.

The second type is harder. What probably needs to be done is adding also in the pinout file add those pins, even though they cannot be used for GPIO (for example with value 0xFFFFFFFE, 0xFFFFFFFD, etc). Then they can also be added in the pinmap file and they should work. Hopefully :P

+1 for github reference

@Mikael Koivu, you can always report this to github as that's the "real" issue tracking, where you can reference the code, + anyone can fix it via a pull request.

posted by Martin Kojtal 13 Aug 2015

Yes, it is time for the 200 open bugs on github :D

posted by Erik - 13 Aug 2015

Thanks. Seems that analogin_api is fixed to use only b channel.

analogin_api.c

ADC_HAL_SetChnMuxMode(adc_addrs[instance], kAdcChnMuxOfB); /* only B channels are avail */

I'll have a look at this unless someone else is quicker. I'm quite busy with other issues right now.

posted by Veli-Matti Puurunen 19 Aug 2015

Probably because the majority uses the B-channel, but yeah to support everything the A-channel might also be required.

Currently it is not on my planning to do something with this (might be in a few weeks or so). I think Martin is too busy with other stuff, and it is more likely that you are today hit by a meteor, so it doesn't matter anymore, than that Freescale supports their own boards.

posted by Erik - 19 Aug 2015

There's a pull request under review to fix the first issue. https://github.com/mbedmicro/mbed/pull/1434

posted by Veli-Matti Puurunen 19 Nov 2015