Skip to content

AF naming convention #2

@fpistm

Description

@fpistm

It seems on AF is not properly named:

#define GPIO_AF4_OTG_HS ((uint8_t)0x04) /*!< OTG-HS Alternate Function mapping */

It should be GPIO_AF4_USB_OTG_HS and not GPIO_AF4_OTG_HS

Generate a project using STM32CubeMX with PA14 configured to be USB OTH SOF generate this msp code:

    /**USB_OTG_HS GPIO Configuration
    PD7     ------> USB_OTG_HS_DM
    PD6     ------> USB_OTG_HS_DP
    PA14(JTCK/SWCLK)     ------> USB_OTG_HS_SOF
    */
    GPIO_InitStruct.Pin = GPIO_PIN_14;
    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
    GPIO_InitStruct.Pull = GPIO_NOPULL;
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
    GPIO_InitStruct.Alternate = GPIO_AF4_USB_OTG_HS;
    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

Which is correct based on the Cube MX database definition:
https://github.com/STMicroelectronics/STM32_open_pin_data/blob/3d64b1076ac7f0bf0f74acf89b9578b530f37ed7/mcu/STM32WBA65RIVx.xml#L1024C23-L1024C37

Oter USB OTG HS AF is correctly defined:

#define GPIO_AF10_USB_OTG_HS ((uint8_t)0x0A) /*!< USB OTG-HS Alternate Function mapping */

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggpioGeneral Purpose Inputs and OutputshalHAL-LL driver-related issue or pull-requestinternal bug trackerIssue confirmed and logged into the internal bug tracking system

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions