Multiple Thread in GPIF II for DR_data

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

cross mob
lock attach
Attachments are accessible only for community members.
E_521156
Level 4
Level 4
100 sign-ins 50 replies posted 50 sign-ins

Hi,

I am trying to send data from USB to GPIF in Serial mode (Serial interface using GPIF II ) . serial data is going to FPGA. But i have data loss in FPGA.

I think my problem is that there is a gap during buffer change. so I tried to do something like the configuration in UVC example in reversing(FROM FX3 to GPIF II)
I change the state machine for reading from 2 threads in DR_data (The image is attached) and also used multi channel DMA to with 2 consumer sockets (CY_U3P_DMA_TYPE_AUTO_ONE_TO_MANY). But now I get this error: BULK OUT transfer failed with Error Code:997  when i try to send a file which its size is more than DMA_Buff_size.
Should I do any other changes in code? I appreciate if there is any suggestion and help.
Thanks

0 Likes
1 Solution
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

Apologies for late reply.

I reproduced the issue at my end.

In the firmware you shared, i found that the configuration for serial out is  0x00001F83,  /*  CY_U3P_PIB_GPIF_SERIAL_OUT_CONFIG */

which is socket zero ( as mentioned in GPIF_SEROUT_THREAD_NUMBER_MASK (bit 3:2) is configured for data sink (from USB to GPIF).

As you are using two sockets (thread) in you firmware, this field should be 0. So that the socket is chosen internally (as per the thread)

So the configuration should be 0x00001F81,  /*  CY_U3P_PIB_GPIF_SERIAL_OUT_CONFIG */

I have tested this at my end. Refer to the results

gpif_serial_thread.PNG

PS: I have changed the DMA buffer size and endpoint size to 1024 (for testing purpose)

Regards,

Rashi

Regards,
Rashi

View solution in original post

0 Likes
7 Replies
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

BULK OUT transfer failed with Error Code:997

>> this error occurs when the DMA buffers are not empty for the USB socket to fill the data. Which also means the data is not read as fast as the data is written. This is because the GPIF is configured for serial mode

Please let me know the number of  DMA buffer and the DMA buffer size used in the application. You can try increasing the count of DMA buffers (please note that the total no of DMA buffers should not be more than then allocated memory for DMA buffers (refer to cyfxtx.c)).

Regards,

Rashi

Regards,
Rashi
0 Likes
lock attach
Attachments are accessible only for community members.

Hi,
The firmware worked well before I change it to 2-threads. I could send 4 MB data by that in serial before this changes. Only my problem was losing data every 16KB so i decide to use from 2-thread GPIF II.
now I think maybe, it is stopped somewhere(state machine or multiple DMA doesn't work well or i should add something in code)

I tested different numbers of DMA buffers,for example, if the number of  DMA buffer and the DMA buffer size:

#define CY_FX_DMA_BUF_SIZE              (16384)  
#define CY_FX_DMA_BUF_COUNT             (4)

then for 2-threads, I can send (16 *4) *2  KB text file. when i change the code to a 3 threads, it increase to (16 *4) * 3  KB.
I attached my firmware.

Thanks

0 Likes
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

The firmware seems fine.

Please let me know how much amount of data do you send through control center. Are you directly transferring some file (Transfer file out) or just random data through (transfer data out).

When do you get the error. Does the error occur after few successful  transfers or the very first transfer fails?

Regards,

Rashi

Regards,
Rashi
0 Likes
lock attach
Attachments are accessible only for community members.

HI,

I actually want to transfer directly through "Transfer file out". however I tested "transfer data out". this problem is for both of them.

For the attached firmware, It doesn't depend on how many files I send, as soon as size of send files get to 144KB, I got this error.

so depend on size of file, It can occur on the first transfer or after a few successful transfers.

For example I can send :

1 file with 144KB size or

9 files 16KB or

3 files with: 64KB , 64 KB, 16 KB

after this amount, this error occurs.

As I mentioned before, the firmware worked well before I change it to 2-threads. I could send 4 MB data by that in serial before this changes. but now it stops after 144 KB.

I attached my test files(16KB, 64KB).

Thanks

0 Likes

Hi,


I appreciate it if let me know that is there any example for multiple thread in GPIF for sending continuous data from USB to GPIF to help me on my project , just like "reversing" the configuration in AN75779? In AN75779, data goes from GPIF to USB, but I have problem from USB to GPIF.

Thanks

0 Likes
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

Apologies for late reply.

I reproduced the issue at my end.

In the firmware you shared, i found that the configuration for serial out is  0x00001F83,  /*  CY_U3P_PIB_GPIF_SERIAL_OUT_CONFIG */

which is socket zero ( as mentioned in GPIF_SEROUT_THREAD_NUMBER_MASK (bit 3:2) is configured for data sink (from USB to GPIF).

As you are using two sockets (thread) in you firmware, this field should be 0. So that the socket is chosen internally (as per the thread)

So the configuration should be 0x00001F81,  /*  CY_U3P_PIB_GPIF_SERIAL_OUT_CONFIG */

I have tested this at my end. Refer to the results

gpif_serial_thread.PNG

PS: I have changed the DMA buffer size and endpoint size to 1024 (for testing purpose)

Regards,

Rashi

Regards,
Rashi
0 Likes

Hi Rashi,
Many many thanks for your big help.
It was the exactly that I was looking for.
Thanks again.

0 Likes