GPIO Demo Program etc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-30 11:29 AM
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)
Solved! Go to Solution.
- Labels:
-
STM32CubeIDE
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-30 12:47 PM
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)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-30 12:23 PM
Hello,
For MBED questions please open a thread in their community.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-30 12:33 PM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-30 12:40 PM
In that case you need to tell which board you are using in order to guide you efficiently.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-30 12:47 PM
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)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-30 12:50 PM
Hi, I am using the NUCLEO-GO31K8
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-30 12:52 PM
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.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-01-31 02:45 AM
thanks - that makes sense.
