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.

TM4C1237H6PZ: Some USB Laser printers not getting detected by my Tiva

Part Number: TM4C1237H6PZ

I have my Tiva controller perfectly working with USB dot matrix printers. Now I am trying to make it work for the USB laser printers using the same USB library. It is working fine with some laser printers which are old. Then i got a new HP printer and it is not working with it. Same is the problem with one of my Cannon printers. The difference is that new HP printer has 5 interface descriptors as compared to one interface descriptor(i.e. Printer(0x07)) in the old printers. Does that make any difference in the detection of the printer and its working? The USBHCDEvents() is not able to detect a supported device when new printer is connected. I always returns USB_EVENT_UNKNOWN_CONNECTED and then disconnects it. What can be the issue? I thought the USB checks the device class and then loads the corresponding drivers but it is not able to detect it. I checked it on windows PC with USB Analyser, there it seems fine and is returning the class as Printer upon query. It is working fine on Windows PC as well like the old ones. Can someone suggest me any solution for this?

Regards,

Naman

  • Hello Naman,

    Naman Kumar said:
    The difference is that new HP printer has 5 interface descriptors as compared to one interface descriptor(i.e. Printer(0x07)) in the old printers. Does that make any difference in the detection of the printer and its working?

    That could be a possible source, yes. I haven't yet dealt with a device with 5 interface descriptors though, so I can't say for sure. Can you provide the list of all of them? Also, when looking at what the Tiva receives for descriptors (via debug+breakpoints), can you see which or how many of the 5 are received, in what order, and possibly even track which one is being used to process further?

    Naman Kumar said:
    The USBHCDEvents() is not able to detect a supported device when new printer is connected. I always returns USB_EVENT_UNKNOWN_CONNECTED and then disconnects it. What can be the issue? 

    This would depend on what (if any) descriptors are being properly received and passed to the function. If no descriptor is received correctly (perhaps due to format or the presence of multiple descriptors) that would cause such a problem.

    Naman Kumar said:
    I checked it on windows PC with USB Analyser, there it seems fine and is returning the class as Printer upon query.

    Is that the only class being returned, or are multiple being returned? Are there any differences between what is being sent and also queried for this printer vs one that works? Anything that may relate back to the 5 descriptor mention you made before (could affirm or debunk the relevancy of that factor)

  • Hi Ralph,

    Below is the attached info for new printer with 5 interface descriptors,this info I copied from Device info option of USB Analyser 4.0:

    Device Information
    ConnectionIndex 6
    CurrentConfigurationValue 1
    Speed High Speed (up to 480 Mbps)
    DeviceIsHub 0
    DeviceAddress 2
    NumberOfOpenPipes 12
    ConnectionStatus DeviceConnected

    Device Descriptor
    bLength 18
    bDescriptorType 0x1 (DEVICE_DESCRIPTOR)
    bcdUSB 0x0200 (USB 2.0)
    bDeviceClass 0x7 (PRINTER)
    bDeviceSubClass 0x1
    bDeviceProtocol 0x2
    bMaxPacketSize0 64
    idVendor 0x3f0 (Hewlett-Packard)
    idProduct 0x632a
    bcdDevice 0x100
    bNumConfigurations 1
    iManufacturer 0x1 (HP)
    iProduct 0x2 (HP LaserJet M203-M206)
    iSerialNumber 0x3 (VNC3F12877)

    Configurations

    Configuration Descriptor 0
    bLength 9
    bDescriptorType 0x2 (CONFIGURATION_DESCRIPTOR)
    wTotalLength 138
    bNumInterfaces 5
    bConfigurationValue 1
    iConfiguration 0x0
    bmAttributes 0xe0 (BUS_POWERED | SELF_POWERED | REMOTE_WAKEUP)
    MaxPower 0x1 (2 mA)

    Interface Descriptor 0
    bLength 9
    bDescriptorType 0x4 (INTERFACE_DESCRIPTOR)
    bInterfaceNumber 0
    bAlternateSetting 0
    bNumEndpoints 2
    bInterfaceClass 0x7 (PRINTER)
    bInterfaceSubClass 0x1
    bInterfaceProtocol 0x2
    iInterface 0x11 (Printer)

    Endpoint Descriptor 0
    bLength 7
    bDescriptorType 0x5 (ENDPOINT_DESCRIPTOR)
    bEndpointAddress 0x1 (OUT)
    bmAttributes 0x2 (BULK)
    wMaxPacketSize 512
    bInterval 255

    Endpoint Descriptor 1
    bLength 7
    bDescriptorType 0x5 (ENDPOINT_DESCRIPTOR)
    bEndpointAddress 0x81 (IN)
    bmAttributes 0x2 (BULK)
    wMaxPacketSize 512
    bInterval 0

    Interface Descriptor 1
    bLength 9
    bDescriptorType 0x4 (INTERFACE_DESCRIPTOR)
    bInterfaceNumber 1
    bAlternateSetting 0
    bNumEndpoints 3
    bInterfaceClass 0xff (VENDOR_SPECIFIC)
    bInterfaceSubClass 0x4
    bInterfaceProtocol 0x1
    iInterface 0x15 (HP LEDM)

    Endpoint Descriptor 0
    bLength 7
    bDescriptorType 0x5 (ENDPOINT_DESCRIPTOR)
    bEndpointAddress 0x7 (OUT)
    bmAttributes 0x2 (BULK)
    wMaxPacketSize 512
    bInterval 255

    Endpoint Descriptor 1
    bLength 7
    bDescriptorType 0x5 (ENDPOINT_DESCRIPTOR)
    bEndpointAddress 0x87 (IN)
    bmAttributes 0x2 (BULK)
    wMaxPacketSize 512
    bInterval 0

    Endpoint Descriptor 2
    bLength 7
    bDescriptorType 0x5 (ENDPOINT_DESCRIPTOR)
    bEndpointAddress 0x88 (IN)
    bmAttributes 0x3 (INTERRUPT)
    wMaxPacketSize 8
    bInterval 16

    Interface Descriptor 2
    bLength 9
    bDescriptorType 0x4 (INTERFACE_DESCRIPTOR)
    bInterfaceNumber 2
    bAlternateSetting 0
    bNumEndpoints 3
    bInterfaceClass 0xff (VENDOR_SPECIFIC)
    bInterfaceSubClass 0x4
    bInterfaceProtocol 0x1
    iInterface 0x15 (HP LEDM)

    Endpoint Descriptor 0
    bLength 7
    bDescriptorType 0x5 (ENDPOINT_DESCRIPTOR)
    bEndpointAddress 0x9 (OUT)
    bmAttributes 0x2 (BULK)
    wMaxPacketSize 512
    bInterval 255

    Endpoint Descriptor 1
    bLength 7
    bDescriptorType 0x5 (ENDPOINT_DESCRIPTOR)
    bEndpointAddress 0x89 (IN)
    bmAttributes 0x2 (BULK)
    wMaxPacketSize 512
    bInterval 0

    Endpoint Descriptor 2
    bLength 7
    bDescriptorType 0x5 (ENDPOINT_DESCRIPTOR)
    bEndpointAddress 0x8a (IN)
    bmAttributes 0x3 (INTERRUPT)
    wMaxPacketSize 8
    bInterval 16

    Interface Descriptor 3
    bLength 9
    bDescriptorType 0x4 (INTERFACE_DESCRIPTOR)
    bInterfaceNumber 3
    bAlternateSetting 0
    bNumEndpoints 2
    bInterfaceClass 0xff (VENDOR_SPECIFIC)
    bInterfaceSubClass 0x9
    bInterfaceProtocol 0x1
    iInterface 0x12 (IPP Printer)

    Endpoint Descriptor 0
    bLength 7
    bDescriptorType 0x5 (ENDPOINT_DESCRIPTOR)
    bEndpointAddress 0xb (OUT)
    bmAttributes 0x2 (BULK)
    wMaxPacketSize 512
    bInterval 255

    Endpoint Descriptor 1
    bLength 7
    bDescriptorType 0x5 (ENDPOINT_DESCRIPTOR)
    bEndpointAddress 0x8b (IN)
    bmAttributes 0x2 (BULK)
    wMaxPacketSize 512
    bInterval 0

    Interface Descriptor 4
    bLength 9
    bDescriptorType 0x4 (INTERFACE_DESCRIPTOR)
    bInterfaceNumber 4
    bAlternateSetting 0
    bNumEndpoints 2
    bInterfaceClass 0xff (VENDOR_SPECIFIC)
    bInterfaceSubClass 0x9
    bInterfaceProtocol 0x1
    iInterface 0x12 (IPP Printer)

    Endpoint Descriptor 0
    bLength 7
    bDescriptorType 0x5 (ENDPOINT_DESCRIPTOR)
    bEndpointAddress 0xc (OUT)
    bmAttributes 0x2 (BULK)
    wMaxPacketSize 512
    bInterval 255

    Endpoint Descriptor 1
    bLength 7
    bDescriptorType 0x5 (ENDPOINT_DESCRIPTOR)
    bEndpointAddress 0x8c (IN)
    bmAttributes 0x2 (BULK)
    wMaxPacketSize 512
    bInterval 0

    Now below is the info of Cannon printer which is getting detected and has 1 interface descriptor:

    Device Information
    ConnectionIndex 6
    CurrentConfigurationValue 1
    Speed High Speed (up to 480 Mbps)
    DeviceIsHub 0
    DeviceAddress 2
    NumberOfOpenPipes 2
    ConnectionStatus DeviceConnected

    Device Descriptor
    bLength 18
    bDescriptorType 0x1 (DEVICE_DESCRIPTOR)
    bcdUSB 0x0200 (USB 2.0)
    bDeviceClass 0x7 (PRINTER)
    bDeviceSubClass 0x1
    bDeviceProtocol 0x2
    bMaxPacketSize0 64
    idVendor 0x4a9 (Canon, Inc.)
    idProduct 0x2676
    bcdDevice 0x100
    bNumConfigurations 1
    iManufacturer 0x1 (Canon)
    iProduct 0x2 (Canon CAPT USB Device)
    iSerialNumber 0x3 (0000A393KDnJ)

    Configurations

    Configuration Descriptor 0
    bLength 9
    bDescriptorType 0x2 (CONFIGURATION_DESCRIPTOR)
    wTotalLength 32
    bNumInterfaces 1
    bConfigurationValue 1
    iConfiguration 0x0
    bmAttributes 0xc0 (BUS_POWERED | SELF_POWERED)
    MaxPower 0x0 (0 mA)

    Interface Descriptor 0
    bLength 9
    bDescriptorType 0x4 (INTERFACE_DESCRIPTOR)
    bInterfaceNumber 0
    bAlternateSetting 0
    bNumEndpoints 2
    bInterfaceClass 0x7 (PRINTER)
    bInterfaceSubClass 0x1
    bInterfaceProtocol 0x2
    iInterface 0x0

    Endpoint Descriptor 0
    bLength 7
    bDescriptorType 0x5 (ENDPOINT_DESCRIPTOR)
    bEndpointAddress 0x1 (OUT)
    bmAttributes 0x2 (BULK)
    wMaxPacketSize 512
    bInterval 0

    Endpoint Descriptor 1
    bLength 7
    bDescriptorType 0x5 (ENDPOINT_DESCRIPTOR)
    bEndpointAddress 0x82 (IN)
    bmAttributes 0x2 (BULK)
    wMaxPacketSize 512
    bInterval 0

    I am not able to check the order of descriptors received by Tiva, I am not sure how to check that. I checked the puiEvent->ui32instance of the HCD unknown event but its value is 0. Is there a way that i can the check the device class or interface class of the unknown device detected by USBHCDEvents()?
  • Ralph,

    I am also attaching the log files of HP and Cannon printers on USB Analyzer. Please check if you can find anything. You can open these files on USB Analyzer 4.0 software.

    Laser.tar.gz

  • As the one who past advised that you, "Spy upon the USB Bus Transactions" - so that you could (best) duplicate them via your TM4C MCU - you DO recognize & acknowledge that your quest has, "Strayed far from a predominantly MCU Issue" - do you not?

    Such "Non-MCU Focused" - so highly detailed (and rare) requests - demand substantial time & effort from dedicated vendor staff.      This reduces their ability to serve those w/more "MCU Focused" issues - which prove far more "mainstream" - thus benefit SO many here.

    I past suggested that "you" monitor the entire USB transaction when "you" (properly) transact w/your target printer.    (i.e. via a PC - most likely)    

    This "holds the key" to your success - yet is FAR from a "TM4C" issue - and (really) should be (your) job - not one forced upon (the kindness) of an already, heavily tasked (more properly tasked) vendor staff...

    Taken to the "limit" (i.e. if many posters demanded such high (and rarely sought, specific, Non-MCU) detail - the forum would likely - grind to a "halt."    And what then - requests must benefit the MANY - not the VERY FEW!

  • Naman Kumar said:
    Below is the attached info for new printer with 5 interface descriptors,this info I copied from Device info option of USB Analyser 4.0:

    A bit of a tools question. Since the analyser is a PC based tool, do you know if it is capturing the raw USB data?

    Is there any possibility that the HP drivers are inserting shims to translate the USB initializers? There were printers referred to as winprinters not so long ago (maybe still?) that offloaded most of the printer tasks to the PC and while I don't see the utility of doing something similar for USB maybe someone has found a reason.

    Robert

  • Robert - the breadth & depth of your "tech mastery" proves most impressive - repeatedly.

    That said - poster's quest STRAYS SO FAR from, "Forum's MCU-Centric Concerns" - that it borders (or encroaches) upon "vendor-abuse!"
  • Oh, I agree expecting the vendor or even the forum entire to solve the problem is asking too much.

    OTOH, a few debugging hints or "stupid questions" such as mine above that question the assumptions may be something that can be asked for.

    Robert

    And given my knowledge of USB, stupid questions are all I got.
  • I would doubt that poster has made (adequate) "requests of the printer vendor" - thus employs the forum (incorrectly) as a "dumping ground."

    The "inadequacy of investigation" - even identification - of the "MOST FERTILE Tech Source" - simply "jumps out..."

    Poster's Subject Line: "Some USB prns. "not getting detected" should change to: "Each/Every USB prn. (ever released)  - MUST be detected - quickly & completely - FULL Code listing awaited - Allez!)

  • Hello Naman,

    You would need to look in the usbhostenum.c file, under function ProcessUSBDeviceStateMachine. This will let you check various situations of the process, and this is also where the USB_EVENT_UNKNOWN_CONNECTED is likely being set.

    If you are using UsbLib and have the usblib.lib file used (which is quite possible) you'll need to remove the use of the .lib and add the include paths for usblib manually to your CCS project to be able to use breakpoints and debug the UsbLib source code that way.
  • Hello Ralph,

    I dig further as you suggested in the ProcessUSBDeviceStateMachine function and found out that USBHCDGetConfigDescriptor() function is returning zero(no success). As per the comments, it is not able to initialize request for getting configuration descriptor. I think this is where it makes all the difference as it is able to get through this request USBHCDGetConfigDescriptor() in case of other laser printers but not for the new one.

    Does that mean that the new printer has some issues with it regarding the descriptors? Because it is running fine on PC. Please let me know. I am checking further.

    Regards,
    Naman
  • Hi Ralph,

    USBHCDGetConfigDescriptor() function was not working as the length of descriptors of the printer was more than allocated by uint_8 g_pui8HCDPool[HCD_MEMORY_SIZE]. It was allocated 128 but, for my new printer the size required was 138 as it has 5 interface descriptors in it. Now it is able to detect the printer.
    Thank you so much for your help.

    Regards,
    Naman
  • Hi Naman,

    Great to hear, thanks for reporting the solution back too, might be helpful for others in the future! :)