Skip to main content
suicich
Visitor II
December 10, 2021
Question

Multi Channel ADC Configuration STM32G4

  • December 10, 2021
  • 1 reply
  • 1584 views

Hello everyone,

I'm having a hard time polling multipe channels on an ADC triggered with a Timer on my stm32g474re nucleo board through the STM32 MAT library. Would anyone with a similar experience care to provide an example?

This topic has been closed for replies.

1 reply

Philippe Cherbonnel
ST Employee
December 10, 2021

Hello @suicich​ ,

I don't know on what drivers STM32-MAT firmware is based on (CMSIS ? LL ? HAL ?), but I assume you can insert code using LL driver (low layer driver) in your project.

You can refer to examples in STM32G4 FW packages.

Using LL driver, ADC example with conversions triggered by timer and data transfer by DMA:

...\Firmware\Projects\NUCLEO-G474RE\Examples_LL\ADC\ADC_GroupsRegularInjected_Init

On another target STM32L4 (featuring ADC quite similar to the one of STM32G4), you can refer to a LL driver example with multiple channels conversions and **** transfer by DMA:

...\Firmware\Projects\NUCLEO-L476RG\Examples_LL\ADC\ADC_MultiChannelSingleConversion

With combination of these 2 examples you should be able to make ADC run as you wish.

LL drivers can be integrated quite easily in your project: you just have to include some .h files (stm32g4xx_ll_bus.h, stm32g4xx_ll_adc.h, ...)

There are also HAL examples in FW package, more high level but also less easy to integrate in your project.

You can download FW package from the web (https://www.st.com/en/embedded-software/stm32cubeg4.html) or via CubeMX.

Best regards

Philippe