We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello Sir,
I am making a receipt printer for point of sale application using LPC2368 controller. I want to use USB interface for receiving data from computer to printer.I am using bulk transfer for data receiving and sending data. I started using Keil USB HID source code example and converted this source code for bulk transfer using following changes in configuration descriptor and few other changes
const UWORD8 USB_ConfigDescriptor[] = { /* Configuration 1 */ USB_CONFIGUARTION_DESC_SIZE, /* bLength */ USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType */ WBVAL( /* wTotalLength */ 1*USB_CONFIGUARTION_DESC_SIZE + 1*USB_INTERFACE_DESC_SIZE + 2*USB_ENDPOINT_DESC_SIZE ), 0x01, /* bNumInterfaces */ 0x01, /* bConfigurationValue */ 0x00, /* iConfiguration */ USB_CONFIG_BUS_POWERED /*|*/ /* bmAttributes */ /*USB_CONFIG_REMOTE_WAKEUP*/, USB_CONFIG_POWER_MA(100), /* bMaxPower */ /* Interface 0, Alternate Setting 0, MSC Class */ USB_INTERFACE_DESC_SIZE, /* bLength */ USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType */ 0x00, /* bInterfaceNumber */ 0x00, /* bAlternateSetting */ 0x02, /* bNumEndpoints */ USB_DEVICE_CLASS_PRINTER, /* bInterfaceClass */ 0x01, /* bInterfaceSubClass */ 0x02, /* bInterfaceProtocol */ 0x62, /* iInterface */ /* Bulk In Endpoint */ USB_ENDPOINT_DESC_SIZE, /* bLength */ USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ USB_ENDPOINT_IN(2), /* bEndpointAddress */ USB_ENDPOINT_TYPE_BULK, /* bmAttributes */ WBVAL(0x0040), /* wMaxPacketSize */ 0, /* bInterval */ /* Bulk Out Endpoint */ USB_ENDPOINT_DESC_SIZE, /* bLength */ USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType */ USB_ENDPOINT_OUT(2), /* bEndpointAddress */ USB_ENDPOINT_TYPE_BULK, /* bmAttributes */ WBVAL(0x0040), /* wMaxPacketSize */ 0, /* bInterval */ /* Terminator */ 0 /* bLength */ };
Computer recognize my board usb device as a USB printing support successfully. I just want to know that is there is any class descriptor like HID class descriptor for printer or not?
And also I want to know that Is there is any host application to check bulk out transfer .
Thanks & Regards Rohit
Thanks Sir for your kind support
I need your support i made some changes in software as shown below
void USB_EndPoint0 (UWORD32 event) { //only portion that I changed case REQUEST_CLASS: #if USB_CLASS switch (SetupPacket.bmRequestType.BM.Recipient) { case REQUEST_TO_INTERFACE: #if USB_PRINTER if (SetupPacket.wIndex.WB.L == 0x00){ switch(SetupPacket.bRequest) { case PRNT_GET_DEVICE_ID: EP0Data.pData = (UWORD8 *)&prn_Device_ID; EP0Data.Count = prn_Device_ID.size_l + 2; USB_DataInStage(); break; case PRNT_GET_PORT_STATUS: port_status.b = 0; // initialize status port_status.PRNT_FLAG.prn_not_error = 1; // 1 = No Error, 0 port_status.PRNT_FLAG.prn_select = 1; port_status.PRNT_FLAG.prn_paper_empty = 0; // 1 = Paper Empty, 0 EP0Data.pData = (UWORD8 *)&port_status; EP0Data.Count = 1; USB_DataInStage(); break; case PRNT_SOFT_RESET: USB_ClrStallEP(0x02); USB_ClrStallEP(0x82); break; } } #endif }
When I debug through software I am getting device ID request from PC but not other two request. Second thing i notice that I sent Device ID to PC but when i monitors it on device monitor studio software it is not visible on this software.
What,s the reason for that?
> I am getting device ID request from PC but not other two request.
Windows put just GET_DEVICE_ID on enumeration. Try GetPrinter(PRINTER_INFO_2) and ResetPrinter() on Windows app.
> I sent Device ID to PC but when i monitors it on device monitor studio software it is not visible on this software.
Did you start on this example? C:\Keil\ARM\Boards\Keil\MCB2300\USBHID
case PRNT_GET_DEVICE_ID: EP0Data.pData = (UWORD8 *)&prn_Device_ID; EP0Data.Count = prn_Device_ID.size_l + 2; USB_DataInStage(); goto setup_class_ok; // <----- break; case PRNT_GET_PORT_STATUS: port_status.b = 0; // initialize status port_status.PRNT_FLAG.prn_not_error = 1; // 1 = No Error, 0 port_status.PRNT_FLAG.prn_select = 1; port_status.PRNT_FLAG.prn_paper_empty = 0; // 1 = Paper Empty, 0 EP0Data.pData = (UWORD8 *)&port_status; EP0Data.Count = 1; USB_DataInStage(); goto setup_class_ok; // <----- break; case PRNT_SOFT_RESET: USB_ClrStallEP(0x02); USB_ClrStallEP(0x82); USB_StatusInStage(); // <----- goto setup_class_ok; // <----- break;
Tsuneo
Thanks Sir for your reply,
Yes I am using C:\Keil\ARM\Boards\Keil\MCB2300\USBHID .
Rohit
> And also I want to know that Is there is any host application to check bulk out transfer .
USB Trace is a great tool for investigating your USB IN/OUT packets. http://www.sysnucleus.com/
Actually Sir currently I am using USB Device monitor studio For checking IN/OUT packets. Now i will try USB trace.
hi, sir i am using LPC2929 (ARM9), i need LIN protocol sample code on this