cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F072 GPIO Register inaccesible

Thomas Wilson
Associate
Posted on July 15, 2018 at 23:44

Hello STM Community, 

I'm trying to evaluate the STM as a viable alternative to NXP MCUs. However, I have encountered a very early issue with accessing GPIO registers for a simple custom blinky program. I'm working in Keil uV5. When running the STM32F072 blinky example, I can see all of the registers changing as expected in the peripherals register viewer (ODR |= (GPIOC_P << x).... etc...). However, when running my custom program, none of the registers are updating (see pic). I have checked the disassembly and all of the register addresses are equivalent between both projects (PORTC GPIO BASE = 0x4800 0800). I have enabled the peripheral clock in the custom project. Am I missing another initialization stage that might prevent me accessing the STM32 registers? 

0690X0000060MCzQAM.png

Frustrating to be stuck at such an early stage. I'm hoping that things will move a lot faster once the project is up and running. Any advice greatly appreciated.

#gpio #keil-mdk5 #stm32f072
6 REPLIES 6
AvaTar
Lead
Posted on July 16, 2018 at 09:12

I don't know Keil's IDE in detail, but AFAIK, a realtime update of debug views is never the default value.

Many/most IDEs have the option to enable this 'realtime' update for certain or all viewed elements, but usually, those views (registers, variables, memory) are only updated when you hit a breakpoint.

Posted on July 16, 2018 at 10:51

I have enabled the peripheral clock in the custom project.

Check, by reading back content of the respective RCC register.

JW

Posted on July 16, 2018 at 09:30

Hi Avatar,

thanks for the response. I have been setting breakpoints during testing, and still no register updates. The strange behaviour is that the basic Blinky program from ST is working correctly, whereas my new system can’t seem to update the peripheral registers. I don’t really want to go down the route of starting a project from a Blinky template, because I believe that this problem I’m encountering is highlighting an area that I haven’t understood correctly about the initialisation process. 

Posted on July 16, 2018 at 09:44

The F072 is an 'older' MCU variant, I would assume the toolchain/debugger support is correct.

Have you checked you MCU init code, perhaps you have a bug there or miss something ?

As an example, you could step through the clock initialization, which is done in the startup code (before jumping to main). This code sets several clock registers which you can try to watch.

henry.dick
Senior II
Posted on July 16, 2018 at 12:03

'

I have enabled the peripheral clock in the custom project.'

'you think you have' and 'you have' are two different things.

'Am I missing another initialization stage that might prevent me accessing the STM32 registers? '

critical thinking. what you have shown is indisputably a software problem. yet you found it helpful not to show your software.

you have to help others help you.

Bob Boys
Senior

Hello

Updating registers in Keil uVision is ON be default.

There is a global setting - when in debug mode, select View and ensure Periodic Window Update is enabled.

If windows update only when you stop the program, check this setting. Call Stack does not update nor some Trace windows - but most windows Watch, Memory, Peripherals, System Analyzer etc do.

Not all settings in a peripheral view will update when the program is running. I believe this can be set in the SVD file. Sometimes reading a peripheral register can change a flag and this would not be a good idea for the debugger to do this.

Bob