USB keyboard cannot be enumerated by KSDK2.0

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

USB keyboard cannot be enumerated by KSDK2.0

672 次查看
hiwave
NXP Employee
NXP Employee

Hello, Wanghao

 

Customer have a  1D/2D scanner (USB keyboard device) which can be enumerated with KSDK1.3, but cannot by KSDK2.0.  Could you please help to check ? Thanks !

 

Best Regards

Derek

标签 (1)
0 项奖励
回复
1 回复

449 次查看
cutworth
NXP Employee
NXP Employee

Hi Derek,

This issue can be fixed with the following code in bold added in usb_host_devices.c file.

static usb_status_t USB_HostProcessCallback(usb_host_device_instance_t *deviceInstance)
{
usb_host_pipe_t *pipe = (usb_host_pipe_t *)deviceInstance->controlPipe;
usb_status_t status = kStatus_USB_Success;
usb_descriptor_configuration_t *configureDesc;
volatile uint32_t i = 0xffffU;
usb_host_instance_t *hostInstance = (usb_host_instance_t *)deviceInstance->hostHandle;

switch (deviceInstance->state)
{
case kStatus_DEV_GetDes8: /* process get 8 bytes descriptor result */
pipe->maxPacketSize = deviceInstance->deviceDescriptor.bMaxPacketSize0;
hostInstance->controllerTable->controllerIoctl(
hostInstance->controllerHandle, kUSB_HostUpdateControlPacketSize, deviceInstance->controlPipe);
break;

case kStatus_DEV_SetAddress: /* process set address result */
while(i--)
{
;
}
deviceInstance->setAddress = deviceInstance->allocatedAddress;
hostInstance->controllerTable->controllerIoctl(
hostInstance->controllerHandle, kUSB_HostUpdateControlEndpointAddress, deviceInstance->controlPipe);
break;

The enumeration failure is caused by USB host sending set address request too fast to USB device. It needs to wait for some time.

Hao

0 项奖励
回复