Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > USB Controllers > CyUSB DeviceIOControl returns TRUE but incomplete buffer

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



CyUSB DeviceIOControl returns TRUE but incomplete buffer
Moderator:
RSKV

Post Reply
Follow this topic



CyUSB DeviceIOControl returns TRUE but incomplete buffer

coppi75 posted on 11 Sep 2012 9:45 AM PST

1 Forum Post

 

I am using a Cypress EZ-USB  FX2-LP to continuously transmit data to a PC through bulk data transfer.  At the end of the email the part of the code used to get the data, where BUFFER_SIZE is 65KByte.

 

The data transmission typically goes fine, but sometimes happen that the despite DeviceIoControl return TRUE and there is no USB error the received data, corresponding to l_ulByteCount, is less than the requested BUFFER_SIZE.

The successive bulk transfer request goes succesfully, by I have lost the data of the previous incomplete buffer.

The problem comes up in one of the following conditions:

1) When I minimize/maximize the application GUI or switch off/on the display
2) Every hour at the same minute the same seconds. The minute and seconds depends on when I turn on the computer.

For what concern the first case, I almost avoided the incomplete buffer issue by minimizing the visual effect of windows, however the error appears regularly when I switch on the display.

For the second case I tried to understand if there is some task, process or service running abnormally at that time instant, but I noted nothing remarkable.

I replicated the same issue running the software both in Windows xp x86 and Windows 7 x86.

Please help ...

Regards 
Francesco

unsigned long l_ulByteCount;
PSINGLE_TRANSFER l_pTransfer;
BOOL l_bSuccess;
 

l_pTransfer = (PSINGLE_TRANSFER)p_chBuffer;

l_pTransfer->SetupPacket.bmRequest	= 0;
l_pTransfer->SetupPacket.bRequest	= 0;
l_pTransfer->SetupPacket.ulTimeOut	= 0;
l_pTransfer->SetupPacket.wIndex		= 0;
l_pTransfer->SetupPacket.wLength	= 0;
l_pTransfer->SetupPacket.wValue		= 0;
l_pTransfer->IsoPacketLength		= 0;
l_pTransfer->IsoPacketOffset		= 0;
l_pTransfer->ucEndpointAddress		= ENDPOINT_ADDRESS;
l_pTransfer->BufferOffset		= sizeof(SINGLE_TRANSFER);
l_pTransfer->BufferLength		= BUFFER_SIZE;
l_pTransfer->NtStatus			= 0;
l_pTransfer->UsbdStatus			= 0;


// Bulk transfer request
l_bSuccess = DeviceIoControl( m_hDevice,
  			      IOCTL_ADAPT_SEND_NON_EP0_TRANSFER,
			      p_chBuffer, sizeof(SINGLE_TRANSFER) + BUFFER_SIZE, 
			      p_chBuffer, sizeof(SINGLE_TRANSFER) + BUFFER_SIZE, 
			      &l_ulByteCount, NULL);
 
if (l_bSuccess==TRUE)
{
	USBStatus = l_pTransfer->UsbdStatus;

	if (USBD_SUCCESS(USBStatus))
		return NO_ERROR;

	if (USBD_PENDING(USBStatus))
	        return USB_PENDING;

	if (USBStatus == USBD_STATUS_CANCELED)
		return TRANSFER_ABORTED;

	return  USB_ERROR;
}
else
{
        return DEVICE_IO_ERROR;
}

 




Re: CyUSB DeviceIOControl returns TRUE but incomplete buffer

aasi posted on 13 Sep 2012 06:17 PM PST
Cypress Employee
1090 Forum Posts

 You should find http://msdn.microsoft.com/en-us/library/ff538112.aspx useful.






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: GRAA; Secondary Owner: RAIK; Sunset Date: 01/01/20