Sequence of multiple ADC convrsions change

Discussions concerning TrueSTUDIO for STM32 9.0.0 and later versions.

Moderators: Markus Girdland, Mattias Norlander

diamondjimkoehler
Posts: 18
Joined: Fri Mar 10, 2017 5:32 am

Sequence of multiple ADC convrsions change

Postby diamondjimkoehler » Fri Jan 11, 2019 7:38 pm

I am running TrueSTUDIO 9.2 ona 64-bit Linux system. I have an application where I want to do the ADC for three channels of analog input 900 times to get a fixed array of 2700 samples. I have a set this up a Nucleo F103 board. I created the project using STM32 CubeMX and have set ADC1 to scan 3 channels (0, 1, 4) in a continuous mode using DMA to transfer the results to an array in memory. It works wonderfully!
The call to do it all is simply:

HAL_ADC_Start_DMA(&hadc1, (uint32_t*) data, total_sample_number);

But, there's a problem. That is that the first time the command is run, the sequence of sample starts with channel 0. The subsequent times, it may or may not start with channel 0. Since I have no a priori way of determining which channel is which just by looking at the data, I am stuck.
Is there any way of setting the ADC to start with the same channel every time the HAL_ADC_START_DMA() is called?

User avatar
artbody
Posts: 18
Joined: Tue Jan 01, 2019 7:07 pm
Location: Germany
Contact:

Re: Sequence of multiple ADC convrsions change

Postby artbody » Sun Jan 13, 2019 7:12 pm

a few month ago, i had a similar problem and came across this article
https://www.controllerstech.com/how-to- ... -in-stm32/
i hope this helps
:mrgreen:
Linux artbody 4.14.83-gentoo #1 SMP Mon Dec 3 23:46:25 CET 2018 x86_64 AMD FX(tm)-8350 Eight-Core Processor AuthenticAMD GNU/Linux
:mrgreen:


Return to “TrueSTUDIO for STM32 discussions”

Who is online

Users browsing this forum: No registered users and 2 guests