USBX初始化出现UX_MEMORY_INSUFFICIENT错误
如题,芯片L4,USBX做MSC和HID功能。初始化时出错。下在这句返回UX_MEMORY_INSUFFICIENT
ret =_ux_device_stack_initialize(NULL,
0,
device_framework_full_speed,
device_framework_fs_length,
string_framework,
string_framework_length,
language_id_framework,
languge_id_framework_length, UX_NULL);
跟踪进去,就发现错误。
while (endpoints_pool < (device -> ux_slave_device_endpoints_pool + endpoints_found))
{
/* Obtain some memory.*/
endpoints_pool -> ux_slave_endpoint_transfer_request.ux_slave_transfer_request_data_pointer =
_ux_utility_memory_allocate(UX_NO_ALIGN, UX_CACHE_SAFE_MEMORY, UX_SLAVE_REQUEST_DATA_MAX_LENGTH);
/* Ensure we could allocate memory.*/
if (endpoints_pool -> ux_slave_endpoint_transfer_request.ux_slave_transfer_request_data_pointer == UX_NULL)
{
status = UX_MEMORY_INSUFFICIENT;
break;
}
/* Create the semaphore for the endpoint.*/
status =_ux_utility_semaphore_create(&endpoints_pool -> ux_slave_endpoint_transfer_request.ux_slave_transfer_request_semaphore,
"ux_transfer_request_semaphore", 0);
/* Check completion status.*/
if (status != UX_SUCCESS)
{
status = UX_SEMAPHORE_ERROR;
break;
}
/* Next endpoint.*/
endpoints_pool++;
}
USBX_MEMORY_SIZE这个改大就对了,已经解决了。这个内存和整个协议栈的内存还不是一个概念。 USBX_MEMORY_SIZE 这个值与应用的具体情况相关,生成代码设的都比较小。 第一个红框把原本的改小
页:
[1]