Code generation - wrong alternate function with partial USB and SDMMC initialization
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-23 2:01 AM - edited ‎2024-04-23 2:03 AM
Relevant to this post, created new one per @STTwo-32's recommendation.
When some USB and SDMMC pins are in the GUI set to alternate function without their respective peripherals active, then there is code generated in MX_GPIO_Init() function that renders FDCAN1 nonfunctional.
Here is what's needed:
MCU STM32H723ZGT
In the GUI - Pins PD0 and PD1 mapped to FDCAN1 (RX, TX) with the peripheral enabled.
Pins PB14, PB15, PD6, PD7, PG11, PG12 mapped to SDMMC (D0, D1, CK, CMD, D2, D3) without the peripheral enabled.
PA11, PA12 to USB DM and DP without the peripheral enabled.
This code is generated in MX_GPIO_Init() which sets PA11 and PA12 to incorrect alternate function.
... /*Configure GPIO pins : PB14 PB15 */ GPIO_InitStruct.Pin = GPIO_PIN_14|GPIO_PIN_15; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Alternate = GPIO_AF9_SDMMC2; HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); /*Configure GPIO pins : PA11 PA12 */ GPIO_InitStruct.Pin = GPIO_PIN_11|GPIO_PIN_12; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
Now FDCAN1 on pins PD0 and PD1 is not working.
IDE version: 1.15.0
STM32CubeMX version: 6.11.0
Solved! Go to Solution.
- Labels:
-
Bug-report
-
STM32CubeIDE
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-23 6:57 AM
Hello @heveskar
The problem is that the function "GPIO_InitStruct.Alternate" is not generated for USB pins. I've escalated this internally for correction under ticket number 179725.
For the FDCAN, you can find the configuration on the stm32h7xx_hal_msp.c file of your project.
Best Regards.
STTwo-32
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-23 2:42 AM
>This code is generated in MX_GPIO_Init() which sets PA11 and PA12 to incorrect alternate function.
Whats incorrect here ?
+
>Now FDCAN1 on pins PD0 and PD1 is not working.
How you know ?
+
Could you attach your ioc file, to see, whats there ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-23 3:02 AM
> What's incorrect?
Missing initialization of .Alternate member.
> How you know?
Because it happened in our project.
> Could you attach ioc file?
Why? I described the exact steps what has to be there in order to generate this code. Nothing else is needed.
Your responses are not helpful at all, the same way you were lecturing me about ADC clocks in my other post when I was clearly right.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-23 3:20 AM
Sorry for tying to help you. I never will do again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-23 6:57 AM
Hello @heveskar
The problem is that the function "GPIO_InitStruct.Alternate" is not generated for USB pins. I've escalated this internally for correction under ticket number 179725.
For the FDCAN, you can find the configuration on the stm32h7xx_hal_msp.c file of your project.
Best Regards.
STTwo-32
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-23 9:10 AM
@STTwo-32 Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-23 9:13 AM
@AScha.3 I did not want to be rude, just that your second comment on my second post was not really helpful in my opinion. Sometimes comments on discussion forums on internet seem to be more arrogant than they really are. I am glad you were trying to help, sorry.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-04-26 7:33 AM
Hello @heveskar
The configuration does not get generated For the USB functions since those are additional and not alternate functions.
Best Regards.
STTwo-32
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.
