Skip to main content
waclawek.jan
Super User
September 3, 2017
Question

[OTG + Cube] Writing 0 to DIEPCTL/DOEPCTL.EPDIS

  • September 3, 2017
  • 2 replies
  • 940 views
Posted on September 03, 2017 at 19:37

In [STM32Cube_FW_F4_V1.16.0]\Drivers\STM32F4xx_HAL_Driver\Src\stm32f4xx_ll_usb.c  USB_EPSetStall(), the following can be seen:

USBx_INEP(ep->num)->DIEPCTL &= ~(USB_OTG_DIEPCTL_EPDIS);

(and the same for DOEPCTL).

However, according to respective RM, EPDIS bit in both DIEPCTL and DOEPCTL are rs (read-set) and read-only for endpoint 0, i.e. writing 0 has no effect.

Comment, please.

JW

    This topic has been closed for replies.

    2 replies

    Vangelis Fortounas
    Associate II
    September 5, 2017
    Posted on September 06, 2017 at 00:13

    Hello!

    You have right.

    Before set STALL bit, for non isochronous (and non control) IN and OUT EPs, according to manual must disable first the EP by set EPDIS.

    Inside USB_EPSetStall() function,STALL bit is set without disabling the EP first.

    From an other point of view, this is an LL driver and normaly USB_EPSetStall()  func should sets the STALL bit only. There are also other functions for disabling the EP.(USB_DeactivateEndpoint(..),..).

    In my opinion the next code is redundant (also for the OUT EP) and of course, as you wrote, has no effect.

    0690X000006088cQAA.png

    Take a look  also at ctrl IN endpoint. It is from same RM.(needs some correction also)

    0690X000006088WQAQ.png

    Regards

    vf

    Khouloud GARSI
    Technical Moderator
    September 6, 2017
    Posted on September 06, 2017 at 16:06

    Hi Jan,

    I confirm this misalignment and I have reported it internally. 

    By the way, all your reported requests (regarding USB documentation/drivers...) are well received. We will treat all of them one by one and come back to you with an answer ASAP.

    Many thanks for your valuable presence on our STM32 MCUs forum and for your continuous contribution to the enhancement of our STM32 resources.

    Khouloud.

    waclawek.jan
    Super User
    September 6, 2017
    Posted on September 06, 2017 at 16:53

    Thanks

    Khouloud.

    Jan

    Khouloud GARSI
    Technical Moderator
    September 6, 2017
    Posted on September 06, 2017 at 17:01

    You're always welcome.

    Khouloud.