Hello everyone,
We are using LPC4357 controller & with USB host we are trying to print on HP Office jet 6000 printer.
Verified that it supports PCL 3 GUI & it is also able to print on our older systems (Fujitsu micro controller based system).
Now with LPC this printer is unable to enumerate & while the configuration is being set it gives set up & queued status.
But same code works on HP Office jet K7108.
The point where it gets stuck is below
We have used LPC open as reference & till Z character on UART we are able to move. Marked below with comment.
HCD_STATUS HcdControlTransfer(uint32_t PipeHandle, const USB_Request_Header_t *const pDeviceRequest, uint8_t *const buffer) { uint8_t HostID, QhdIdx; HCD_TRANSFER_TYPE XferType; uint32_t SetupTdIdx, DataTdIdx, StatusTdIdx; uint8_t direction; uint32_t Datalength; if ((pDeviceRequest == NULL) || (buffer == NULL)) { ASSERT_STATUS_OK_MESSAGE(HCD_STATUS_PARAMETER_INVALID, "Device Request or Data Buffer is NULL"); } UART0_PutChar('U'); ASSERT_STATUS_OK(PipehandleParse(PipeHandle, &HostID, &XferType, &QhdIdx) ); UART0_PutChar('R'); Datalength = pDeviceRequest->wLength; direction = pDeviceRequest->bmRequestType & 0x80; UART0_PutChar('S'); /*---------- Setup Stage ----------*/ ASSERT_STATUS_OK(AllocQTD(HostID, &SetupTdIdx, (uint8_t *) pDeviceRequest, 8, SETUP_TRANSFER, 0, 0) ); /* Setup TD: DirectionPID=00 - DataToggle=10b (always DATA0) */ UART0_PutChar('T'); /*---------- Data Stage ----------*/ if (Datalength) { UART0_PutChar('U'); ASSERT_STATUS_OK(AllocQTD(HostID, &DataTdIdx, buffer, Datalength, direction ? IN_TRANSFER : OUT_TRANSFER, 1, 0) ); UART0_PutChar('V'); } else { UART0_PutChar('W'); DataTdIdx = SetupTdIdx; /* Data TD is skipped */ } /*---------- Status Stage ----------*/ UART0_PutChar('X'); ASSERT_STATUS_OK(AllocQTD(HostID, &StatusTdIdx, NULL, 0, direction ? OUT_TRANSFER : IN_TRANSFER, 1, 1) ); /* Status TD: Direction=opposite of data direction - DataToggle=11b (always DATA1) */ UART0_PutChar('Y'); /* Hook TDs Together */ HcdQTD(HostID, SetupTdIdx)->NextQtd = (uint32_t) HcdQTD(HostID, DataTdIdx); HcdQTD(HostID, DataTdIdx)->NextQtd = (uint32_t) HcdQTD(HostID, StatusTdIdx); HcdQHD(HostID, QhdIdx)->status = (uint32_t) HCD_STATUS_TRANSFER_QUEUED; /* Hook TDs to QHD */ HcdQHD(HostID, QhdIdx)->FirstQtd = Align32( (uint32_t) HcdQTD(HostID, SetupTdIdx) ); HcdQHD(HostID, QhdIdx)->Overlay.NextQtd = (uint32_t) HcdQTD(HostID, SetupTdIdx); /* wait for semaphore compete TDs */ UART0_PutChar('Z'); /**************************************************************************************** We receive serial debug till this point ****************************************************************************************/ ASSERT_STATUS_OK(WaitForTransferComplete(HostID, QhdIdx) ); UART0_PutChar('1'); return HCD_STATUS_OK; }
Please help
View all questions in Keil forum