This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RM48L950ZVT HALCoGen USB driver bugs

Other Parts Discussed in Thread: HALCOGEN

Greetings to all.

  I have trouble with USB device driver generated by latest HALCoGen 04.05.00 for RM48L950ZVT CPU. I have found several bugs in USB device driver. I have created the patch (http://pastebin.com/CZpQN9LL) which fixes most of them, but not all. Here is detailed description for individual changes

1) usb.c - line 285 - USBDevEndpointStall - missing endpoint specification to usbd0Regs->epnum

2) usb.c - line 333 - USBDevEndpointStallClear - missing endpoint specification to usbd0Regs->epnum

3) usb.c - line 454 - USBEndpointDataAvail - mask the endpoint with USBD_EP_NUM_EP_NUM_MASK

4) usb.c - line 536 - USBEndpointDataGet - do NOT ack received data to FIFO. Acked by USBDevEndpointDataAck function

5) usb.c - line 574 - USBDevGetSetupPacket - typo

6) usb.c - line 651 - USBDevEndpointDataAck - missing endpoint specification to usbd0Regs->epnum, removed double write to usbd0Regs->epnum

7) usbdcdc.c - line 1335 - ProcessDataToHost - When sending data packet to host with size == maxpacketsize, empty packet must follow

8) usbdconfig.c - line 545 - USBDeviceConfig - using declared constant instead of "magic number"

9) usbdenum.c - line 1939, 1985 - USBDGetDescriptor - clear pEP0Data pointer when signaling STALL (no data to send later in function)

10) usbdenum.c - line 3029 - USBDeviceIntHandlerInternal - using declared constant instead of "magic number"

Next issue is in USB send function (USBEndpointDataPut) when interrupted by USB interrupt function, it destroys selected endpoint for writing in usbd0Regs->epnum. This issue is not fixed by the patch.

NEED HELP ↓

But one issue I'm not able to solve. It is STALL signaling. For example when reading not existing "string descriptor", device should respond with STALL to signal to the hast that function failed, but it not respond. Stall function is called but on USB line there are only NAKs forever. See http://snag.gy/3S4EX.jpg  It can be tested with "Thesycon USB Descriptor Dumper" from here http://www.thesycon.de/eng/usb_descriptordumper.shtml .