Skip to main content
Associate
Solved

STM32H7A3ZIT6Q – Firmware Programming Successful but GPIO Outputs Not Working on Custom PCB

Hello ST Community,

I am currently developing a custom PCB based on the STM32H7A3ZIT6Q (LQFP144) microcontroller. I am facing an issue where the MCU can be successfully programmed using ST-LINK, but its GPIO pins do not appear to operate as expected.

I would appreciate some guidance in identifying whether this could be related to the power supply configuration, internal regulator settings, clock configuration, or GPIO initialization.

1. Hardware Configuration

  • MCU: STM32H7A3ZIT6Q

  • Package: LQFP144

  • PCB: Custom-designed 2-layer PCB

  • Programming interface: ST-LINK/V2

  • Target voltage: 3.3V

  • Power configuration: Internal LDO mode

  • External crystal: 24 MHz

The MCU is powered from an external 3.3V regulated supply.

2. Programming Status

I can successfully connect to the MCU using STM32CubeIDE and STM32CubeProgrammer.

The ST-LINK log reports:

  • ST-LINK Firmware: V2J49S7

  • Target Voltage: 3.30V

  • Device ID: 0x480

  • Device Name: STM32H7A/B

  • Flash Size: 2 MB

  • SWD Frequency: 4000 KHz

The firmware download and verification complete successfully, with the message:

Download verified successfully

Therefore, the ST-LINK can communicate with the target MCU and program its internal flash.

3. Power Supply Configuration

In my SystemClock_Config() function, I am currently using:

HAL_PWREx_ConfigSupply(PWR_LDO_SUPPLY);

The voltage scaling is configured as:

__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE3);

I am currently using the internal HSI oscillator as the system clock source, with PLL disabled.

RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
RCC_OscInitStruct.HSIState = RCC_HSI_DIV1;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;

RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;

4. GPIO Configuration and Testing

I initially tried testing GPIO PC12, PB1, and PF15.

For PF15, I configured the pin as:

  • Mode: GPIO Output Push-Pull

  • Pull-up/Pull-down: No Pull

  • Output Speed: Low

  • GPIOF clock enabled

My GPIO initialization code is:

__HAL_RCC_GPIOF_CLK_ENABLE();

HAL_GPIO_WritePin(GPIOF, GPIO_PIN_15, GPIO_PIN_RESET);

GPIO_InitStruct.Pin = GPIO_PIN_15;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;

HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);

For testing, I am using the following code inside the main while loop:

while (1)
{
HAL_GPIO_WritePin(GPIOF, GPIO_PIN_15, GPIO_PIN_SET);
HAL_Delay(2000);

HAL_GPIO_WritePin(GPIOF, GPIO_PIN_15, GPIO_PIN_RESET);
HAL_Delay(2000);
}

5. Observed Problem

Despite successful firmware programming and verification:

  • The LED connected to PF15 remains continuously ON.

  • The PF15 output appears to remain at approximately 3.3V.

  • I do not observe the expected HIGH-to-LOW transitions.

  • Similar GPIO testing on other pins has also not produced the expected results.

I have also checked that the GPIO port clock is enabled and that the GPIO is configured as an output.

6. Questions

I would appreciate your help with the following:

  1. Could this issue be related to the internal LDO or SMPS power configuration of the STM32H7A3ZIT6Q?

  2. Are there any additional power supply connections or configurations required for the LDO mode?

  3. Is there any specific initialization sequence required before enabling GPIO functionality?

  4. Could the VCAP, VDDLDO, VDDSMPS, or other power-related pins cause this type of GPIO malfunction if incorrectly connected?

  5. Is there a recommended procedure to verify whether the Cortex-M7 core is executing the application code correctly?

  6. Could any GPIO-related configuration, alternate-function assignment, or hardware restriction prevent PF15 from operating as a standard GPIO?

My main objective is to verify the basic GPIO functionality of my custom PCB before proceeding with other peripherals such as UART, SPI, I2C, and RS485.

I can also share my complete power supply schematic, PCB layout, and STM32CubeIDE configuration for further investigation.

Thank you for your time and support.

Best regards

 

schematics:

 

MM..1
MM..1Best answer
Super User

In my SystemClock_Config() function, I am currently using:

 

HAL_PWREx_ConfigSupply(PWR_LDO_SUPPLY);

The voltage scaling is configured as:

 

__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE3);

I am currently using the internal HSI oscillator as the system clock source, with PLL disabled.

you write my = no MX and your romain lacks info then i ask. But this is last reply in tone…
As you can see your or MX code never executed, then maybe open MX or MX2 and check if LDO is right here and beofre main init code is based on it

18 replies

MM..1
Super User

Primary check in debuger session if HAL_Delay realy works...

Associate

Since my  MCU never proceeds to main(), I cannot currently verify whether HAL_Delay() works.

 

I found that the MCU gets stuck before reaching the main() function.

The debugger stops inside ExitRun0Mode() in system_stm32h7xx.c, at this statement:

while ((PWR->CSR1 & PWR_CSR1_ACTVOSRDY) == 0U)
{
}

