2021-01-20 03:43 AM
that's it.. say i have 4 channels (PA0 , pA1 , PA2 , pA3)..what i need is : in the while(1) loop i put 4 variables, and keep reading the data registers , and because it's in continous mode, so the 4 variables keep updating in the backgroud, how can i do that ?! i already done the driver and tested it with one channel and it worked great. but in case of 4 channels , the readings are the same while the supposed not..the problem i think is that data overrun occur to data register so i keep reading the value of one channel only and put it in the 4 variabnles..
so the question is.. how can i stop the adc after each conversion till i read the data register then continue with the second channel , third , forth .. then repeat in order. is that possible ? thanks.
2021-01-20 05:57 AM
Hi @Iwael.1 ,
You can use STM32CubeMX to configure the ADC:
Navigate to Analog then choose your ADC then in the ADC_Settings you can enable continuous Conversion Mode.
You need also to choose your channels.
After that you can generate you code.
Hope that this helps you.
Houssem
2021-01-20 06:20 AM
The "old" SPL examples for the F103 ADC used this method, albeit with DMA.
Configure the ADC for your number of channels, and DMA for the required number of transfers, and you are fine.
I hope you realize it is very hard to achieve synchronized ("equidistant") values for your channels.
Perhaps that does not matter for your application.
Last time I checked, the SPL was still available for download on ST's website.