You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nuttx.apache.org by Thomas Axelsson <th...@actia.se> on 2020/09/15 09:54:30 UTC

i.MX RT 1060 ADC

Hi,

I'm looking into using the ADC on IMXRT 1060. I have found imxrt_adc.h and some examples in nuttx-apps using /dev/adcXX. However, it seems that the actual functionality is not yet implemented for IMXRT.

So I'm looking into implementing this driver, based on e.g. lpc17_40_adc.c (diffing all *_adc.c files turned up almost no differences). I tried grepping for some register names to see if the IP block is already implemented for another chip, but without luck.

I'm sending this e-mail to see if someone else is already working on the same thing. I did see that imxrt_adc.h has gotten some updates.

Thomas Axelsson
SW Developer
ACTIA Nordic AB (part of ACTIA Group)

Mail: thomas.axelsson@actia.se<ma...@actia.se>
Web: www.actia.se<http://www.actia.se/>




Re: i.MX RT 1060 ADC

Posted by Alan Carvalho de Assis <ac...@gmail.com>.
Hi Thomas,

On 9/22/20, Thomas Axelsson <th...@actia.se> wrote:
> Hi,
>
> I have now created a PR for a simple IMXRT ADC driver. (
> https://github.com/apache/incubator-nuttx/pull/1868 )
>

Nice work, thank you!

> The names of register bit values for ADC_CFG:ADSTS do not match between
> IMXRT 1020 and 1050/1060.
> This PR changes them to match for 1050/1060, but I guess it should be split
> into two files - or possibly have an ifdef for the chip? Please provide
> advise on this issue.
> https://github.com/apache/incubator-nuttx/pull/1868/files#diff-d732b4fa83e7f3fbf6ac34c1203cef60
>

I think since iMXRT1050/60 are similar, you could add it to
imxrt105x_pinmux.h as well, but for 1020 it is better to avoid reusing
it.

BR,

Alan

RE: i.MX RT 1060 ADC

Posted by Thomas Axelsson <th...@actia.se>.
Hi,

I have now created a PR for a simple IMXRT ADC driver. ( https://github.com/apache/incubator-nuttx/pull/1868 )

The names of register bit values for ADC_CFG:ADSTS do not match between IMXRT 1020 and 1050/1060.
This PR changes them to match for 1050/1060, but I guess it should be split into two files - or possibly have an ifdef for the chip? Please provide advise on this issue.
https://github.com/apache/incubator-nuttx/pull/1868/files#diff-d732b4fa83e7f3fbf6ac34c1203cef60

BR
Thomas

-----Original Message-----
From: Thomas Axelsson <th...@actia.se> 
Sent: den 16 september 2020 09:05
To: dev@nuttx.apache.org
Subject: RE: i.MX RT 1060 ADC

Thank you, David,

It's good to have a working example.

Regarding the existing ADC code, I realized that I had only diffed over the various LPCxxx drivers. My current starting point is the LPC driver with things picked from the STM32. The LPC driver is simpler (STM32 handles many variants), while the STM32 driver has a clearer multi-ADC and multi-channel structure (although I just realized that mask in the LPC driver might be the channel selector). Just writing this here in case someone wants to point me in another direction.

BR
Thomas

-----Original Message-----
From: David Sidrane <Da...@nscdg.com> 
Sent: den 15 september 2020 12:15
To: dev@nuttx.apache.org
Subject: RE: i.MX RT 1060 ADC

Hi Thomas,

If you structure the driver like any of the other ADC drivers in tree you should be able to reference px4_arch_adc_init and px4_arch_adc_sample

from
https://github.com/PX4/Firmware/blob/master/platforms/nuttx/src/px4/nxp/im
xrt/adc/adc.cpp to get the required logic.

To fill in the meat, but you will have to do it in nuttx style using the
{get|set}reg32 calls.

David

-----Original Message-----
From: Thomas Axelsson [mailto:thomas.axelsson@actia.se]
Sent: Tuesday, September 15, 2020 2:55 AM
To: dev@nuttx.apache.org
Subject: i.MX RT 1060 ADC

Hi,

I'm looking into using the ADC on IMXRT 1060. I have found imxrt_adc.h and some examples in nuttx-apps using /dev/adcXX. However, it seems that the actual functionality is not yet implemented for IMXRT.

So I'm looking into implementing this driver, based on e.g. lpc17_40_adc.c (diffing all *_adc.c files turned up almost no differences). I tried grepping for some register names to see if the IP block is already implemented for another chip, but without luck.

I'm sending this e-mail to see if someone else is already working on the same thing. I did see that imxrt_adc.h has gotten some updates.

Thomas Axelsson
SW Developer
ACTIA Nordic AB (part of ACTIA Group)

Mail: thomas.axelsson@actia.se<ma...@actia.se>
Web: www.actia.se<http://www.actia.se/>

RE: i.MX RT 1060 ADC

Posted by Thomas Axelsson <th...@actia.se>.
Thank you, David,

It's good to have a working example.

Regarding the existing ADC code, I realized that I had only diffed over the various LPCxxx drivers. My current starting point is the LPC driver with things picked from the STM32. The LPC driver is simpler (STM32 handles many variants), while the STM32 driver has a clearer multi-ADC and multi-channel structure (although I just realized that mask in the LPC driver might be the channel selector). Just writing this here in case someone wants to point me in another direction.

BR
Thomas

-----Original Message-----
From: David Sidrane <Da...@nscdg.com> 
Sent: den 15 september 2020 12:15
To: dev@nuttx.apache.org
Subject: RE: i.MX RT 1060 ADC

Hi Thomas,

If you structure the driver like any of the other ADC drivers in tree you should be able to reference px4_arch_adc_init and px4_arch_adc_sample

from
https://github.com/PX4/Firmware/blob/master/platforms/nuttx/src/px4/nxp/im
xrt/adc/adc.cpp to get the required logic.

To fill in the meat, but you will have to do it in nuttx style using the
{get|set}reg32 calls.

David

-----Original Message-----
From: Thomas Axelsson [mailto:thomas.axelsson@actia.se]
Sent: Tuesday, September 15, 2020 2:55 AM
To: dev@nuttx.apache.org
Subject: i.MX RT 1060 ADC

Hi,

I'm looking into using the ADC on IMXRT 1060. I have found imxrt_adc.h and some examples in nuttx-apps using /dev/adcXX. However, it seems that the actual functionality is not yet implemented for IMXRT.

So I'm looking into implementing this driver, based on e.g. lpc17_40_adc.c (diffing all *_adc.c files turned up almost no differences). I tried grepping for some register names to see if the IP block is already implemented for another chip, but without luck.

I'm sending this e-mail to see if someone else is already working on the same thing. I did see that imxrt_adc.h has gotten some updates.

Thomas Axelsson
SW Developer
ACTIA Nordic AB (part of ACTIA Group)

Mail: thomas.axelsson@actia.se<ma...@actia.se>
Web: www.actia.se<http://www.actia.se/>

RE: i.MX RT 1060 ADC

Posted by David Sidrane <Da...@nscdg.com>.
Hi Thomas,

If you structure the driver like any of the other ADC drivers in tree you
should be able to reference px4_arch_adc_init and px4_arch_adc_sample

from
https://github.com/PX4/Firmware/blob/master/platforms/nuttx/src/px4/nxp/im
xrt/adc/adc.cpp to get the required logic.

To fill in the meat, but you will have to do it in nuttx style using the
{get|set}reg32 calls.

David

-----Original Message-----
From: Thomas Axelsson [mailto:thomas.axelsson@actia.se]
Sent: Tuesday, September 15, 2020 2:55 AM
To: dev@nuttx.apache.org
Subject: i.MX RT 1060 ADC

Hi,

I'm looking into using the ADC on IMXRT 1060. I have found imxrt_adc.h and
some examples in nuttx-apps using /dev/adcXX. However, it seems that the
actual functionality is not yet implemented for IMXRT.

So I'm looking into implementing this driver, based on e.g. lpc17_40_adc.c
(diffing all *_adc.c files turned up almost no differences). I tried
grepping for some register names to see if the IP block is already
implemented for another chip, but without luck.

I'm sending this e-mail to see if someone else is already working on the
same thing. I did see that imxrt_adc.h has gotten some updates.

Thomas Axelsson
SW Developer
ACTIA Nordic AB (part of ACTIA Group)

Mail: thomas.axelsson@actia.se<ma...@actia.se>
Web: www.actia.se<http://www.actia.se/>