Skip to main content
Visitor II
November 21, 2021
Solved

USB Composite in STM32MP157c

  • November 21, 2021
  • 2 replies
  • 2984 views

I am struggling to achieve a USB gadget with Mass Storage + rndis.

When i start each service alone everything works but when i am trying

to start both of them i receive the following error:

dwc2_hsotg_ep_enable: No suitable fifo found

Any suggestion how to modify the dtsi in order to achieve it .

Speed is not a conserne i can reduce the speed to full-speed as well.

Thanks,

Thanasis

    This topic has been closed for replies.
    Best answer by AKokk

    Hello @Kevin HUBER​ ,

    No I solved the issue by changing the usbotg_hs: usb-otg@49000000 device tree to :

    g-rx-fifo-size = <256>;

    g-np-tx-fifo-size = <32>;

    g-tx-fifo-size = <128 128 128 128 64 32 16 16>; 

    Regards,

    Thanasis

    2 replies

    Technical Moderator
    November 22, 2021

    Hi @AKokk​ ,

    Could you please share more details about context ? ST board or custom design ?

    Which OpenSTLinux ecosystem version ?

    Providing complete logs in text format would also greatly help

    Thanks

    Olivier

    AKokkAuthor
    Visitor II
    November 22, 2021

    Hi @Community member​ ,

    Thanks for your reply. 

    We are using a custom board based on the QSMP-1570 from Karo-Electronics .

    We are using a yocto image based on Linux 5.10.23 Mainline + STM patches provided by karo electronics.

    We have modified the drivers/usb/dwc2/gadget.c in order to receive information

    about the FIFO size with the following patch:

    if (!fifo_index) {

     dev_err(hsotg->dev,

    - "%s: No suitable fifo found\n", __func__);

    + "%s: No suitable fifo of size %u found\n", __func__,

    + size);

    The error we receive is the following:

    dwc2 49000000.usb-otg: dwc2_hsotg_ep_enable: No suitable fifo of size 512 found

    Usb Speed is not a concern for our project .

    Our dtsi for the otg drivers looks like :

    usbotg_hs: usb-otg@49000000

    {

    compatible = "st,stm32mp1-hsotg", "snps,dwc2";

    reg = <0x49000000 0x10000>; clocks = <&rcc USBO_K>;

    clock-names = "otg"; resets = <&rcc USBO_R>;

    reset-names = "dwc2";

    interrupts-extended = <&intc GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>, <&exti 44 1>;

    interrupt-names = "event", "wakeup";

    g-rx-fifo-size = <512>;

    g-np-tx-fifo-size = <32>;

    g-tx-fifo-size = <256 16 16 16 16 16 16 16>; dr_mode = "otg";

    usb33d-supply = <&usb33>;

    power-domains = <&pd_core>;

    wakeup-source; status = "disabled";

    };

    The log of the error is the following:

    root@qsmp-1570:~# modprobe g_multi file=/home/usbdisk.img host_addr=11:22:33:44

    55:66 dev_addr=aa:bb:cc:dd:ee:ff

    [ 118.270433] using random self ethernet address

    [ 118.273593] using random host ethernet address

    [ 118.277883] using self ethernet address: aa:bb:cc:dd:ee:ff

    [ 118.278274] Mass Storage Function, version: 2009/09/11

    [ 118.288833] LUN: removable file: (no medium)

    [ 118.293136] LUN: file: /home/usbdisk.img

    [ 118.296663] Number of LUNs=1

    [ 118.300585] usb0: HOST MAC ea:db:58:44:90:f4

    [ 118.304223] usb0: MAC aa:bb:cc:dd:ee:ff

    [ 118.308341] g_multi gadget: Multifunction Composite Gadget

    [ 118.313260] g_multi gadget: userspace failed to provide iSerialNumber

    [ 118.319731] g_multi gadget: g_multi ready

    [ 118.323834] dwc2 49000000.usb-otg: bound driver g_multi

    root@qsmp-1570:~# [ 118.482754] dwc2 49000000.usb-otg: new device is high-spee

    [ 118.516042] ------------[ cut here ]------------

    [ 118.519225] WARNING: CPU: 0 PID: 0 at kernel/dma/debug.c:1012 check_unmap+0x84/0xa1c

    [ 118.527037] DMA-API: dwc2 49000000.usb-otg: device driver frees DMA memory with different direction [device address=0x00000000c41fd000] [size=18 bytes] [map                                      ed with DMA_TO_DEVICE] [unmapped with DMA_FROM_DEVICE]

    [ 118.545826] Modules linked in: g_multi

    [ 118.549576] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.10.23-karo+gdfbf345b3c3 #1

    [ 118.557225] Hardware name: STM32 (Device Tree Support)

    [ 118.562380] [<c010e11c>] (unwind_backtrace) from [<c010aa48>] (show_stack+0x0/0x14)

    [ 118.570117] [<c010aa48>] (show_stack) from [<c095707c>] (dump_stack+0x94/0xa

    [ 118.577338] [<c095707c>] (dump_stack) from [<c0952a54>] (__warn+0xb8/0x114)

    [ 118.584297] [<c0952a54>] (__warn) from [<c0952b48>] (warn_slowpath_fmt+0x98/xc0)

    [ 118.591781] [<c0952b48>] (warn_slowpath_fmt) from [<c018796c>] (check_unmap+x184/0xa1c)

    [ 118.599873] [<c018796c>] (check_unmap) from [<c0188298>] (debug_dma_unmap_pae+0x94/0x9c)

    [ 118.608056] [<c0188298>] (debug_dma_unmap_page) from [<c06d51a8>] (usb_gadge_unmap_request+0x7c/0x90)

    [ 118.617366] [<c06d51a8>] (usb_gadget_unmap_request) from [<c06a3a38>] (dwc2_sotg_complete_request+0xec/0x1dc)

    [ 118.627371] [<c06a3a38>] (dwc2_hsotg_complete_request) from [<c06a5234>] (dw2_hsotg_handle_outdone+0x220/0x2d4)

    [ 118.637552] [<c06a5234>] (dwc2_hsotg_handle_outdone) from [<c06a5f98>] (dwc2hsotg_epint+0x20c/0x7ec)

    [ 118.646777] [<c06a5f98>] (dwc2_hsotg_epint) from [<c06a7a4c>] (dwc2_hsotg_ir.part.0+0x438/0x6f0)

    [ 118.655653] [<c06a7a4c>] (dwc2_hsotg_irq.part.0) from [<c016cce0>] (__handleirq_event_percpu+0x50/0x130)

    [ 118.665223] [<c016cce0>] (__handle_irq_event_percpu) from [<c016cea0>] (hande_irq_event+0x5c/0xc8)

    [ 118.674274] [<c016cea0>] (handle_irq_event) from [<c01719ac>] (handle_fasteo_irq+0x9c/0x204)

    [ 118.682801] [<c01719ac>] (handle_fasteoi_irq) from [<c016c55c>] (__handle_doain_irq+0x80/0xd4)

    [ 118.691504] [<c016c55c>] (__handle_domain_irq) from [<c04cdd48>] (gic_handleirq+0x70/0x84)

    [ 118.699858] [<c04cdd48>] (gic_handle_irq) from [<c0100b0c>] (__irq_svc+0x6c/xa8)

    [ 118.707331] Exception stack(0xc0e01f28 to 0xc0e01f70)

    [ 118.712385] 1f20:          00000000 0000d104 d7afa8c4 c01145e0 c0e0000 00000000

    [ 118.720566] 1f40: 00000000 c0e00000 00000000 410fc075 10c5387d 00000000 000227a c0e01f78

    [ 118.728743] 1f60: c0107efc c0107f00 60070013 ffffffff

    [ 118.733800] [<c0100b0c>] (__irq_svc) from [<c0107f00>] (arch_cpu_idle+0x38/03c)

    [ 118.741197] [<c0107f00>] (arch_cpu_idle) from [<c0148144>] (cpuidle_idle_cal+0x198/0x22c)

    [ 118.749462] [<c0148144>] (cpuidle_idle_call) from [<c0148284>] (do_idle+0xac0xe0)

    [ 118.757032] [<c0148284>] (do_idle) from [<c01485a8>] (cpu_startup_entry+0x180x20)

    [ 118.764605] [<c01485a8>] (cpu_startup_entry) from [<c0d00de8>] (start_kernel 0x35c/0x37c)

    [ 118.772776] ---[ end trace ce7310cc6145e5e1 ]---

    [ 118.777386] DMA-API: Mapped at:

    [ 118.780524] dma_map_page_attrs+0x70/0xd4

    [ 118.784529] usb_gadget_map_request_by_dev.part.0+0xe8/0x1ec

    [ 118.790184] dwc2_hsotg_ep_queue.constprop.0+0x224/0x418

    [ 118.795492] dwc2_hsotg_ep_queue_lock+0x30/0x48

    [ 118.800016] composite_ep0_queue.constprop.0+0x20/0x9c

    [ 118.805310] dwc2 49000000.usb-otg: new address 2

    [ 118.859559] usb0: qlen 10

    [ 118.860789] dwc2 49000000.usb-otg: dwc2_hsotg_ep_enable: No suitable fifo of size 512 found

    [ 120.434028] usb0: gether_disconnect

    Technical Moderator
    January 5, 2022

    Hello @AKokk​ ,

    Do you still encounter the problem?

    Regards,

    Kevin

    AKokkAuthorAnswer
    Visitor II
    January 7, 2022

    Hello @Kevin HUBER​ ,

    No I solved the issue by changing the usbotg_hs: usb-otg@49000000 device tree to :

    g-rx-fifo-size = <256>;

    g-np-tx-fifo-size = <32>;

    g-tx-fifo-size = <128 128 128 128 64 32 16 16>; 

    Regards,

    Thanasis

    Technical Moderator
    January 7, 2022

    Hi @AKokk​ ,

    Great! Thanks for your reply with the solution.

    As an explanation for other users, the default configuration is:

    g-tx-fifo-size = <256 16 16 16 16 16 16 16>;

    This configuration is made to use only one usb gadget function.

    If you want to use more than one function at the same time, here Mass Storage + RNDIS, you have at least to increase the size of the second fifo.

    What you did by setting:

    g-rx-fifo-size = <256>;

    g-np-tx-fifo-size = <32>;

    g-tx-fifo-size = <128 128 128 128 64 32 16 16>; 

    Regards,

    Kevin