I checked the register values in the Expressions window:

  • PWR->CR3 = 6

  • PWR->CSR1 = 131072

  • ACTVOSRDY = 0

Could you please suggest how to investigate why the ACTVOSRDY flag is not being set?

TDK

Debug your code, hit pause, see where execution is at. It’s probably stuck somewhere before GPIO code. Possibly stuck during clock initialization.

 

If you can program the chip normally, that largely eliminates any potential power issues.

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

hello
My stlinkv2 debugger consistently gets stuck inside the ExitRun0Mode() function in system_stm32h7xx.c, at the following while loop (approximately line 487):

while ((PWR->CSR1 & PWR_CSR1_ACTVOSRDY) == 0U)
{
}

I checked the register values using the Expressions window:

PWR->CR3 = 6
PWR->CSR1 = 131072 (0x00020000)
(PWR->CSR1 & PWR_CSR1_ACTVOSRDY) = 0

The ACTVOSRDY flag never becomes set, so the MCU remains stuck in this loop and does not proceed to the application main() function. Consequently, GPIO initialization and GPIO output code are never executed.

Could this be related to the LDO/SMPS power configuration or the hardware power-supply connections?

Visitor II

Have you verified PF15’s voltage with an oscilloscope and checked the VCAP and power-supply connections against the STM32H7A3 datasheet?

Associate

Thank you for your suggestion.

I have checked the target supply voltage using a multimeter, and it reads 3.30V.

However, I have not yet verified the PF15 output using an oscilloscope. I will perform that test.

Regarding the VCAP and power-supply connections, I am reviewing them against the STM32H7A3ZIT6Q datasheet, particularly VCAP1, VCAP2, VDDLDO, VDDSMPS and VSSSMPS.

Currently, the debugger gets stuck inside ExitRun0Mode() while waiting for the ACTVOSRDY flag, before reaching main().

Could you also suggest which specific power-supply signals or voltage levels I should prioritize measuring?

Pavel A.

> debugger gets stuck inside ExitRun0Mode() while waiting for the ACTVOSRDY flag, before reaching main().

Can you show where exactly it loops? There are several places depending on various #defines.

https://github.com/STMicroelectronics/STM32CubeH7/blob/8ec3113d4039d30ba9dc2bf0cb6eefc756b48d06/Projects/NUCLEO-H7A3ZI-Q/Templates/Src/system_stm32h7xx.c#L378

etc.

 

Associate

The debugger stops at the following loop inside ExitRun0Mode() in system_stm32h7xx.c:

while ((PWR->CSR1 & PWR_CSR1_ACTVOSRDY) == 0U)
{
}

This is the exact line (line 378) where execution gets stuck. The debugger remains inside this loop because the ACTVOSRDY flag is not set.

I checked the register values while paused:

  • PWR->CSR1 = 0x00020000

  • (PWR->CSR1 & PWR_CSR1_ACTVOSRDY) = 0

Therefore, the loop condition remains true and execution never proceeds to main().

This is the ACTVOSRDY check in ExitRun0Mode(), rather than a loop in HAL_Delay() or my application code.

MM..1
Super User

You dnot reply tripple same think… And how you prepare your code ? MX or manual? H7 isnt simple.
Are you sure your schematics is for internal LDO and generated power setup too?

Associate

bro if you cant help dont try to as well 
the code is generated in cube mx 
 

Associate

Are you sure your schematics is for internal LDO and generated power setup too?
yes because all smps pin are ground

 

 

Associate

next time mark your tone

MM..1
MM..1Best answer
Super User

In my SystemClock_Config() function, I am currently using:

 

HAL_PWREx_ConfigSupply(PWR_LDO_SUPPLY);

The voltage scaling is configured as:

 

__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE3);

I am currently using the internal HSI oscillator as the system clock source, with PLL disabled.

you write my = no MX and your romain lacks info then i ask. But this is last reply in tone…
As you can see your or MX code never executed, then maybe open MX or MX2 and check if LDO is right here and beofre main init code is based on it

Associate

Hi,

First of all, I apologize for my earlier tone and responses. I appreciate that you  took  time to review my issue and provide suggestions.

I have now resolved the problem. I selected HSI as the clock source in the CubeMX Clock Configuration and commented out

  • (PWR->CSR1 & PWR_CSR1_ACTVOSRDY) = 0

the function containing the loop where the execution was getting stuck.

After making these changes, the code started executing successfully.

Thank you very much

MM..1
Super User

Generator MX must generate system init right before line place 

PWR->CR3 = (PWR->CR3 & ~PWR_CR3_SMPSEN) | PWR_CR3_LDOEN;

while ((PWR->CSR1 & PWR_CSR1_ACTVOSRDY) == 0U)
{
}

if not MX is buggy or bad setup. CR3 for LDO before while need value 0x2 not 0x6.

Pavel A.

> CR3 for LDO before while need value 0x2 not 0x6.

Value 0x6 is OK. This is also the default. Bit 2 (0x4) means something benign. (RM0433 pg.307) 

It looks like zeroing bit 0x4 can be used to lock the power config, so that occasional [single] write won’t break it?