cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX - Pinout Config - Select Alternative pins

Joe.H
Senior

I've been developing with STM32F4 products for years. Never used HAL or Cube products as I've hand configured everything.

Beginning a new MultiCore project using STM32H745. I find using CubeMX that when I select a peripheral (like SDMMC1 or SAI4 for example) - the tool selects what pins it wants to assign - and will NOT let me assign a different alternative pin.

How can I force the tool to use MY pin selection?

If I have used one of the peripheral default pins for something else - It make the whole peripheral RED and will not take my inputs.

So far I find the tool very unusable so I'm hoping someone can tell me how I can tell the tool what I want - not what it wants.

Please Note - Use SAI4 for example - I selected the alternative pin, I assigned its function from the dropdown list - but when I try to enable the peripheral - its ALL RED - so I have pins assigned but no peripheral enabled or recognized for code generation.

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Sara BEN HADJ YAHYA
ST Employee

Hello @Joe.H​ ,

Thanks for your feedback,

It is not always possible to change the default pin, this depends on the availability of the signal in the package of the MCU.

If you already used the default pins, CubeMX will automatically set for you the other options (ONLY IF AVAILABLE) otherwise it will make the whole peripheral RED and will not take your inputs (simply because your input don't support the peripherals signal).

Here's how you can check the availability of the signal.

1) you need to check pin/ball definition table in the MCU datasheet. In this table you will find the alternate functions that could be provided by each pin.

2) you have to check the availability of the signal in your package and the number of pins (available) that supports this signal. If there are more than 1 pin that can support this signal, you can change the default pin in CubeMX. otherwise you can't.

Here's a small example that may help you understand.

MCU: STM32H745ZITx(package LQFP144)

Default pins chosen by CubeMX for SPI2 (Full-duplex Master, NSS disabled) are : PC1 -> MOSI, PC2_C-> MISO and SCK -> PB10

In the datasheet of this MCU (DS12923) table8 we can find another pins that can support our signals which are : PB15 -> MOSI, PB14 -> MISO and PB13 -> SCK,

In this case, default pins can be changed. (if the default are used than CubeMX will do the work for you, else you can do a right click on the other pin e.g PB15 and you select SPI2_MOSI you will see that PC2_C turns gray ( not used))

For SAI4 A mode Master you will find that SAI4_FS_A and SAI4_SCK_A signals are only available in PE4 and PE5 so they cannot be changed, however SAI4_SD_A is available in PE6, PC1, PB2 and PD6, so the default pin (PE6) can be changed to one of the mentioned.

If you issue is solved, please close this post by clicking the "Select as Best" button. This will help other members of the community find this response more quickly :)

Regards,

Sara.

View solution in original post

10 REPLIES 10
TDK
Guru

You can enable the peripheral and let it choose the pins, then change the pins by selecting the alternate pin and choosing its function. The original pin will become unused when you do this. For single core chips, it works the other way around too, but CubeMX is awkward setting up dual core chips.

If something is red, hover over it to find out why. CubeMX generally has decent messages as to why something can't be enabled. No doubt it thinks the pin is already in use.

Attach your IOC if you can't get it to work.

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

The problem I'm finding is as you add more peripheral that use alternative pins - you get to a point where the default pin of a peripheral you want to add is used and the tool will not assign any pins nor accept you selecting a valid alternative. I feel like a dog chasing its own tail.

There appear to be people to whom clicking in MicroXplorer (today's CubeMX) is a blessing, others - including me - prefer using table/spreadsheet or its paper form. I guess this is related to how "visual" one is.

JW

TDK
Guru

> The problem I'm finding is as you add more peripheral that use alternative pins - you get to a point where the default pin of a peripheral you want to add is used and the tool will not assign any pins nor accept you selecting a valid alternative.

If you select pins after enabling each peripheral, instead of enabling all peripherals and then assigning pins, this can't be the case. Pins are locked once you select them. Unless, of course, that peripheral no longer has any valid pins to use.

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

I guess the tool is good for people just starting to do embedded design or design boards that use the "Default" peripheral pins (mine NEVER do).

I was hoping to just see the initialization code generated.

I'll just go back to manually configuring the CPU. I wanted to see if the tool had improved since I looked at it 4 years ago.

Sorry to say the tool does not fit my needs.

I too just use "Paper" - no visualization.

Thanks for your comments.

Sara BEN HADJ YAHYA
ST Employee

Hello @Joe.H​ ,

Thanks for your feedback,

It is not always possible to change the default pin, this depends on the availability of the signal in the package of the MCU.

If you already used the default pins, CubeMX will automatically set for you the other options (ONLY IF AVAILABLE) otherwise it will make the whole peripheral RED and will not take your inputs (simply because your input don't support the peripherals signal).

Here's how you can check the availability of the signal.

1) you need to check pin/ball definition table in the MCU datasheet. In this table you will find the alternate functions that could be provided by each pin.

2) you have to check the availability of the signal in your package and the number of pins (available) that supports this signal. If there are more than 1 pin that can support this signal, you can change the default pin in CubeMX. otherwise you can't.

Here's a small example that may help you understand.

MCU: STM32H745ZITx(package LQFP144)

Default pins chosen by CubeMX for SPI2 (Full-duplex Master, NSS disabled) are : PC1 -> MOSI, PC2_C-> MISO and SCK -> PB10

In the datasheet of this MCU (DS12923) table8 we can find another pins that can support our signals which are : PB15 -> MOSI, PB14 -> MISO and PB13 -> SCK,

In this case, default pins can be changed. (if the default are used than CubeMX will do the work for you, else you can do a right click on the other pin e.g PB15 and you select SPI2_MOSI you will see that PC2_C turns gray ( not used))

For SAI4 A mode Master you will find that SAI4_FS_A and SAI4_SCK_A signals are only available in PE4 and PE5 so they cannot be changed, however SAI4_SD_A is available in PE6, PC1, PB2 and PD6, so the default pin (PE6) can be changed to one of the mentioned.

If you issue is solved, please close this post by clicking the "Select as Best" button. This will help other members of the community find this response more quickly :)

Regards,

Sara.

Hello Sara, About tool I am quite satisfied ever if it has issue on code generation.

Just about alternate pin, Linux Mint 20.2 cinammon version (derivative of UBUNTU 20.x), CNTRL + Mouse click is no more working on both CubeMX and CubeIDE. It is a known issue or missing something on my pc?

Regards

Roberto

Hello @Community member​ ,

Could you please answer the following questions

1) Which CubeMX (CubeIDE) versions are you using ?

2) Did you notice this issue on a specific MCU or on all?

Regards,

Sara.

Hello @Sara BEN HADJ YAHYA​ about your question:

CubeMX 6.3.0 CubeIDE 1.7.0

Problem was present also on previous version, appeared on Linux Update from 19.x to 20.x to both IDE.

I cannot say all MCU are plagued by, for sure all I am currently using. All was working fine before updating OS.

Regards