Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

USB superspeed peripherals Forum Discussions

WeJi_4707326
Level 1
Level 1
5 replies posted First reply posted First question asked

Hi,

I used two CYUSB3KIT-003 boards to implement GPIF II Slave/Master FIFO interface. I ran the code provided with AN87216 - Designing a GPIF II Master Interface:
https://www.cypress.com/documentation/application-notes/an87216-designing-gpif-ii-master-interface
I used USB Control Center application to send data from bulk out endpoint of slave and receive data from bulk out endpoint of master.
But I found data transfer failed only if I send 1024 bytes data(for any other data size it seemed okay).

snapshoot.png

0 Likes
1 Solution
JayakrishnaT_76
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hello,

As you might be knowing, the data received from the OUT endpoint is stored in DMA buffers and sent to the P Port. The DMA buffer size used in the project is 2048 bytes. Also, the Max packet size for the OUT endpoint is 1024 bytes.

 When the host sends 1024  bytes to the OUT endpoint of slave, the device will not know that the transfer from the host has ended. The device will assume that one packet is complete, and the next is about to arrive. But here, there is no next packet. So, the device keeps on waiting. This means that the DMA buffer is not filled and is not sent to the P Port for the Master to read. To avoid this problem, you can try the following OUT transfers to the slave device:

1. Send data having size same as DMA buffer size (2048 bytes).

2. Send data having size that is not a multiple of 1024 bytes.

3. Send ZLP at the end if the data size is equal to 1024 bytes.

In all the above cases, the DMA buffers will be filled with data and will be send to the P Port so that the master can read it and send it to the host using it's IN endpoint.

Please refer to the following KBA which documents this issue for more information:

https://community.cypress.com/t5/Knowledge-Base-Articles/Data-sent-from-Host-over-USB-is-not-Committ...

Best Regards,
Jayakrishna

View solution in original post

0 Likes
10 Replies
JayakrishnaT_76
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hello,

Please provide the following information so that we can debug the problem faster:

1. Are you making use of the default project that comes along with AN87216 or have you made any modifications on top of it?

2. Please let me know the source and destination of data transfer. Is it from the OUT endpoint of Master to IN endpoint of slave or vice versa?

Best Regards,
Jayakrishna
0 Likes
WeJi_4707326
Level 1
Level 1
5 replies posted First reply posted First question asked

Hi,

1. Yes, I only downloaded AN87216 zip and used bin files in it without any modification

2. The data is from OUT endpoint of slave to IN endpoint of master 

0 Likes
JayakrishnaT_76
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hello,

Can you please try the following and let me know if this works?

1. Send 1024 bytes into OUT endpoint of slave.

2. Send a ZLP to OUT endpoint of slave. This can be done by setting the Bytes to transfer field to 0 and then hitting Transfer Data OUT.

Please try this and let me know if you are able to receive the data at the Master side.

Best Regards,
Jayakrishna
0 Likes

Hi,

I have tried these two cases:

1. Sending 1024 bytes from OUT endpoint of slave is okay. The log says 'BULK OUT transfer completed'
     But then reading data from IN endpoint of master fails. The log says 'BULK IN transfer failed with Error Code:997'

2. Send a ZLP to OUT endpoint of slave is okay.

0 Likes
JayakrishnaT_76
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hello,

I am sorry for not making my point clear in the last response. Please try the following and let me know if you are able to obtain the data at the master side:

1.  Send 1024 bytes into OUT endpoint of slave. After this, DO NOT press on transfer IN button for master device.

2. Send a ZLP to OUT endpoint of slave. 

3. After step 2, try to read the data from master IN endpoint.

Please try this and let me know if you are able to read the 1024 bytes transferred from slave correctly or not.

Best Regards,
Jayakrishna
0 Likes

Hi,

I have tried your sequences. It means sending a ZLP after sending 1024 bytes data into OUT endpoint of slave. Then reading 1024 bytes data from IN endpoint of master.

With this sequence, now I can read the 1024 bytes transferred from slave correctly.

0 Likes

Hi,

Does it mean when the data size equals to multiples of maxPacketSize, I need to send a ZLP manually to tell device the transfer is over?

0 Likes

Hello,

Yes your understanding is correct.

Best Regards,
Jayakrishna
0 Likes
JayakrishnaT_76
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hello,

As you might be knowing, the data received from the OUT endpoint is stored in DMA buffers and sent to the P Port. The DMA buffer size used in the project is 2048 bytes. Also, the Max packet size for the OUT endpoint is 1024 bytes.

 When the host sends 1024  bytes to the OUT endpoint of slave, the device will not know that the transfer from the host has ended. The device will assume that one packet is complete, and the next is about to arrive. But here, there is no next packet. So, the device keeps on waiting. This means that the DMA buffer is not filled and is not sent to the P Port for the Master to read. To avoid this problem, you can try the following OUT transfers to the slave device:

1. Send data having size same as DMA buffer size (2048 bytes).

2. Send data having size that is not a multiple of 1024 bytes.

3. Send ZLP at the end if the data size is equal to 1024 bytes.

In all the above cases, the DMA buffers will be filled with data and will be send to the P Port so that the master can read it and send it to the host using it's IN endpoint.

Please refer to the following KBA which documents this issue for more information:

https://community.cypress.com/t5/Knowledge-Base-Articles/Data-sent-from-Host-over-USB-is-not-Committ...

Best Regards,
Jayakrishna
0 Likes

Hi,

I got it. Thank you very much for help.

0 Likes