KL25Z USB Display

10 Feb 2015

Hi,

I'm still learning here, but I need some help.

I have a KL25Z board and am trying to hook up this USB display I have. I am using the USBDevice library. The problem is, I don't see my USB device power up. When I plug it directly into an outlet USB plug, I see the screen turn on. When I plug it into the board, nothing turns on.

I assume I have to 'power on'.

Here's my descriptor for the USBHID Device:

Descriptor Setup

static uint8_t configurationDescriptor[] = {
        CONFIGURATION_DESCRIPTOR_LENGTH,// bLength
        CONFIGURATION_DESCRIPTOR,       // bDescriptorType
        LSB(TOTAL_DESCRIPTOR_LENGTH),   // wTotalLength (LSB)
        MSB(TOTAL_DESCRIPTOR_LENGTH),   // wTotalLength (MSB)
        0x01,                           // bNumInterfaces
        DEFAULT_CONFIGURATION,          // bConfigurationValue
        0x00,                           // iConfiguration
        C_RESERVED,                      // bmAttributes [CHANGED THIS LINE]
        C_POWER(25),                     // bMaxPower [CHANGED THIS LINE]

        INTERFACE_DESCRIPTOR_LENGTH,    // bLength
        INTERFACE_DESCRIPTOR,           // bDescriptorType
        0x00,                           // bInterfaceNumber
        0x00,                           // bAlternateSetting
        0x02,                           // bNumEndpoints
        HID_CLASS,                      // bInterfaceClass
        HID_SUBCLASS_NONE,              // bInterfaceSubClass
        HID_PROTOCOL_NONE,              // bInterfaceProtocol
        0x00,                           // iInterface

        HID_DESCRIPTOR_LENGTH,          // bLength
        HID_DESCRIPTOR,                 // bDescriptorType
        LSB(HID_VERSION_1_11),          // bcdHID (LSB)
        MSB(HID_VERSION_1_11),          // bcdHID (MSB)
        0x00,                           // bCountryCode
        0x01,                           // bNumDescriptors
        REPORT_DESCRIPTOR,              // bDescriptorType
        (uint8_t)(LSB(this->reportDescLength())),  // wDescriptorLength (LSB)
        (uint8_t)(MSB(this->reportDescLength())),  // wDescriptorLength (MSB)

        ENDPOINT_DESCRIPTOR_LENGTH,     // bLength
        ENDPOINT_DESCRIPTOR,            // bDescriptorType
        PHY_TO_DESC(EPINT_IN),          // bEndpointAddress
        E_INTERRUPT,                    // bmAttributes
        LSB(MAX_PACKET_SIZE_EPINT),     // wMaxPacketSize (LSB)
        MSB(MAX_PACKET_SIZE_EPINT),     // wMaxPacketSize (MSB)
        1,                             // bInterval (milliseconds)

        ENDPOINT_DESCRIPTOR_LENGTH,     // bLength
        ENDPOINT_DESCRIPTOR,            // bDescriptorType
        PHY_TO_DESC(EPINT_OUT),          // bEndpointAddress
        E_INTERRUPT,                    // bmAttributes
        LSB(MAX_PACKET_SIZE_EPINT),     // wMaxPacketSize (LSB)
        MSB(MAX_PACKET_SIZE_EPINT),     // wMaxPacketSize (MSB)
        1,                             // bInterval (milliseconds)
    };

The key lines I changed from the default descriptor were:

C_RESERVED, bmAttributes - I removed the SELF_POWERED C_POWER(50), bMaxPower - I set the max power to 50mA (According to the Max Operating Current from my device sheet).

When I connect to my USBHID like this...

hid = new USBHID(8, 8, STORM_VID, USB_DISPLAY_PID, 0x0001);
hid->connect(true);

It doesn't connect because I believe it's not powered on.

Is there anything else I need to do?

Thanks!

14 Jun 2015

Unless I'm mistaken about what you are trying to do, you seem a bit confused about USB.

If you want the KL25Z to be a USB slave of an external host, then it operates in device mode and you use the device stack.

But if you want the KL25Z to host an external device, then it needs to use a host stack, rather than a device one.

Fortunately the KL46Z host stack works fine on the KL25Z, however, you need to provide power to the KL25Z's USB connector. If you have a computer or USB power brick connected to the SDA USB plug, then you can accomplish this by soldering a wire between the filters on each of the USB ports, to route power from the SDA "input" USB to the KL25Z "output" one.