cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7B3I-DK "_C" Pins Not Working as GPIO

EthanMankins
Associate III

I am working on the STM32H7B3I-DK and needing to use PA0_C PC2_C and PC3_C as part a button scanner, as all other pins are being used. I have PA_0 configured as an output and PC2_C and PC3_C as Inputs with pull downs. The current full 3x3 configuration is PA4, PC4, PA0_C as outputs and PH10, PC2_C, and PC3_C as inputs (pull down resistors). I have configured PA_0, PC2_C, and PC3_C to be connect to PA0, PC2, and PC3, by closing the analog switch. However, PA0 and PC2 are not working as intended. Measured through an oscilloscope PA0 is not supplying and voltage when set high (Same results in a new project with only PA0_C connected and set high). PC2 is also not reading high when voltage is applied. The weird thing is that PC3 works fine and reads high when voltage is applied.
I am trying to figure out if the board somehow is damaged or if i am missing something. I have pasted my pin Initialization below. I have also assigned the pins in cubeMX to have the same values.

 

    // Configure PA0_C (ROW2) as output
    GPIO_InitTypeDef GPIO_InitStruct = {0};

    // PA0_C (ROW2) as output
    GPIO_InitStruct.Pin = GPIO_PIN_0;
    GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

    // PC2_C (COL1) as input
    GPIO_InitStruct.Pin = GPIO_PIN_2;
    GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
    GPIO_InitStruct.Pull = GPIO_PULLDOWN;
    HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);

    // PC3_C (COL2) as input
    GPIO_InitStruct.Pin = GPIO_PIN_3;
    GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
    GPIO_InitStruct.Pull = GPIO_PULLDOWN;
    HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);

    // Clear SYSCFG for these pins
    __HAL_RCC_SYSCFG_CLK_ENABLE();
    HAL_SYSCFG_AnalogSwitchConfig(SYSCFG_SWITCH_PA0,SYSCFG_SWITCH_PA0_CLOSE);
    HAL_SYSCFG_AnalogSwitchConfig(SYSCFG_SWITCH_PC2,SYSCFG_SWITCH_PC2_CLOSE);
    HAL_SYSCFG_AnalogSwitchConfig(SYSCFG_SWITCH_PC3,SYSCFG_SWITCH_PC3_CLOSE);

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
MHoll.2
Senior

Hi,

If I understand You right, You are using the Discovery Board. This Board has a STM32H7B3LIH6QU mounted (225 pin’s). The use of the analog switches for PA0_C, PA1_C, PC2_C and PC3_C, are only useful for case size where PA0, PA1, PC2 and PC3 are not mapped to a pin, for the STM32H7B3 the Pins PA0 and PA1 are always mapped, PC2 and PC3 are not mapped on some case sizes, but the MCU mounted on the Discovery board has them.
So unfortunately on the Diskovery Board the Px_C pins make only sense if used as analog inputs (switch open).

Martin

View solution in original post

3 REPLIES 3
MHoll.2
Senior

Hi,

If I understand You right, You are using the Discovery Board. This Board has a STM32H7B3LIH6QU mounted (225 pin’s). The use of the analog switches for PA0_C, PA1_C, PC2_C and PC3_C, are only useful for case size where PA0, PA1, PC2 and PC3 are not mapped to a pin, for the STM32H7B3 the Pins PA0 and PA1 are always mapped, PC2 and PC3 are not mapped on some case sizes, but the MCU mounted on the Discovery board has them.
So unfortunately on the Diskovery Board the Px_C pins make only sense if used as analog inputs (switch open).

Martin

EthanMankins
Associate III

Thank you for clearing that up, yes I am using the Discovery Board. I am a little confused then why PC3_C is working fine as a digital input but PC2_C is not. There was also a brief moment when PA0_C was able to work as a digital output, but then stopped working after I reflashed.
 Do you know why those may be?

I can only speculate, could be that you have a conflict between the HW connected to Px_C Pin and the relative Px Pin, or that You have killed the analog switch with different voltages on the Px_C Pin and the relative Px Pin.