2024-03-14 04:31 PM - edited 2024-03-14 04:53 PM
Board: NUcleo 64-G474
I just want to read 2 channels of an ADC but am presented with a bewildering array of incredibly confusing options: Ranks, Continuous mode, discontinous mode, number of conversions, oversampling, triggers, etc, etc, etc. The embedded "help" is completely useless.
I have two SE channels of ADC1 enabled (1 and 2), and I want to sample them both NOT in DMA. Seems reaonsonable but after hours of trying I can find nothing that works, and no resources to help. I'm trying the code below and various offshoots of it.
Solved! Go to Solution.
2024-03-15 08:54 AM
Hi @sgordon777
Here in attached my example to use ADC1 Channel1 & Channel2 without DMA (PA0 & PA1)
You can test it on your side (STM32CubeIDE and Nucleo-G474RE)
If you need to build the project, ask OK to build without invoking Device Configuration Tool code generation by CubeMX.
The reason is because the initial Mx configuration has been overwritten in the code.
I hope it will help you?
Thank you to give your feedback.
Best regards,
Romain
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-03-15 08:54 AM
Hi @sgordon777
Here in attached my example to use ADC1 Channel1 & Channel2 without DMA (PA0 & PA1)
You can test it on your side (STM32CubeIDE and Nucleo-G474RE)
If you need to build the project, ask OK to build without invoking Device Configuration Tool code generation by CubeMX.
The reason is because the initial Mx configuration has been overwritten in the code.
I hope it will help you?
Thank you to give your feedback.
Best regards,
Romain
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-03-15 12:31 PM - edited 2024-03-15 12:34 PM
Thanks
2024-03-16 02:15 AM
Hi @sgordon777
Does this help you? Any feedback?
BR
Romain,
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-07-30 09:21 AM
Please, any example for STM32C0 family? This device has no ADC independent mode available and I need to run ADC without DMA for 0,1,5 and 6 channels.
Thanks in advance,
Gaston
2024-07-31 12:24 AM
Hello @Gaston
The ADC of the STM32C0 is independent by default since this product has only one ADC instance.
This independent or dual mode configuration is only applicable in the case where you have several ADC instances like the STM32G4 which can have 5 ADCs.
For your question, you can refer to the STM32G4 project that I posted.
You can then create a CubeMX project, configure your 4 channels, activate the Scan mode and a sequence of 4 conversions with an adapted ADC sampling time.
Once your project is generated, you manually change in the MX_ADC_Init() configuration the field:
hadc1.Init.ScanConvMode = ADC_SCAN_DISABLE;
Then you comment out all the lines that are related to the sconfig configuration (refer to my STM32G4 project)
Finally, you write the same function below:
static uint32_t ADC_Select_Channel(uint32_t channel) that you can call in your application.
What is the reason that forces you not to use ADC scan mode with DMA which makes things much easier since all STM32s are designed to work like this?
Best regards,
Romain,
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.