Skip to main content
Visitor II
July 15, 2024
Question

The usb can not init OK, and error in USB_DevInit.

  • July 15, 2024
  • 3 replies
  • 1302 views

USB_FlushTxFifoc & USB_FlushRxFifo API flag USB_OTG_GRSTCTL_TXFFLSH & USB_OTG_GRSTCTL_RXFFLSH can not clear when set.

    This topic has been closed for replies.

    3 replies

    Technical Moderator
    July 15, 2024

    Hi @jimmy_cheng 

    Typically, you have an issue to initialize your USB PHY consequently core init. Check you clock configuration, your sequence to configure the PHY. 

    Visitor II
    July 15, 2024

    Hi, @FBL 

    I use the USB3340-EZK and checked the clock configuration is correct,and the USB_CoreInit API can return HAL_OK.

    It's run OK last week, but get the HAL_TIMEOUT in "Flush TX /RX Fifo " this week. I have no change.

     

    jimmy_cheng_0-1721060898712.png

    The local variables below when break stop on 469 line.

    numuint32_t0x10
    USBxUSB_OTG_GlobalTypeDef *0x40040000
    GOTGCTL volatile uint32_t 0x30100c0
    GOTGINT volatile uint32_t 0x100000
    GAHBCFG volatile uint32_t 0x0
    GUSBCFG volatile uint32_t 0x40001410
    GRSTCTL volatile uint32_t 0x80000000
    GINTSTS volatile uint32_t 0x14000020
    GINTMSK volatile uint32_t 0x0
    GRXSTSR volatile uint32_t 0x0
    GRXSTSP volatile uint32_t 0x0
    GRXFSIZ volatile uint32_t 0x400
    DIEPTXF0_HNPTXFSIZ volatile uint32_t 0x4000400
    HNPTXSTS volatile uint32_t 0x80400
    Reserved30 uint32_t [2] 0x40040030
    GCCFG volatile uint32_t 0x0
    CID volatile uint32_t 0x2300
    GSNPSID volatile uint32_t 0x4f54330a
    GHWCFG1 volatile uint32_t 0x0
    GHWCFG2 volatile uint32_t 0x229fe190
    GHWCFG3 volatile uint32_t 0x3b8d2e8
    Reserved6 uint32_t 0xe3f00030
    GLPMCFG volatile uint32_t 0x0
    GPWRDN volatile uint32_t 0xc200010
    GDFIFOCFG volatile uint32_t 0x3b80400
    GADPCTL volatile uint32_t 0x0
    Reserved43 uint32_t [39] 0x40040064
    HPTXFSIZ volatile uint32_t 0x0
    DIEPTXF volatile uint32_t [15] 0x40040104
    countvolatile uint32_t0x0

     

    Technical Moderator
    July 16, 2024

    Hi @jimmy_cheng 

    I have seen a similar issue on F4, could you confirm inserting __DSB(); resolves the issue to ensure transaction is complete.

    Visitor II
    July 16, 2024

    Hi, @FBL 

    I inserted the __DSB(), but can not solve my issue. But still get the HAL_TIMEOUT return.

    jimmy_cheng_0-1721125571473.png

     

    Technical Moderator
    August 14, 2024

    Hi @jimmy_cheng 

    Did you update the latest version of CubeH7?