Hi,
In my design I have an IN and an OUT interrupt endpoint (EP1IN and EP1OUT). After the transmission of each data block to the CYUSB3014, software waits for an acknowledgement which is a 2-byte data (=A1 01). In the software, I am using the asynch transmission (The software worked fine with the FX2LP):
unsigned char* inContext = usb->BeginDataXfer(buffer, messageSize, &inOverlap);
usb->WaitForXfer(&inOverlap, timeOut);
usb->FinishDataXfer(buffer, messageSize, &inOverlap, inContext);
--------------------------------------------
In firmware, inside the DmaCallBack function, I am using:
/* Wait for a free buffer */
apiRetStatus = CyU3PDmaChannelGetBuffer (&glChHandleIntrOut, &outBuf_p, CYU3P_WAIT_FOREVER);
CyU3PMemSet (outBuf_p.buffer, command, 1); // command = 0xA1
CyU3PMemSet (outBuf_p.buffer+1, 0x01, 1);
/* Now discard the data from the producer channel */
apiRetStatus = CyU3PDmaChannelDiscardBuffer (chHandle);
/* commit the buffer */
apiRetStatus = CyU3PDmaChannelCommitBuffer (&glChHandleIntrOut, 2, 0);
---------------------------------------------
The issues are:
1. I can receive the correct ack (0xA1 01) when using the Control Center (regardless of the number of commited bytes).
2. In the software, it is not receiving any data, otherwise I increase the number of commited bytes as
CyU3PMemCopy (outBuf_p.buffer+2, input->buffer_p.buffer, 4); // write some dummy words
apiRetStatus = CyU3PDmaChannelCommitBuffer (&glChHandleIntrOut, 6, 0);
3. When I omit the codes in (2), or decrease the number of dummy bytes, software does not receive any data
4. However, when I commit 6 or more number of bytes, the software receive them (I can see them in the memory), but the message length in FinishDataXfer becomes 0.
I would appreciate it if you could help me solve this problem.
Thanks,
Nazila
|