This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Bulk transfer of Data via USB (Host side)

Hi everyone,

I am using a LM3S5951 controllers for one of my projects in which I need to implement a host side driver for Dot Matrix printer .

I am done with enumeration of the printer, but now I would like to know how can I send data to printers using bulk transfers. I am using the Stellaries USB Library for the same where I found some host side codes for keyboard and pendrive. I would like to know, how to go about this.

Regards

Dhanush

Parents
  • A) Before starting
    firmware coding, you have to examine the printer on a PC, to know the printer protocols better.

    1) Read out these information from the printer, using USB sniffer on the PC.
    - Device and Configuration descriptor set.
    The descriptor set is used to check if your firmware reads them out correctly or not.

    - Printer’s Device ID string
    In the enumeration, PC reads out Device ID string using GET_DEVICE_ID request (control transfer), of this SETUP packet layout.

    bmRequestType: 0xA1
    bRequest     : 0x00 (GET_DEVICE_ID)
    wValue       : 0x01 (config index)
    wIndex       : 0x00 (Interface / Alternate)
    wLength      : length of ID string
    

    Here is the Device ID string of an old laser printer (EPSON LP-2400) on my desktop.

    00 6B 4D 46 47 3A 45 50 53 4F 4E 3B 43 4D 44 3A   .kMFG:EPSON;CMD:
    45 4A 4C 2C 45 53 43 50 32 34 4A 2D 38 34 2C 45   EJL,ESCP24J-84,E
    53 43 50 41 47 45 4A 2D 30 34 2C 45 53 43 50 53   SCPAGEJ-04,ESCPS
    55 50 45 52 2D 30 30 2C 50 52 32 30 31 2D 30 30   UPER-00,PR201-00
    3B 4D 44 4C 3A 4C 50 2D 32 34 30 30 3B 43 4C 53   ;MDL:LP-2400;CLS
    3A 50 52 49 4E 54 45 52 3B 44 45 53 3A 45 50 53   :PRINTER;DES:EPS
    4F 4E 20 4C 50 2D 32 34 30 30 3B                  ON LP-2400;
    


    "CMD:" tag on the Device ID string shows the PDL (Page Description Language), applied to print data. In above example,

    CMD:EJL,ESCP24J-84,ESCPAGEJ-04,ESCPSUPER-00,PR201-00;

    This printer supports Epson ESC/P and PC-PR201 enumeration.



    You may use these sniffers on Windows,
    USBlyzer (commercial, 33 days trial) http://www.usblyzer.com/
    USBTrace (commercial, 15 days trial) http://www.sysnucleus.com/

    To read out device/config descriptors and Device ID string, the enumeration sequence of the printer is traced. To catch enumeration on USBlyzer, you'll need to enable "Capture menu -> Capture Hot-plugged" before plugging in the target printer to the PC.

    2) Make a "test page" data on the PC
    - First of all, your PC should be installed the correct driver of the printer.
    - Make a "test page" on a text editor, like WordPad, as close to your required page layout as possible.
    - Print the page on the printer from the PC, tuning the page layout until you are satisfied.
    - When the page finishes, switch to "Print to File"

    On Windows7, bottom Start button > Device and printers > right click on the target printer > Printer’s properties > Ports tab
    forums.techguy.org...er-properties-port.jpg
    Check "FILE: Print to File"

    And then, print the "test page" on the editor.
    Now that you have "test page" data on a file.




    To be continued..

    Tsuneo

Reply
  • A) Before starting
    firmware coding, you have to examine the printer on a PC, to know the printer protocols better.

    1) Read out these information from the printer, using USB sniffer on the PC.
    - Device and Configuration descriptor set.
    The descriptor set is used to check if your firmware reads them out correctly or not.

    - Printer’s Device ID string
    In the enumeration, PC reads out Device ID string using GET_DEVICE_ID request (control transfer), of this SETUP packet layout.

    bmRequestType: 0xA1
    bRequest     : 0x00 (GET_DEVICE_ID)
    wValue       : 0x01 (config index)
    wIndex       : 0x00 (Interface / Alternate)
    wLength      : length of ID string
    

    Here is the Device ID string of an old laser printer (EPSON LP-2400) on my desktop.

    00 6B 4D 46 47 3A 45 50 53 4F 4E 3B 43 4D 44 3A   .kMFG:EPSON;CMD:
    45 4A 4C 2C 45 53 43 50 32 34 4A 2D 38 34 2C 45   EJL,ESCP24J-84,E
    53 43 50 41 47 45 4A 2D 30 34 2C 45 53 43 50 53   SCPAGEJ-04,ESCPS
    55 50 45 52 2D 30 30 2C 50 52 32 30 31 2D 30 30   UPER-00,PR201-00
    3B 4D 44 4C 3A 4C 50 2D 32 34 30 30 3B 43 4C 53   ;MDL:LP-2400;CLS
    3A 50 52 49 4E 54 45 52 3B 44 45 53 3A 45 50 53   :PRINTER;DES:EPS
    4F 4E 20 4C 50 2D 32 34 30 30 3B                  ON LP-2400;
    


    "CMD:" tag on the Device ID string shows the PDL (Page Description Language), applied to print data. In above example,

    CMD:EJL,ESCP24J-84,ESCPAGEJ-04,ESCPSUPER-00,PR201-00;

    This printer supports Epson ESC/P and PC-PR201 enumeration.



    You may use these sniffers on Windows,
    USBlyzer (commercial, 33 days trial) http://www.usblyzer.com/
    USBTrace (commercial, 15 days trial) http://www.sysnucleus.com/

    To read out device/config descriptors and Device ID string, the enumeration sequence of the printer is traced. To catch enumeration on USBlyzer, you'll need to enable "Capture menu -> Capture Hot-plugged" before plugging in the target printer to the PC.

    2) Make a "test page" data on the PC
    - First of all, your PC should be installed the correct driver of the printer.
    - Make a "test page" on a text editor, like WordPad, as close to your required page layout as possible.
    - Print the page on the printer from the PC, tuning the page layout until you are satisfied.
    - When the page finishes, switch to "Print to File"

    On Windows7, bottom Start button > Device and printers > right click on the target printer > Printer’s properties > Ports tab
    forums.techguy.org...er-properties-port.jpg
    Check "FILE: Print to File"

    And then, print the "test page" on the editor.
    Now that you have "test page" data on a file.




    To be continued..

    Tsuneo

Children