Problem with Enumeration of CY4601 USB to Serial v1.0 devicexc

Question: After changing the descriptors, sometimes the CY4601 USB to Serial v1.0 device does not enumerate properly.Why?

 

Answer:

The mentioned issue applies to v1.0 of the CY4601 USB to Serial reference design. This problem will not show up unless the descriptors are changed as described below.

If the developer changes the descriptors such that one of the descriptor lengths is a multiple of the maximum packet length, the device will not enumerate properly. The default maximum packet length of the v1.0 reference design is 8 Bytes.

To fix this problem, the Start_Control_Read function in the usb_to_serial.asm file should be modified. Anytime a data packet in response to an IN request is the length of the maximum packet length, the host will follow with another IN request. If a transfer on EP0 is a multiple of the maximum packet length (8 Bytes), the function below will not properly send a zero length packet for the IN request following the last 8 byte data packet. Instead, the firmware assumes the next request will be a zero length status OUT packet which is incorrect.

Below is a piece of the Start_Control_Read function with the last type lines modified to fix the problem.

Control_Read:

 

push X ;
iord EP0_MODE ; Clear packet flags
and A, MODE ;
iowr EP0_MODE ;


;----------------------------------------------------------------

; If there is no data left to send, set
; mode to ACK_IN_STATUS_OUT and exit.
 

mov A, [data_count] ; is there any data left to send
cmp A, 00h ;

jnz Control_Read_More_Data ; if so then continue control read
mov A, ACK_IN_STATUS_OUT ; no data to send, so status out only
mov [ep0_next_mode], A ;
mov X, 00h ; New line for the Fix
jmp Load_Loop_Done ; Changed from "jmp Control_Read_Done"