cancel
Showing results for 
Search instead for 
Did you mean: 

The STM32CubeIDE has a debugger window that lets you look at the SPF (Special Function Registers). Why are the set of GPIO registers not included? I am trying to see if RA2 and RA9 are set up the same. But I do not know how to look at them in the debugger

KiptonM
Lead

0693W00000Nsq6uQAB.png 

This lets me see most registers. Why are the GPIO registers not included?

How do I examine their settings?

Normally I would print them out, but I am trying to debug the serial port so I cannot print them out to a terminal.

Thanks,

5 REPLIES 5
KiptonM
Lead

I made local variables for each of the GPIO registers and it looks like AFRL = 0x1100 and AFRH is 0x0000,

Looking at the alternate function registers (STM32G051K8T) for PA2 and PA9 PA2 should be AF1 for USART2_TX and PA9 should be AF1 for USART1_TX

It looks like the MX program correctly set AFRL bits to 0001 for PA2, but set them to 0000 for PA9.

Is someone going to tell me that is another known bug with the MX program?

KiptonM
Lead

Just added a line

GPIOA->AFR[1] |= 0x10;

to my code and that fixed the issue. USART1 is now transmitting in polling mode. Took about 8 hours to figure out this MX bug.

KiptonM
Lead

Just attached the final main.c program that fixed the issue. And the .ioc file

KiptonM
Lead

Great it overwrote the main c program. Nothing is easy...

Maybe this is an opportunity to reconsider merits and demerits of clicking vs. programming.

JW​