cancel
Showing results for 
Search instead for 
Did you mean: 

How to change pin functions?

jstor.1the lost one
Associate II

I dont know much about all this and I want to learn how to change functions in the GPIO registers. do You use the Cube IDE ? and are there any good tutorials on how to change pin functions ?

4 REPLIES 4
gregstm
Senior III

Find the reference manual for your particular chip, and study the "GPIO section" - all the information you require is in the reference manual, that's all I have ever used. It is fairly readable. I use C to write/OR/AND directly to these registers. No matter whether you use direct C or the Cube approach - a good understanding of the underlying hardware is always useful.

Amel NASRI
ST Employee

Hi @jstor.1the lost one​ ,

Welcome to ST Community and STM32 World 🙂

Please accept a remark from my side regarding the form of your post (and others you have already submitted): Try to ask your question on the body and add a title when submitting it. This enhances content visibility on the Community and helps to get answers. (I'll edit it this time).

Now back to your request, based on your other requests, I assume that you are using STM32F401 as it is not precised here.

You find dedicated examples for ST boards using same device under STM32CubeF4 package:

There are already 2 GPIO examples there, the readme.txt files explain how to use them.

The examples are based on HAL drivers. It is also possible to use the LL drivers which allow direct access to GPIO registers.

Finally, a special gift for you: https://wiki.st.com/stm32mcu/wiki/GPIO_feature_overview.

It is a wiki content that explains what are GPIOs and guide you to build your own example in order to explain more the feature.

To build your own example, you can select the device you are using instead of STM32L4.

If my answer is helpful for you, you can select it as best Answer so that this request is marked as solved.

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

jstor.1the lost one
Associate II

Thank you Amel, this was very helpful. the chip I have is green in color but is labeled as black pill, stm32f401ccu6. my main question about this chip is it the same as the version 2 as far as alternate functions ? and are gpio pins the same as far as default at reset ?

Hi @jstor.1the lost one​ ,

To answer your new questions, I recommend you too refer to @Community member​ 's reply.

Reference manual to use in your case is RM0368.

-Amel

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.