2021-02-02 10:10 AM
Hello,
I am using a STM32L471QGI6 MCU and its reference manual (RM0351) is:
Regards the "Reset value:" written in the RM0351 document I have a specific question:
Let's take this example:
8.5.3 GPIO port output speed register (GPIOx_OSPEEDR)
(x = A to I)
Address offset: 0x08
Reset value: 0x0C00 0000 (for port A)
Reset value: 0x0000 0000 (for the other ports)
My question is:
I assume I have to expect the "Reset value" for the GPIOx_OSPEEDR register at the start of the MCU and before the initialization of the GPIOx? Is that right? Well, this is not what happens! I use IAR Embedded Workbench and when I go into debug I find another value that is 0x000000C0, my question is why?! I emphasize that this is before any initialization in the C program.
Could it be the document is wrong ?!
Thanks
2021-02-03 02:48 AM
Any idea is appreciated @Tilen MAJERLE @Jocelyn RICARD
2021-02-03 02:51 AM
Did you really set a breakpoint on the very first instruction? If you break in main(), a lot may have happend!
2021-02-03 02:54 AM
Indeed I break before the main(), I just miss some inits by assembly file (like a startup.s) which should not initialize the GPIO. May I ask what is your approach to put a breakpoint at the very first instruction?
2021-02-03 03:02 AM
Just to be sure, did you enable GPIOA clock in RCC before reading registers? If not, you are not reading valid values.
2021-02-03 03:06 AM
@Tilen MAJERLE Yes it is
2021-02-03 03:21 AM
If you do not know your startup entry, read it at 0x08000002 and set a breakpoint at that address. But better look at the label given in your startup file. And startup may already set up things with regard to GPIO.
2021-02-03 03:23 AM
@Tilen MAJERLE Well I break during the configuration of the GPIO and clock is enabled before that.
2021-02-03 12:35 PM
@Tilen MAJERLE I edited the last part of the question the problem is only with the GPIOx_OSPEEDR register for GPIOB. (I had done some modifications to understand why the problem happens and some other values were wrong due to that but that was originally the problem and still is)
I also noticed that also the reset values of the USART_ISR register do not correspond to the RF, however, unlike GPIO here (for USART) the reset values do not dependent on enabling clock, meaning that before or after enabling the RCC the USART registers have the reset values (except USART_ISR of course! )
could you explain this, please?
2021-02-03 01:10 PM
Thanks, I tried putting a breakpoint where the initialization starts, same results! So the place of the breakpoint should not be the issue.