Skip to main content
paul2
Associate III
August 12, 2017
Question

Send ZPL II commands to zebra printer via USB

  • August 12, 2017
  • 1 reply
  • 1336 views
Posted on August 12, 2017 at 21:51

Hi,

I'm investigating how to send ZPLII commands to an USB printer using a STM32F4 or F7 MCU.

So far i did some testing with USB FS Host examples. The printer is being recognized, but I'm not able to send a ZPLII string like: '^XA^FO10,10,^AO,30,20^FDFDTesting^FS^XZ';

Anybody experience with sending ZPLII commands to zebra printer via USB? Or how to send a raw string like mentioned above?

Thanks

    This topic has been closed for replies.

    1 reply

    john doe
    Senior III
    August 12, 2017
    Posted on August 13, 2017 at 01:07

    Can you send any commands to it at all?  Start with 'give me your version number.' Get command/response working first.

    I can't help with USB commands, but programmatically building a string, we can do with sprintf()

    paul2
    paul2Author
    Associate III
    August 13, 2017
    Posted on August 13, 2017 at 20:55

    Hi,

    yes, I managed to receive to device description like Product & Vendor ID etc.

    I was thinking/trying to use HAL_HCD_HC_SubmitRequest in order send the ZPLII string as data.

      USB_status = HAL_HCD_HC_SubmitRequest(hUSBHost.pData,

                                          hUSBHost.Control.pipe_out,

                                          0,

                                          USBH_EP_BULK,

                                          USBH_PID_DATA,

                                          (uint8_t*) &txdata,

                                          97,

                                          0);

    But no success so far..

    Function returns USBH_OK, but the printer doesn't respond accordingly.