Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > USB Controllers > Vend_ax based application not sending response on EP0

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



Vend_ax based application not sending response on EP0
Moderator:
RSKV

Post Reply
Follow this topic



Vend_ax based application not sending response on EP0

dreitz posted on 16 Feb 2011 3:41 PM PST
Top Contributor
74 Forum Posts

I have an application based on the Vend_ax sample.  I have one command that will not send a response back.  I load EP0, but it is never sent.

If I comment out #1 and #2, then I get a response back, but I do not get my two bytes of data after the control "header".

case VR_XSVF_COMMAND:
#if  1  //jad ENABLE_FPGA_PROGRAMMING
   EP0BCH = 0;                                                                                              //<<<<<#1
   EP0BCL = 0; // Clear bytecount to allow new data in; also stops NAKing         //<<<<<#2

   while(EP0CS & bmEPBUSY);

   blockLen = EP0BCL;
   for(i=0; i<blockLen; i++)
   {
    fileStorage[i] = *(EP0BUF+i);
   }
#if 0 //jad        
   if (xsvfFirstCommand == 1)
   {
    xsvfFirstCommand = 0;
    xsvfInitialize();
   }

   *EP0BUF = xsvfRun();
#endif
//jad*EP0BUF = 0xFF;
#else
   *EP0BUF = 0xFF;
#endif // ENABLE_FPGA_PROGRAMMING
   EP0BCH = 0;
   EP0BCL = 1;   // Arm endpoint with # bytes to transfer
   EP0CS |= bmHSNAK; // Acknowledge handshake phase of device request
   break;

 

The PC code is  (cmd[] = 0x07 0x00) :

if

(myDev != null)

{

 

//jad implement sending to board

 

{

myDev.ControlEndPt.ReqType =

myDev.ControlEndPt.Direction =

myDev.ControlEndPt.ReqCode = (

myDev.ControlEndPt.Value = (

myDev.ControlEndPt.Index = (

 

 

 

 

if (myDev.ControlEndPt != null)CyConst.REQ_VENDOR;CyConst.DIR_FROM_DEVICE;byte)Commands.VR_XSVF_COMMAND;ushort)cmd.Length;ushort)0;int len = cmd.Length;if (myDev.ControlEndPt.XferData(ref cmd, ref len))return (XSVFErrorCodes)cmd[0];else

 

}

}

 

return XSVFErrorCodes.XSVF_USB_COMMAND_FAILED;return XSVFErrorCodes.XSVF_NO_DEVICE;

 




Re: Vend_ax based application not sending response on EP0

Shub posted on 17 Feb 2011 12:25 AM PST
Cypress Employee
27 Forum Posts

Hi dreitz,

This is expected as you are assigning the EP0BCL register at the begining of the vendor command ,

EP0BCH = 0;                                                                                              //<<<<<#1
   EP0BCL = 0; // Clear bytecount to allow new data in; also stops NAKing         //<<<<<#2

 

This will commit the EP0 buffer with 0 bytes and you would not receive any data.You should first initialize the buffer and then write to these registers as you are doing at the end in your code.

 

-shub






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: KXP; Secondary Owner: VWA; Sunset Date: 01/01/20