Kinetis ADC driver

ChibiOS public support forum for topics related to the Freescale Kinetis family of micro-controllers.

Moderator: utzig

SpaceCoaster
Posts: 49
Joined: Mon Aug 11, 2014 6:40 am

Kinetis ADC driver

Postby SpaceCoaster » Thu Sep 04, 2014 12:10 am

Hi,

I am making good progress with an ADC driver for the KINETIS devices but I have a question about the usage of the depth setting in the generic adc.[ch] files.

For a ADCConversionGroup with 5 channels and if we are collecting a group of 3 samples for each channel, so 15 samples in total, what should the depth be set to in the ADCDriver object?

Cheers,
Derek

SpaceCoaster
Posts: 49
Joined: Mon Aug 11, 2014 6:40 am

Re: Kinetis ADC driver

Postby SpaceCoaster » Thu Sep 04, 2014 1:34 am

Hi,

Attached are patches for an ADC implementation for KINETIS. It is a generic LLD driver and supports both the K20 and KL2x devices. It supports collecting multiple values for multiple sensors in both single pass and circular modes. It emulates the features of the STM32 driver but this driver gets one interrupt per ADC sample.

The demo is for the FREEDOM-KL25Z board. It calculates the temperature using the internal sensor and the bandgap voltage.

Critique away!

Cheers,
Derek
Attachments
0001-KINETIS-SIM-PMC-fields-and-ADC-comments-to-support-A.patch.gz
(1.52 KiB) Downloaded 274 times
0002-KINETIS-ADC-LLD-driver.patch.gz
(5.08 KiB) Downloaded 287 times
0003-KINETIS-ADC-demo-for-FREEDOM-KL25Z.patch.gz
(10.71 KiB) Downloaded 310 times

SpaceCoaster
Posts: 49
Joined: Mon Aug 11, 2014 6:40 am

Re: Kinetis ADC driver

Postby SpaceCoaster » Thu Sep 04, 2014 3:38 am

Improved ADC demo which uses the LEDs to indicate the current temperature.

Blue is cold, Red is hot and Green is just right.
Attachments
0003-KINETIS-ADC-demo-for-FREEDOM-KL25Z.patch.gz
(10.96 KiB) Downloaded 302 times

User avatar
Tectu
Posts: 1226
Joined: Thu May 10, 2012 9:50 am
Location: Switzerland
Contact:

Re: Kinetis ADC driver

Postby Tectu » Thu Sep 04, 2014 7:26 am

Although I don't use a Kinetis myself, I appreciate the amount of work you put into this.
I keep tweeting about it so people might join your effort.


~ Tectu

User avatar
Giovanni
Site Admin
Posts: 14444
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1074 times
Been thanked: 921 times
Contact:

Re: Kinetis ADC driver

Postby Giovanni » Thu Sep 04, 2014 9:39 am

Yes, is is progressing at an amazing speed.

Giovanni

SpaceCoaster
Posts: 49
Joined: Mon Aug 11, 2014 6:40 am

Re: Kinetis ADC driver

Postby SpaceCoaster » Thu Sep 04, 2014 12:12 pm

Tectu,

Thanks!

In a much earlier thread you talked about using the Kinetis SPI to drive a display and touchscreen. Now we have something working would you be able to restart that? I think a display would be a good benchmark before adding DMA.

Derek

SpaceCoaster
Posts: 49
Joined: Mon Aug 11, 2014 6:40 am

Re: Kinetis ADC driver

Postby SpaceCoaster » Sat Sep 06, 2014 12:05 am

ADC driver for KINETIS and example program in testhal/KINETIS/ADC released.

From the readme.txt

Code: Select all

The demo runs on an Freescale Freedom KL25Z board and demonstrates
the usage of the ADC.

It reads the internal temperature sensor. If the temperature drops
below 20C (68F) it turns on the blue LED. If the temperature rises
above 27C (81F) it turns on the red LED. Otherwise the green LED is
illuminated.

The internal bandgap voltage reference is used to calibrate the
results returned from the temperature sensor.

Share and Enjoy,
Derek

User avatar
Tectu
Posts: 1226
Joined: Thu May 10, 2012 9:50 am
Location: Switzerland
Contact:

Re: Kinetis ADC driver

Postby Tectu » Sat Sep 06, 2014 10:25 am

SpaceCoaster wrote:Tectu, In a much earlier thread you talked about using the Kinetis SPI to drive a display and touchscreen. Now we have something working would you be able to restart that? I think a display would be a good benchmark before adding DMA.

I am interested into that for sure. However, I now no longer have such a board available. I'll put such a board on my next order as it is cheap anyway. Obviously I have both, the displays and the corresponding software to drive them so we only have to wait for the board to arrive ;)


~ Tectu


Return to “Kinetis Support”

Who is online

Users browsing this forum: No registered users and 3 guests