sp@orbitalfox.com [nuttx]
2016-06-10 10:15:13 UTC
Hello all.
I've implemented an AFEC driver for SAM34 by wrapping Atmel's ASF code. The idea
is to have common driver for all SAM chips supporting it. The implementation
needs more work, but the basic ADC example works.
Been working on this driver intermittently for a while now, but I realised it's
best to push it upstream in case someone else is interested in this development
and to have it taken in consideration in API changes (like the recent
adc_receive one). Also I would like some feedback on the direction taken.
My repo for this is here: https://github.com/orbifx/nuttx/tree/sam-afec (Note I
have purposely tracked the .config file until I'm done developing this). The
patch I'm attaching doesn't contain the .config of course.
## Changes
A summary of the files affected per directory.
### Arch
arch/arm/src/sam34/Make.defs
arch/arm/src/sam34/chip/sam_afec.h
arch/arm/src/sam34/sam_afec.c
arch/arm/src/sam34/sam_afec.h
The architecture specific code for the sam34. I think Atmel's driver supports
other architectures like SAMV and SAMS. I've only tested on SAM4E16E. If others
have other chips please give it a try.
There are some experimental functions (sam_afec_channel_*) which are not being
used by default and I would like some feedback on. From what I realised, an ADC
driver with multiple channels is supposed to use the channel feature of the ADC
interface. But can that allow for someone to open one of the channels as a
stream via a file descriptor? As an experiment I made a separate set of
functions for registering a channel as a file. I've pulled back from this idea
till I consider it some more. Any thoughts?
### Board
configs/sam4e-ek/Kconfig
configs/sam4e-ek/src/Makefile
configs/sam4e-ek/src/sam4e-ek.h
configs/sam4e-ek/src/sam_afec.c
The code required for the evaluation board I used for my development.
### Driver
drivers/analog/Kconfig
drivers/analog/Make.defs
drivers/analog/sam_afec.c
include/nuttx/analog/sam4e_afec.h
include/nuttx/analog/sam_afec.h
The generic SAM driver from Atmel's ASF. I've tried to avoid changing this as
much as I could. Any changes are limited to the top of any affected files so
that doing a diff against future releases by Atmel will be straightforward.
### Apps
There is a small patch for the ADC example, but I'd rather if there wasn't. If
anyone has ideas on this please share them. They are two IOCTL calls necessary
for configuring the driver.
I've implemented an AFEC driver for SAM34 by wrapping Atmel's ASF code. The idea
is to have common driver for all SAM chips supporting it. The implementation
needs more work, but the basic ADC example works.
Been working on this driver intermittently for a while now, but I realised it's
best to push it upstream in case someone else is interested in this development
and to have it taken in consideration in API changes (like the recent
adc_receive one). Also I would like some feedback on the direction taken.
My repo for this is here: https://github.com/orbifx/nuttx/tree/sam-afec (Note I
have purposely tracked the .config file until I'm done developing this). The
patch I'm attaching doesn't contain the .config of course.
## Changes
A summary of the files affected per directory.
### Arch
arch/arm/src/sam34/Make.defs
arch/arm/src/sam34/chip/sam_afec.h
arch/arm/src/sam34/sam_afec.c
arch/arm/src/sam34/sam_afec.h
The architecture specific code for the sam34. I think Atmel's driver supports
other architectures like SAMV and SAMS. I've only tested on SAM4E16E. If others
have other chips please give it a try.
There are some experimental functions (sam_afec_channel_*) which are not being
used by default and I would like some feedback on. From what I realised, an ADC
driver with multiple channels is supposed to use the channel feature of the ADC
interface. But can that allow for someone to open one of the channels as a
stream via a file descriptor? As an experiment I made a separate set of
functions for registering a channel as a file. I've pulled back from this idea
till I consider it some more. Any thoughts?
### Board
configs/sam4e-ek/Kconfig
configs/sam4e-ek/src/Makefile
configs/sam4e-ek/src/sam4e-ek.h
configs/sam4e-ek/src/sam_afec.c
The code required for the evaluation board I used for my development.
### Driver
drivers/analog/Kconfig
drivers/analog/Make.defs
drivers/analog/sam_afec.c
include/nuttx/analog/sam4e_afec.h
include/nuttx/analog/sam_afec.h
The generic SAM driver from Atmel's ASF. I've tried to avoid changing this as
much as I could. Any changes are limited to the top of any affected files so
that doing a diff against future releases by Atmel will be straightforward.
### Apps
There is a small patch for the ADC example, but I'd rather if there wasn't. If
anyone has ideas on this please share them. They are two IOCTL calls necessary
for configuring the driver.
--
SP
SP