Skip to main content
SJ.7
Visitor II
February 12, 2022
Solved

Error "unable to connect to the target" while flashing to ST NUCLEO-H7A3ZI-Q board.

  • February 12, 2022
  • 2 replies
  • 1084 views

Hai, I am using ST NUCLEO-H7A3ZI-Q board and I am new it. It worked properly for first one or two times. But now I cant flash code into it, it say "unable to connect to the target". Then I tried STM32CubeProgrammer to connect it and ts connected in 'Power down' mode. Then I performed Full chip erase. After that the board worked properly.

But the problem arises again when I reconnected the board and I done the full chip erase again.

That is I need to run the full chip erase every time I power the board.

How can I resolve the problem?

Thank you.

Sachin

This topic has been closed for replies.
Best answer by Tesla DeLorean

Make sure your code sets LDO/SMPS and VOS settings appropriately, and doesn't disable, change or reconfigure the SWD involved pins.

Check SystemClock_Config(), etc, here example for NUCLEO-H7A3ZI-Q from H7 repo

static void SystemClock_Config(void)
{
 RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
 RCC_OscInitTypeDef RCC_OscInitStruct = {0};
 
 /*!< Supply configuration update enable */
 HAL_PWREx_ConfigSupply(PWR_DIRECT_SMPS_SUPPLY); // << THIS
 
 /* The voltage scaling allows optimizing the power consumption when the device is
 clocked below the maximum system frequency, to update the voltage scaling value
 regarding system frequency refer to product datasheet.
 */
 __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE0);
 
 while(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {}
 
...

2 replies

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
February 12, 2022

Make sure your code sets LDO/SMPS and VOS settings appropriately, and doesn't disable, change or reconfigure the SWD involved pins.

Check SystemClock_Config(), etc, here example for NUCLEO-H7A3ZI-Q from H7 repo

static void SystemClock_Config(void)
{
 RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
 RCC_OscInitTypeDef RCC_OscInitStruct = {0};
 
 /*!< Supply configuration update enable */
 HAL_PWREx_ConfigSupply(PWR_DIRECT_SMPS_SUPPLY); // << THIS
 
 /* The voltage scaling allows optimizing the power consumption when the device is
 clocked below the maximum system frequency, to update the voltage scaling value
 regarding system frequency refer to product datasheet.
 */
 __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE0);
 
 while(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {}
 
...

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
MM..1
Chief III
February 12, 2022

I mean your code put MCU to STOP or any low power mode. This result to unable to connect.

You have two ways out

  1. activate your code from low power before flash
  2. in configuration programming setup Enable debug in low power modes,