I have USB UART User Module in my project . After I issue Clear_Endpoint_Feature to my Bulk In endpoints , all further BULK IN request are NAK by my device . How to fix this issue?
The Clear_Endpoint_Feature is allows the host to remove the HALT from the specified endpoints. Once this command is issued the device should clear the HALT is the corresponding endpoint and report the success through ACK . All further transfer through that endpoint will be successful.
Now in case of using the USBUART UM after issuing the Clear_Endpoint_Feature to the Bulk In endpoints what happens is it clears the HALF if any and instead of an ACK the device NACKs the Host . All further IN transfers request to this Endpoint will be NACKed until the device is reset . Below is the method to over come this issue .
The Clear_Endpoint_Features is a standard request and is handled by the USBUART_std.asm file . The function ' USBUART_CB_h2d_std_ep_01' handles this function request . Scroll down in this function and find the below lines .
; Mark endpoint as empty so it will be reloaded mov [X+USBUART_EndpointAPIStatus], NO_EVENT_PENDING mov reg[X + USBUART_EP1MODE - 1], USB_MODE_ACK_OUT ; JMP .done .in: mov [X+USBUART_EndpointAPIStatus], NO_EVENT_PENDING MOV REG[X + USBUART_EP1MODE - 1], USB_MODE_NAK_IN ; .done:
Change the highlited value i.e, USB_MODE_NAK_IN to USB_MODE_ACK_IN .
Attached is the project which contains the modified component.