cancel
Showing results for 
Search instead for 
Did you mean: 

Toggling GPIOs on STM32F205RGT6

Jorge Troncoso
Associate II
Posted on February 07, 2018 at 04:36

Hi,

We designed a new PCB for the STM32F205RGT6, but we�re having trouble toggling GPIOs using the chip.

We wrote a simple program that toggles a GPIO every 250ms, we confirmed that the code works on the

http://www.st.com/en/evaluation-tools/nucleo-f207zg.html

and the

http://www.st.com/en/evaluation-tools/stm3220g-eval.html

, but when we port the code to our PCB it doesn�t work.

We know the code is running on the microcontroller soldered on our PCB and we know the MCU is reaching the critical section where it toggles the GPIO (because we were able to step through the code using gdb), however, for some reason we�re not seeing any change in voltage on the pin.

I attached the source code, the Makefile, and the linker script we�re using to this post. You can also check out our project on GitHub:

https://github.com/MITMotorsports/stm32f2_libs/tree/gpio_ll_cleanup/examples/gpio_ll

Any help would be much appreciated.

#stm32f205
13 REPLIES 13
Posted on February 09, 2018 at 15:08

first of all, debugging initially is frustrating, as you have to eliminate a lot of potential faults.

the key to any debugging is to assume as little as possible, at least initially. here, I would start with the most basic hardware + most basic software. and expand from there. for example, I would try to establish that the chip is powered, the reset pin is in the right state, and the chip can be programmed (with an empty main) for example.

once you have established that the hardware is working (ie the chip can be programmed and it executes code), write a very basic piece of code, like flipping a pin/pins, without using any library.

With CMSIS, it is easy to get the chip going. All you need to do is to route the clock to GPIO, and set the pins to output mode and flip them. You can observe the pins' state to confirm if the code is running as expected. If not, go through the RCC/GPIO registers to see if the registers' state is as expected.

and then go from there.

If you need help, I can send you a short few lines to get you started here.

a couple of advice:

1. you picked a chip that's not widely used. the F2 is a rare animal,

2. you aren't doing a good job helping others help you. you appear to have good equipment at hand (with a debugger), and you could have told people what was happending with your code / registers when you step through them. over-communicating is better than under-communicating, especially when you don't know what's wrong.

hope it helps.

Posted on February 09, 2018 at 15:27

1. you picked a chip that's not widely used. the F2 is a rare animal,

Yes, but it's essentially identical to 'F4, except the core is M3 rather than M4, which doesn't really matter as long as thre's no floating-point calculation (and a few rarely used SIMD instructions).

If not, go through the RCC/GPIO registers to see if the registers' state is as expected.

+1 (i.e. read their content and check/post here).

JW

Posted on February 09, 2018 at 16:54

Couple of M4 specific instructions that will crash an M3, normal build in Keil can generate them.

Attached is a test binary, please try this and see if PB10 toggles.

What is a viable USART here to output to a console? PB2 looks to be viable for an SWV output, step 2 might be to use that.

What does the flag on BOOT0 pin mean?

________________

Attachments :

GPIO_B10.hex.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006Hy1J&d=%2Fa%2F0X0000000b3F%2FmR0TxG6RSxnk41lKdT2coimrIn75zph4FJ7q_J7IGfE&asPdf=false
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Jorge Troncoso
Associate II
Posted on February 11, 2018 at 22:24

Hi everyone,

We populated a new board, tested the same code attached to the original post on the new board, and it worked! We still don't know why the previous board wasn't working (we were able to program it fine but we couldn't toggle GPIOs) but at least we can move forward now. Thanks for the help!