Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

How to use ADC in NuttX #24

@jfm92

Description

@jfm92

This is a guide of how to use the ADC in NuttX. This is focus in the Olimex-STM32-E407 board.
At this moment, it's only one ADC channel available, but you can add more channels if you needed, doing the next modifications:
NuttX/configs/olimex-stm32-e407/src/stm32adc
(Please download the last version of micro-ROS repository, because the original set the ADC channel to an already use channel)

Once you're in the file there are some important aspects:
image

You can see the pins available for the ADC in:
NuttX/arch/arm/src/chip/chip/stm32f40xxx_pinmap.h

image

The ADC allow us differents working modes:
-DMA.
-Timer trigger.
-Sample saved in the buffer.

By default is set the third mode, but in this guide we will set the timer trigger mode (the only difference is to check or not the timer)
System Type -> STM32 Peripheral Support -> ADC3 (Check)
System Type -> STM32 Peripheral Support -> TIM1 (Check)
System Type -> STM32 Peripheral Support -> Timer Configuration -> Image:
image
Device Drivers->Analog Device(ADC/DAC) Support-> Analog-to-Digital Conversion (Checked)

With this configuration we have configure an ADC with a sampling frequency of 100 Hz.

The behaviour of this driver is exactly the same as other driver. So you can see the example ADC_Simple to see how to use basic functionality of the ADC or go to the ADC example which is more complex.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions