Skip to main content
Visitor II
July 3, 2019
Solved

Bug: HAL_DeInit() causes the STM32H7 microprocessor to reset.

  • July 3, 2019
  • 3 replies
  • 1839 views

Hi All,

Calling HAL_DeInit() causes the STM32H7 micro to reset when it executes __HAL_RCC_AHB3_FORCE_RESET();

#define __HAL_RCC_AHB3_FORCE_RESET() (RCC->AHB3RSTR=0xFFFFFFFFU)
 
HAL_StatusTypeDef HAL_DeInit(void)
{
 /* Reset of all peripherals */
 __HAL_RCC_AHB3_FORCE_RESET(); // <-- Causes CPU reset
 __HAL_RCC_AHB3_RELEASE_RESET();
.
.
.
}

I assume it is because it is writing 1's to reserved bits. Replacing the macro with the following fixes the issue:

#define __HAL_RCC_AHB3_FORCE_RESET() RCC->AHB3RSTR |= (RCC_AHB3RSTR_MDMARST \
| RCC_AHB3RSTR_DMA2DRST \
| RCC_AHB3RSTR_JPGDECRST \
| RCC_AHB3RSTR_FMCRST \
| RCC_AHB3RSTR_QSPIRST \
| RCC_AHB3RSTR_SDMMC1RST)

I hope this gets fixed in the next HAL release. It caused me a lot of headaches :)

Cheers,

David

    This topic has been closed for replies.
    Best answer by lutztonineubert

    Sorry. As i see, it is fixed.

    3 replies

    Technical Moderator
    July 3, 2019

    Hello @DOsbo​ ,

    We raised this issue internally for check and we will come back to you soon with update.

    Thanks for your contribution.

    Best Regards,

    Imen

    Technical Moderator
    December 26, 2019

    Hello @DOsbo​ ,

    Thanks for your proposal.

    This issue will be fixed in the coming release.

    Best Regards,

    Imen

    Visitor II
    July 14, 2021

    Sorry. As i see, it is fixed.