Skip to main content
Senior III
August 16, 2023
Question

Peripheral reset timings

  • August 16, 2023
  • 3 replies
  • 1582 views

Hello,
I have a question regarding the peripheral reset registers.
For the G070 device, in the RM0454, section 5.2.16, it is specified that the clock enable of a peripheral takes 2 cycles to prevent glitches. Fine.
However, how do you experts use the reset registers ? Let's say that you want to reset the CRC peripheral.
I'm doing it like so for the moment:

RCC->AHBENR |= RCC_AHBENR_CRCEN; // Turn ON CRC peripheral clock
delay_us(5);
RCC->AHBRSTR = RCC_AHBRSTR_CRCRST; // Reset peripheral
delay_us(5);
RCC->AHBRSTR = 0;
delay_us(5);

But I don't know if any delays are indeed needed or not here. Any thought on this ?

Best regards,
Kraal

This topic has been closed for replies.

3 replies

TDK
August 16, 2023

There's no need to use the reset registers on an initial powerup as the registers will all be at their initial values.

"If you feel a post has answered your question, please click ""Accept as Solution""."
KraalAuthor
Senior III
August 16, 2023

Thanks but that is not an answer to the question. If you jump from a bootloader to an application you might want to reset an already configured and used peripheral to its reset state.

Pavel A.
August 16, 2023

This is an interesting topic. See these threads for example:

https://community.st.com/t5/stm32-mcu-products/erratum-quot-delay-after-an-rcc-peripheral-clock-enabling-quot/m-p/580729#M220378

https://community.st.com/t5/stm32-mcu-products/inline-assembly-macro-inconsistent/m-p/580743#M220384

Bottom line: unless very restricted in time, delay for a *few* clocks. Use a reliable method for the delay.