cancel
Showing results for 
Search instead for 
Did you mean: 

More about STM32H747 ADC

AStew.1
Associate II

I have an STM32H747i-Disco board and looking at the ADC example (which I have compiled and ran successfully)

The example uses channel 18 and GPIO PA0_4 as both master and slave ADC inputs.

I would like to use PA0_C and PA1_C as the two ADC inputs but I can’t find any references to these GPIOs in the HAL drivers. How are they referenced and how would I convert the code to use them?

Also, I would really like to transfer this code from running on the CM7 core to the CM4 core: is this a straightforward task? After that I would need to access the ADC result array from the CM7 via shared memory, is this possible?

3 REPLIES 3
TDK
Guru

The pin definitions are in main.h and the initialization is in stm32h7xx_hal_msp.c. Here, PA4 is used.

/* Definition of ADCx channels */
#define ADCx_CHANNELa                   ADC_CHANNEL_18
 
/* Definition of ADCx channels pins */
#define ADCx_CHANNELa_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
#define ADCx_CHANNELa_GPIO_PORT         GPIOA
#define ADCx_CHANNELa_PIN               GPIO_PIN_4

> I would like to use PA0_C and PA1_C as the two ADC inputs 

PA0 is a pin. PA1 is a pin. No idea what PA0_C or PA1_C are.

If you feel a post has answered your question, please click "Accept as Solution".
AStew.1
Associate II

Thanks for the reply, and yes I've got that far. These other pins are referred to in "en.STM32H7-System-General-purpose_IO_interface_GPIO-2" as:

Some pins/balls are directly connected to PA0_C,

PA1_C, PC2_C and PC3_C ADC analog inputs. There is

a direct path between Pxy_C and Pxy pins/balls, through

an analog switch.

Connections are handled through the System

Configuration Controller (SYSCFG).

They appear on connector CN9 on pins 3,4,5 & 6 on the STM32H747i-DISCO board.

So my question remains, how do I refer to them via the HAL drivers?

TDK
Guru

Interesting. It looks like they're just dedicated analog pins connected to certain ADC channels. Clock enabled the same as other pins on that port, but no other initialization needed. You can't pass them into HAL_GPIO_* functions because they're not GPIO pins. How else do you want to refer to them?

There are a few examples in GitHub:

https://github.com/YutakaNakamura/PMSM_Control_source/blob/db1b453550b3e367f353a80e5deed7cd4c6d7745/H7_FOC_Project/STM32H743ZI_FOC/SystemLib/Src/ADCCtrl.cpp

If you feel a post has answered your question, please click "Accept as Solution".