USB Host Pipe Descriptors is NULL?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

USB Host Pipe Descriptors is NULL?

跳至解决方案
566 次查看
mooreken
Contributor II

Hello, I am using a FRDM-K22F and attempting to read and write files to an USB drive. Earlier I used the host_msd_fatfs_bm example program to get a working start. That program worked fine, next I integrated the usbh_sdk_bm_lib into a newly generated project using the KSDK project generator. When I added the files from the host_msd_fatfs_bm project into my generated one I get USB Host Initialization fail!: STATUS: 0x81. This appears to come from the USB host pipe descriptor memory allocation. I'm guessing I missed something before the USB host pointer is allocated here. Checking the memory location for the usb_host_ptr I find that is is allocated properly but its field, namely the pipe descriptor is not, and in turn is freed. Most of this is held in the khci.c source file.

 

usb_khci_host_state_struct_t* usb_host_ptr = (usb_khci_host_state_struct_t*) OS_Mem_alloc_zero(sizeof(usb_khci_host_state_struct_t));

    pipe_struct_t* p;

    pipe_struct_t* pp;

    int32_t i;

if (NULL != usb_host_ptr)

    {

        usb_host_ptr->device_attach_phy = 0;

        /* Allocate the USB Host Pipe Descriptors */

        usb_host_ptr->pipe_descriptor_base_ptr = (pipe_struct_t*)OS_Mem_alloc_zero(sizeof(pipe_struct_t) * USBCFG_HOST_MAX_PIPES);

        if (usb_host_ptr->pipe_descriptor_base_ptr == NULL)

        {

            OS_Mem_free(usb_host_ptr);

            return USBERR_ALLOC;

        }

I appreciate any and all help,

Thanks.

标签 (1)
标记 (2)
0 项奖励
1 解答
442 次查看
mooreken
Contributor II

It turns out that the heap size was too small, quick and easy fix!

在原帖中查看解决方案

0 项奖励
1 回复
443 次查看
mooreken
Contributor II

It turns out that the heap size was too small, quick and easy fix!

0 项奖励