1

I was trying to use the SAM E54 Xplained dev board to achieve printer communication using this example from Microchip https://github.com/Microchip-MPLAB-Harmony/usb_apps_device/tree/master/apps/printer_basic#config_9 . I would like to receive an answer from the MCU. I would like to set up a USB_DEVICE_PRINTER_Write.

I decided to modify the code in the app.c as following:

case APP_STATE_SCHEDULE_WRITE:

    /* Setup the write */
              
    appData.writeTransferHandle = USB_DEVICE_PRINTER_TRANSFER_HANDLE_INVALID;
    appData.state = APP_STATE_WAIT_FOR_WRITE_COMPLETE;
    /* Reset Switch Pressed status */
    appData.isSwitchPressed = false;
               
    printerResult = USB_DEVICE_PRINTER_Write(USB_DEVICE_PRINTER_INDEX_0,
        &appData.writeTransferHandle, (void*)&appData.prntrReadBuffer[0],
        APP_READ_BUFFER_SIZE,USB_DEVICE_PRINTER_TRANSFER_FLAGS_DATA_COMPLETE);
    
    if(printerResult== USB_DEVICE_PRINTER_RESULT_ERROR_INSTANCE_NOT_CONFIGURED)
    {
        LED_Toggle();
    }      
    break;

I always got the following result as printerResult: USB_DEVICE_PRINTER_RESULT_ERROR_INSTANCE_NOT_CONFIGURED

Is there something missing?

Are there other references?

Daniele
  • 668
  • 2
  • 10
  • 25

0 Answers0