cancel
Showing results for 
Search instead for 
Did you mean: 

GPIO Demo Program etc

AndrewR
Associate

Hello, can someone point me to where there are some demo programs for working with GPIO as individual pins and creating a bus from a number of outputs. I am also looking for a demo program with general s/w based timers, for example, in mbed which is what I am porting from, you would do

thread_sleep_for(1000);  // 1ms timer or delay

and to create a bus

BusOut select_drv(dp11,dp4, dp5, dp6, dp9, dp10); //creates a bus called select_drv

thanks

AndrewR

 

(I attached the code)

 

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

There is no "create a bus" function in HAL. You can control individual pins with HAL_GPIO_WritePin.

A delay of 1-2ms can be done with HAL_Delay(1)

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

6 REPLIES 6
SofLit
ST Employee

Hello,

For MBED questions please open a thread in their community.

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.
PS:
1 - This is NOT an online support (https://ols.st.com) but a collaborative space.
2 - Please be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help.
AndrewR
Associate

Hello, I'm trying to get away from mbed* and on to a stable dev platform which is why I came here.  I really want to avoid using mbed moving forward and I dont want or need anyone to write or debug my code.I'm just looking for STM32Cube IDE demo programs so I can see how to work with the peripherals - are these available anywhere? Is there a repository where I can get these?

Regards

AndrewR

 

*mbed is going to be closed down in 2026, and developers are leaving the platform. There isn't any point in remaining with it.

In that case you need to tell which board you are using in order to guide you efficiently.

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.
PS:
1 - This is NOT an online support (https://ols.st.com) but a collaborative space.
2 - Please be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help.
TDK
Guru

There is no "create a bus" function in HAL. You can control individual pins with HAL_GPIO_WritePin.

A delay of 1-2ms can be done with HAL_Delay(1)

If you feel a post has answered your question, please click "Accept as Solution".

Hi, I am using the NUCLEO-GO31K8

The STM32's group GPIO pins in groups of 16 per bank

GPIOB->ODR = 16-bit vector, for GPIO[0..15] on BANK B

GPIOB->BSSR = 32-bit vector, lower 16-bits SETTING, upper 16 CLEARING

The latter providing a way to set/reset a mix of pins, all or a subset, in a singular write operation.

For the Output Data Register you'd need to RMW (Read-Modify-Write) to mask off and set bits (pins) you want to change

The software here isn't going to generate a combining vector here, you'll have to manage that.

 

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..