Skip to main content
Visitor II
Mar 2, 2026 9:16 AM UTC
Question

STM32F405RGT6: reset command doesn't work after flash operation

求助篇!
使用主控芯片STM32F405RGT6 在操作flash后 复位指令不起作用 这是什么问题呢?
////////////////////以下是代码段////////////////////////////

/*注释以下语句就可以自动复位成功*/

Translation:

I'm using STM32F405RGT6 microcontroller, the reset command doesn't work after flash operation. What could be the problem?

HAL_FLASH_Unlock();

if (HAL_FLASH_Program(TYPEPROGRAM_WORD, FWR_ADDR, 0) != HAL_OK)

{

printf("Clear OTA flag error\n");

} else {

HAL_Delay(10);

uint32_t flag_sttus = HAL_FLASH_GetError;

if(flag_sttus & HAL_FLASH_ERROR_PGA)

{

printf("flash_err!\r\n");

}

printf("Clear OTA flag\n");

}

HAL_FLASH_Lock();


请各位大佬看看是什么情况 感谢!!!!

Translation:

Could someone please take a look and tell me what's going on? Thanks

3 replies

mƎALLEm
ST Technical Moderator
Mar 2, 2026 9:22 AM UTC

Hello @Wu_wu and welcome to the St community,

1- In next time please use English in this community. This is not a Chinese Forum.

2- To share a code please use </> button.

Please see How to write your question to maximize your chances to find a solution

PS: I've edited your post to complies with this community rules.

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
TDK
Mar 2, 2026 12:14 PM UTC

There's no reset command in the posted code.

Does HAL_FLASH_Program work? Does it return an error code?

Insufficient information is presented.

"If you feel a post has answered your question, please click ""Accept as Solution""."
Pavel A.
Mar 2, 2026 7:29 PM UTC
HAL_FLASH_GetError(); // note the ()

Look for the compiler warnings.