cancel
Showing results for 
Search instead for 
Did you mean: 

ADP (USB Attachment Detection Protocol) on STM32L4

TNagy.1
Associate

Hi All,

Does anyone use the ADP feature in any STM MCUs? I'm trying to set it up on an STM32L496AG. The reference manual (47.15.19) says: "In order to read from the OTG_GADPCTL register, program AR=0b01 and keep polling till AR=0b00. The core updates the other fields of this register and makes AR=0b00. Read values of this register are valid only when AR=0b00."

When I write AR to 0b01, it stays 0b01 forever, the core never makes AR=0b00.

I tried writing too, but AR is stuck that way too.

OTG FS clock is enabled with __HAL_RCC_USB_OTG_FS_CLK_ENABLE().

Can anyone give me some hint on what could be wrong? I've also tried to search for STM specific information regarding ADP, but didn't found anything. If someone has some information, it would be appreciated.

3 REPLIES 3

Is ADP enabled in OTG_GPWRDN.OTG_GPWRDN?

No, I don't use this feature. Yes, the Synopsys OTG module's documentation is a disaster.

JW

According to the reference manual, in OTG_GPWRDN two bits are defined: ADPIF and ADPMEN (bit 23 and bit 0). All other bits are reserved. I've set ADPMEN to 1 before writing OTG_GADPCTL.AR

Do you have an OTG_GPWRDN.OTG_GPWRDN in some documentation?

Sorry, typo, I meant OTG_GPWRDN.ADPMEN.

There may be other inter-relationships, e.g. with OTG_GCCFG.PWRDWN.

Isn't there any example implementation in Cube, for any OTG using this feature i.e. also in other STM32 models?

JW