cancel
Showing results for 
Search instead for 
Did you mean: 

How to use STM32CubeMX's 'pin stacking' function

diverger
Senior
Posted on September 13, 2017 at 12:35

In the latest version, I find there is a 'pin stacking'  choice when configure a pin. But I can't find any description of this function. What's the purpose of this function and how it work?

#pin-stacking
7 REPLIES 7
Chris Jameson-Groves
Associate II
Posted on November 21, 2017 at 11:13

This appears to allow a pin to be assigned for multple purposes (for example GPIO and I2C). I was excited when I saw this feature as I expected it to generate seperate functions which can be called to simply switch which purpose you wish to use it for. However, at the moment when you select pin stacking and compare the generated code with the same project without pin stacking you can see that those pins gets absolutly nothing generated. Its affectivly the same as not assigning those pins at all.

Hopefully this will be a feature in the near future?!!?

Imen.D
ST Employee
Posted on November 21, 2017 at 13:45

Hello,

I will raise your feedback to CubeMx team.  All your suggestion are welcome.

Best Regards

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on November 21, 2017 at 14:19

Many thanks. Its great to see a company actively monitoring their forums for issues and suggestions

I have found a few other issues/bugs. Should I post them in a new topic to report them?

Posted on November 21, 2017 at 15:17

Hello

Jameson_Groves.Chris

,

You can report your finding issues in the STM32 forum, then ST moderators will take in charge to answer you or raiseyour feedback/issues internally to the appropriate team.

We appreciate your contribution as this will help us to improve our solutions.

Best Regards,

Imen.

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
stm32cube-t
Senior III
Posted on November 27, 2017 at 11:58

Hello,

The pin stacking function is currently introduced for board design purposes only. There is no effect on the generated code.

It allows board designers to set all the possible pin configurations offer by a board design and that can be achieved through different solder bridge configurations on the board.

Best regards/

Posted on November 27, 2017 at 12:22

It does effect the code generated as any stacked pins get nothing generated. I understand why it does this, but just wanted to point out that the statement 'There is no effect on the generated code' is incorrect.

Posted on November 29, 2017 at 09:01

Hello Chris,

Thanks for your feedback.

I actually found two issues

1/ Code is duplicated (using test.ioc attached)

I used an instance of I2C1 and on one of the pin I stacked other signals.

The following code is generated twice in the main.c and in the hal_msp.c file:

/*Configure GPIO pin : PA9 */

GPIO_InitStruct.Pin = GPIO_PIN_9;

GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;

GPIO_InitStruct.Pull = GPIO_PULLUP;

GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;

GPIO_InitStruct.Alternate = GPIO_AF4_I2C1;

HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

2/ when a pin gets assigned stacked signals no “GPIO_InitStruct.Alternate = “ gets generated in MX_GPIO_Init (test_stackedpins.ioc)

I guess this is the issue you are talking about, correct?

I guess you would expect MX to generate at least the “GPIO_InitStruct.Alternate =�? the AF for the first signal being stacked?

/*Configure GPIO pin : PA9 */

GPIO_InitStruct.Pin = GPIO_PIN_9;

GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

GPIO_InitStruct.Pull = GPIO_NOPULL;

GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;

GPIO_InitStruct.Alternate = GPIO_AF2_TIM1;/** to generate

HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

Thanks for your feedback,

I will log the issue in our bug tracking system once I get your confirmation.

________________

Attachments :

test.ioc.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HyBv&d=%2Fa%2F0X0000000b5R%2FkXNhG6kdiBRdo8lrAdToTTehLq1RPmrSsDIONFSfhFk&asPdf=false

test_stackedpins.ioc.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HxkL&d=%2Fa%2F0X0000000b5Q%2F5DhL_rSz5rZ7Tr_aU6gGGcswuRNGvF.3yvtXOAFaeyQ&asPdf=false