Skip to main content
Graduate II
July 2, 2020
Solved

STM32F7xx.h: Strange USB_HS_PHYC_LDO_ENABLE definition

  • July 2, 2020
  • 5 replies
  • 1263 views

Hello,

STM32Cube_FW_F7_V1.16.0 Drivers/CMSIS/Device/ST/STM32F7xx/Include/stm32f730xx.h

defines

#define USB_HS_PHYC_LDO_ENABLE_Pos              USB_HS_PHYC_LDO_DISABLE_Pos

#define USB_HS_PHYC_LDO_ENABLE_Msk              USB_HS_PHYC_LDO_DISABLE_Msk

#define USB_HS_PHYC_LDO_ENABLE                  USB_HS_PHYC_LDO_DISABLE

This seems strange to me. Does setting USB_HS_PHYC_LDO_DISABLE bit enable or disable the LDO. Please comment/fix!

    This topic has been closed for replies.
    Best answer by Imen.D

    Hello,

    Thank you for reported this issue.

    You are right, this is looks a documentation issue.

    Bit 2 LDO_DISABLE: Controls disable of the High Speed PHY's LDO.

    0: LDO enabled

    1: LDO disabled

    Should be inverted writing 1 to this bit enables the LDO.

    I raised this internally for fix.

    Best Regards,

    Imen

    5 replies

    Super User
    July 2, 2020

    > Does setting USB_HS_PHYC_LDO_DISABLE bit enable or disable the LDO

    The reference manual is always the best source of information about what the registers do.

    Bit 2 LDO_DISABLE: Controls disable of the High Speed PHY's LDO.

    0: LDO enabled

    1: LDO disabled

    > Please comment/fix!

    Agreed it's a bit odd, but it is defined within the "/* Legacy */" section of the header file clearly indicating it's there to support old code which expects those definitions. The choice by ST is either to include it in the header and have old code work fine, or to take it out and have users ask why their code no longer works.

    Super User
    July 2, 2020

    Actually, on further review, it seems like the reference manual could be wrong. The code in "stm32f7xx_ll_usb.c" includes:

     /* Enable LDO */
     USB_HS_PHYC->USB_HS_PHYC_LDO |= USB_HS_PHYC_LDO_ENABLE;

    Either the reference manual is wrong, or that code doesn't do what they think it will do.

    There are some google hits which suggest the code snippet works correctly.

    Graduate II
    July 2, 2020

    Yes, that needs clafification from ST!

    Super User
    July 2, 2020

    What a shame.

    JW

    Imen.DAnswer
    Technical Moderator
    July 7, 2020

    Hello,

    Thank you for reported this issue.

    You are right, this is looks a documentation issue.

    Bit 2 LDO_DISABLE: Controls disable of the High Speed PHY's LDO.

    0: LDO enabled

    1: LDO disabled

    Should be inverted writing 1 to this bit enables the LDO.

    I raised this internally for fix.

    Best Regards,

    Imen