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:
You can see the pins available for the ADC in:NuttX/arch/arm/src/chip/chip/stm32f40xxx_pinmap.h
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:
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.
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:
You can see the pins available for the ADC in:
NuttX/arch/arm/src/chip/chip/stm32f40xxx_pinmap.h
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: 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.