0
votes

I'm experimenting with standby mode. IDE is STM32CubeIDE, mcu stm32f407vgt9. So I read in datasheet that mcu leave standby mode if one of following condition are fullfiled:

WKUP pin rising edge, RTC alarm (Alarm A and Alarm B), RTC wake-up, tamper event, time-stamp event, external reset in NRST pin, IWDG reset.

MCU get into standby mode by this function HAL_PWR_EnterSTANDBYMode() if I well understand. I do that and I expect if mcu got high on WKUP pin (PA0) mcu will exit standby mode. I want this simple code to exacute.

  while (1){
  HAL_PWR_EnterSTANDBYMode();
  
  HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_SET);
  HAL_Delay(3000);

  HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_RESET);
  HAL_Delay(3000);}

MCU go into standby mode but leaving standby mode never occur. I try to connect PA0 with high but nothing is happen.

I want to flash another code but that is now not possible because I go this error from STM32CubeIDE:

Error in final launch sequence:

Error in initializing ST-LINK device.

Reason: (4) No device found on target.

How I can solve this problem? Before experimenting with standby I got this error several times and I was successful solve him by connecting NRST pin with GND (hardware restart mcu) but now it doesn't work because after reset code will be automatically execute. Connecting NRST with GND and trying to flash code it is not possible (new error will occur which indicate that currently is activated hardware reset: Error in initializing ST-LINK device. Reason: (8) Target held under reset.).

Any idea is welcome

1
After standby the cpu resets, your writepin will never execute. Can you flash your program whithout going into standby? Did you enable debugging in low power modes?KamilCuk
You are right with about code executing. I can't flash other code after I flash code with standby function. Where I can enable that function (debugging in low power modes0?subavet995
In multiple places. You neeed to write to DBGMCU_CR register. You can enable it in openocd or in your code. sourceforge.net/p/openocd/mailman/message/33251349 or with HAL_EnableDBGStandbyMode or something similar. Right now, connect BOOT0 or BOOT1 (I don't remember) to ground or vcc (I don't remember) and enter to bootloader mode. Re-flash your firmware that way.KamilCuk
I found solution, and solution is same as yours. Connect NRST with GND and BOOT0 with 3V, then disconnect NRST and GND after that try to flash/debug codesubavet995

1 Answers

0
votes

This is solution:

Connect NRST with GND and BOOT0 with 3V, then disconnect NRST and GND after that try to flash/debug code.