cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMx won't generate MX_GPIO_Init() function for my GPIO pins

Michael98006
Associate III

When I create a new project in CubeMx 5.3.0 for the STM32H745-DISCO board with or without default peripheral initialization and configure, for example, pins PA8 and PF8 as GPIO_Output, they appear on the list of GPIO pins, but the function MX_GPIO_Init() in main.c generated by CubeMx doesn't have any initialization code for those pins and the corresponding ports. CubeMx generates the correct code for GPIO pin initialization for single-core MCU's, such as the H743, but it seems like it doesn't work for the dual-core MCU's such as H745.

1 ACCEPTED SOLUTION

Accepted Solutions
Khouloud ZEMMELI
ST Employee

​Hello @Community member​ ,

You're working with a dual core MCU so you need to specify in which context you need this pin.

Right click on pin then under "Pin Reserved" Choose one of the 2 Cortex.

0690X00000AQmYhQAL.png

Best Regards,

Khouloud.

View solution in original post

5 REPLIES 5
Khouloud ZEMMELI
ST Employee

​Hello @Community member​ ,

You're working with a dual core MCU so you need to specify in which context you need this pin.

Right click on pin then under "Pin Reserved" Choose one of the 2 Cortex.

0690X00000AQmYhQAL.png

Best Regards,

Khouloud.

Michael98006
Associate III

Thank you so much, Khouloud! This worked for me.

This menu (for selecting Cortex-M4 vs Cortex-M7) is really well hidden!

The menu item name "Pin Reservation" doesn't mean much, so none of the engineers on my team were able to figure out how to get to the context assignment menu.

I wish the interface for selecting M4 vs M7 was designed similar to other peripheral selection, on the left-hand side of the window, where we have checkboxes in two columns: One for M4 and another for M7.

aqueisser
Senior

OMG - worst interface ever. Glad I found this post to fix my problem

Agreed - bad interface - not obvious at all - Also glad to have found this answer.

Since '75, I been codin', stayin' proud.
I started on punch cards, now I'm takin' it to the cloud.
Peter BENSCH
ST Employee

For anyone who also stumbles across this and wonders whether they really need to set each GPIO individually: no, of course not.

You can also change several pins together by:

  • switching to the GPIO overview (e.g. A->Z > GPIO or Categories > System Core > GPIO)
  • marking the GPIO to be changed in the table Configuration (center column)
  • then in the table below (different settings lead to a white field) set the setting for all GPIO via the item Pin Context Assignment

Hope that helps.

/Peter

In order 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.