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.

6748 USB 32Bit FIFO and 8 BIT DATA



I am having trouble enumerating a USB device on the USB0 channel of a 6748.  I receive and correctly decode the GET_DESCRIPTOR packet.  My response is not recognized by the host. 

I believe the problem is in writing to the TXFIFO0.  In order to use the RX fifo, I had to read the data 32bits at a time (I tried declaring the RXFIFO as a char, to no effect).  I assume the data written to the TXFIFO must be written as a 32bit value.  What happens in the case with 18 bytes of data?  I can find no register the allows me to set the TX data length in bytes.

This is my intended descriptor:

const USB_DEVICE_DESCRIPTOR DeviceDescriptor = {
    sizeof(USB_DEVICE_DESCRIPTOR), /* bLength */
    TYPE_DEVICE_DESCRIPTOR,        /* bDescriptorType */
    0x0020,                        /* bcdUSB USB Version 1.1 */
    2,                             /* bDeviceClass */
    0,                             /* bDeviceSubclass */
    0,                             /* bDeviceProtocol */
    64,                             /* bMaxPacketSize 64 Bytes */
    0x045E,                        /*  Test Board */
    0x930A,
    0x0000,                        /* bcdDevice */
    1,                             /* iManufacturer String Index */
    0,                             /* iProduct String Index */
    0,                             /* iSerialNumber String Index */
    1                              /* bNumberConfigurations */
};

This is the trace data that is written to the FIFO:

78 Write Endpoint 0 Bytes-18

79 EP0-00200112

80 EP0-40000002

81 EP0-930A045E

82 EP0-00010000

83 EP0-11800100

Thanks for the help.

 

  • The following code, while ugly, does write to the tx buffer correctly:

    void usb_WriteEndpoint(unsigned char Endpoint, const uint8_t *Buffer, unsigned char Bytes)
    {
    #define FIFO0_Offset 0x420
     uint8_t i;
    // uint8_t w = 0;
     uint8_t * fifo_addr = (uint8_t *)USB_OTG;

     fifo_addr += (FIFO0_Offset + (Endpoint * 4));
      
        LOG_printf(&trace, "Write Endpoint %i Bytes-%i",Endpoint, Bytes);
     USB_OTG->INDEX = Endpoint;
     if (Bytes > 0)
     {
      for (i = 0; i < Bytes; i++){
       *(fifo_addr + (i % 4)) = Buffer[i];
             LOG_printf(&trace, "EP0-%.2X (%X) ", Buffer[i], fifo_addr + (i%4));
      }
     }
     USB_OTG->CSR |= (USB_TXPKTRDY);
    }

    Remove the LOG_printf() if not using DSP BIOS