cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F7xx.h: Strange USB_HS_PHYC_LDO_ENABLE definition

Uwe Bonnes
Principal III

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!

1 ACCEPTED SOLUTION

Accepted Solutions
Imen.D
ST Employee

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

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

View solution in original post

5 REPLIES 5
TDK
Guru

> 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.

If you feel a post has answered your question, please click "Accept as Solution".
TDK
Guru

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.

If you feel a post has answered your question, please click "Accept as Solution".
Uwe Bonnes
Principal III

Yes, that needs clafification from ST!

What a shame.

JW

Imen.D
ST Employee

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

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen