USB keyboard cannot be enumerated by KSDK2.0

cancel
Showing results for 
Search instead for 
Did you mean: 

USB keyboard cannot be enumerated by KSDK2.0

321 Views
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

Labels (1)
0 Kudos
1 Reply

98 Views
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 Kudos