cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H747 PA0_C & PA1_C input reading issue

Bertrand1
Senior

Hello,

I am working with a STM32H747XI. I have connected a digital input on PA0_C & PA1_C.

I used CubeMX for the initialisation.

The initialisation code is :

/*Configure GPIO pins : UI_ENC0_Pin UI_ENC1_Pin */
  GPIO_InitStruct.Pin = UI_ENC0_Pin|UI_ENC1_Pin;
  GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
  GPIO_InitStruct.Pull = GPIO_NOPULL;
  HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

When I read the pin, it stays always at 0 (GPIO_PIN_RESET)

bpState1 = HAL_GPIO_ReadPin(GPIOA, UI_ENC0_Pin);
bpState2 = HAL_GPIO_ReadPin(GPIOA, UI_ENC1_Pin);

The pin PA0 is at " Reset State".

I dont know what I have to do to solve it.

Many thanks for your help.

Bertrand

1 ACCEPTED SOLUTION

Accepted Solutions

Hello,

Sorry for the late feedback.

It works!

Many thanks.

Should I report as a bug for CubeMx?

Bertrand

View solution in original post

4 REPLIES 4
Jaroslav JANOS
ST Employee

Hello Bertrand,

are the analog switches between PA0 & PA0_C and PA1 & PA1_C closed?

HAL_SYSCFG_AnalogSwitchConfig(SYSCFG_SWITCH_PA0, SYSCFG_SWITCH_PA0_CLOSE);
HAL_SYSCFG_AnalogSwitchConfig(SYSCFG_SWITCH_PA1, SYSCFG_SWITCH_PA1_CLOSE);

Jaroslav

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.

Bertrand1
Senior

I will check and try and revert to you.

Thank you.

Bertrand

Hello,

Sorry for the late feedback.

It works!

Many thanks.

Should I report as a bug for CubeMx?

Bertrand

Hello Bertrand,

I'm glad it worked. Concerning the CubeMX bug, I will take care of it.

Jaroslav

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.