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;
|