Forum Discussion

FabriceNs's avatar
FabriceNs
Icon for New Contributor rankNew Contributor
14 hours ago

USB Device Issue on Cyclone V / HPS

Hello,

Please find below a description of the USB issue we are experiencing with our Cyclone V / HPS board.

To test our USB interface, we integrated the TinyUSB library into our existing firmware and enabled FreeRTOS support.

Since the Cyclone V is not natively supported, I implemented the missing functions using Altera's hwlib, which we already use in our project (source file attached).

The USB is used only in Device mode. I tested the following four configurations:

  • Full-Speed with Slave mode
  • Full-Speed with Simple DMA
  • High-Speed with Slave mode
  • High-Speed with Simple DMA

The behavior is identical in all four cases:

  • Connecting our board to a Windows or Linux host is correctly detected.
  • The SETUP transaction is successfully received, and the host receives the device descriptor in response.
  • When the IN transfer complete interrupt is triggered, the USB controller is configured to receive a zero-length packet on OUT0. However, the USB protocol analyzer shows that the device continuously responds with NAK to this packet.
  • The host retries for approximately 5 seconds, but the device keeps responding with NAK.

The register values immediately after configuring the reception of the OUT0 packet are:

  • Gotgctl = 0xd00c0
  • Gintsts = 0x4000020 (PTxFEmp, NPTxFEmp)
  • Gdfifocfg = 0x1f802000
  • Dctl = 0
  • Dcfg = 0x8100001
  • Dsts = 0x18702
  • Doepctl0 = 0x80008000
  • Doepint0 = 0
  • Doeptsiz0 = 0x80000
  • Grxfsiz = 0x50

After a few milliseconds, I observe that DOEPINT0.NAKINTRPT = 1, which seems to confirm that the device is sending NAKs. However, I do not understand why the OUT packet is not being accepted, since the receive FIFO is not full and both DCTL.GOUTNAKSTS = 0 and DOEPCTL0.NAKSTS = 0.

1 Reply

  • I don't see the source file you mentioned.  Can you attach it?  Also, do you have the ability to provide a USB analyzer trace?