Skip to main content
Associate II
September 29, 2023
Solved

STM32U5 - USB CDC UART not working

STM32U575VIT6Q
Configured USB_OTG_FS to Device only mode and further configured ThreadX and USBX..

But when running the code it always get stuck at this Memory insufficient error..

velmuruganbel_0-1696011845590.png

    This topic has been closed for replies.
    AScha.3
    AScha.3Best answer
    Super User
    September 29, 2023

    at which size you set it ?

    (for host) i set pool size 0x8000 , stack size 24*1024 B.

    If you feel a post has answered your question, please click on " Best Answer ".

    6 replies

    AScha.3
    AScha.3Best answer
    Super User
    September 29, 2023

    at which size you set it ?

    (for host) i set pool size 0x8000 , stack size 24*1024 B.

    If you feel a post has answered your question, please click on " Best Answer ".
    Associate II
    October 4, 2023

    Hi @AScha.3 ,

    Thanks for your response.

    I set pool size as 0x8000 and stack size as 24*1024, but still the firmware stuck at the Memory insufficient error..
    Can you share me your configurations? or your code for my reference with only USB peripheral active..

    velmuruganbel_0-1696456058364.png

    velmuruganbel_1-1696456088406.png

     

    velmuruganbel_2-1696456126051.png

     

     

     

    AScha.3
    Super User
    October 5, 2023

    sharing my code would not help you, it has nothing in common with your project, except using this Azure/usbx.

    but i see, in your debug pic , pool start - end = 512 B. thats not enough. i have 24KB here.

    see:

    AScha3_0-1696511508900.png

    but you set Application thread stack size also to 24K. try set this at 1024 (as i did).

    and read the info, cube is giving : (we hope, its right...)

    AScha3_1-1696512133192.png

     

    If you feel a post has answered your question, please click on " Best Answer ".
    Associate II
    October 5, 2023

    Hi @AScha.3 ,

    Thanks for your response.

    I changed configuration as follows and it resolved the memory allocation issue. But, the USB is not detected on the device manager on the PC. Not sure if i am missing anything else. Let me know if you have any suggestions. Thanks a lot for your support.
    UXDevice memory pool size = 1024*26
    USBX Device System Stack Size = 1024*22
    USBX Device Application Thread Stack Size = 1024

    AScha.3
    Super User
    October 6, 2023

    well, after about 50 hours try+debug , i got it almost running (audio host).... :expressionless_face:

    look at example , maybe you can find something, thats missing in your code:

    https://github.com/STMicroelectronics/STM32CubeU5/tree/7942fc4ea05026e4e9ce72d680f704e9433bce42/Projects/NUCLEO-U575ZI-Q/Applications/USBX/Ux_Device_CDC_ACM

     

    usb doing "nothing" - i found, on my chip (H563zit) usb-vdd power was NOT enabled ! so it will never do anything on the usb-lines ;  needed : 

    /* Drive vbus */

    USBH_DriverVBUS(USB_VBUS_TRUE);

    If you feel a post has answered your question, please click on " Best Answer ".
    Associate II
    October 5, 2023