Skip to main content
Associate III
Jul 24, 2025 10:34 PM UTC
Solved

STM32U5G9 USB device ux_device_stack_initialize() error 18

I am using STM32U5G9 implementing USB MSC device. When calling function ux_device_stack_initialize(), it returns error 18, which is correspond to UX_MEMORY_INSUFFICIENT.  This error happens line 397 of use core file  ux_device_stack_initialize.c.

if (endpoints_pool -> ux_slave_endpoint_transfer_request.ux_slave_transfer_request_data_pointer == UX_NULL)

{

status = UX_MEMORY_INSUFFICIENT;

break;

}

 

May I know how to fix this error?

This topic has been closed for replies.
FBLBest answer
ST Technical Moderator
Oct 23, 2025 1:48 PM UTC

Hi @Kelly3 

The USBX device stack relies on a memory pool for dynamic allocations. If this pool is too small or not properly initialized, allocations will fail. Try to increase the size of the memory pool buffer passed to USBX.

To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.Best regards,FBL

1 reply

FBLBest answer
ST Technical Moderator
Oct 23, 2025 1:48 PM UTC

Hi @Kelly3 

The USBX device stack relies on a memory pool for dynamic allocations. If this pool is too small or not properly initialized, allocations will fail. Try to increase the size of the memory pool buffer passed to USBX.

To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.Best regards,FBL