Increasing Byte Transfer CYUSB3011

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

cross mob
jl46
Level 4
Level 4
50 replies posted 50 sign-ins 25 replies posted

Hello,

I have a board with an onboard CYUSB3011 and I'm using a modified firmware based on the bulkloopmanual example firmware (w/ Callback). I was wondering how to enable the burst mode and maximize the amount of bytes that can be transferred over USB because I tried initial modifications and changing from 1024 to even just 2048 yields an IN or OUT transfer error.

Also, what's the maximum bytes that can be transferred over USB with this firmware? I'm assuming it can have higher than 8192 bytes since it's USB3.0 which should have higher throughput or payload.

thanks,
jl46

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
JayakrishnaT_76
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hello,

Please find the attached project. As you are using CYUSB3011 and not CYUSB3014, you need to change the default memory map of FX3(512KB) to 256KB. Please refer to the following KBA to understand more about the memory map of FX3:
https://community.cypress.com/t5/Knowledge-Base-Articles/Modifying-the-Default-Memory-Map-in-FX3-CX3...

I have already made the modification of memory map in this project. In addition to this, I have changed the DMA channel size from 1KB to 8KB. With this modification, I am able to send and receive 8KB of data from the host using the control center application. Please test this project and let me know if it meets your requirement or not.

Best Regards,
Jayakrishna

View solution in original post

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

Hello,

Please share the firmware that you are using for the tests. Is it the default firmware from the FX3 SDK or is it a modified version of the one present in FX3 SDK? Also, kindly share the UART debug logs so that we can debug the issue.

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

Hi Jayakrishna,

I tried using a different firmware (USBBulkLoopManualInOut) and did some slight modifications. I also used the USBBulkSourceSink firmware as reference to commit buffers multiple times. The problem now is that after a few transfer transactions,  I get an error (USB error code:997) in control center.

I disabled the uart debug since the board I'm using isn't the FX3 eval board (no UART connection) and the chip is CYUSB3011 not CYUSB3014 unlike the eval board.

Attached is the firmware project folder. My goal is to transmit higher than 1024 bytes (default). I've tried the multiple commit buffers like in USBSourceSink but like I mentioned, I encounter transfer error after some time.

thanks and regards,
jl46

0 Likes
lock attach
Attachments are accessible only for community members.
JayakrishnaT_76
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hello,

Please find the attached project. As you are using CYUSB3011 and not CYUSB3014, you need to change the default memory map of FX3(512KB) to 256KB. Please refer to the following KBA to understand more about the memory map of FX3:
https://community.cypress.com/t5/Knowledge-Base-Articles/Modifying-the-Default-Memory-Map-in-FX3-CX3...

I have already made the modification of memory map in this project. In addition to this, I have changed the DMA channel size from 1KB to 8KB. With this modification, I am able to send and receive 8KB of data from the host using the control center application. Please test this project and let me know if it meets your requirement or not.

Best Regards,
Jayakrishna
0 Likes

Hi Jayakrishna,

I will try the modified project you sent me. Does this mean that I should use the memory map file in the one you sent me for any future firmware that I'd be making? Is the 8kB the maximum possible transfer amount using the CYUSB3011?

Regards,
jl46

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

Hello,

Yes, you need to use the .ld file for 256KB and the cyfxtx.c file that is present in the project shared in my previous response while working with CYUSB3011.

Is the 8kB the maximum possible transfer amount using the CYUSB3011?

>>The limitation is on the maximum amount of memory that can be allocated for DMA buffers when we compare CYUSB3011 and CYUSB3014. This is because CYUSB3011 has only 256KB RAM where as CYUSB3014 has 512KB RAM. As far as you are using a DMA buffer size and count which can be allocated in the buffer area mentioned in the memory map, there will not be any issues.

Best Regards,
Jayakrishna
0 Likes

Hi Jayakrishna,

I tried compiling the project you sent me using 1.3.4 SDK Cypress EZ-USB Suite. I just edited the loop (a < 1) and the outBuf_p.count to 8192. After uploading, the firmware seems to be operating as is. Bytes with 0x73 as buffer[0] will perform the modified commit while other cases does loopback. I will continue to do some tests with this new firmware and try to build upon this.

I previously have firmware which I based on example codes in the SDK and they seem to be working properly with CYUSB3011. Do I need to rebuild those firmware again using this new memory map and files from the one you sent me?

thanks,
jl46

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

Hello,

We are glad to hear that the project worked fine for you.

Yes, it is recommended to change the .ld file and cyfxtx.c files while using CYUSB3011.

Best Regards,
Jayakrishna
0 Likes

Hi Jayakrishna,

Yes, thank you for the immediate support. I'm doing more tests but initial operation seems as expected!

Where can I find the .ld file? And do I just copy and paste the cyfxtx.c file to the new project folder whenever I create a new one? 

Thanks and regards,
jl46

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

Hello,

You can find the .ld file in the following location:
C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\fw_build\fx3_fw

You need to use the file fx3_256k.ld for CYUSB3011. This is already added in the linker settings inside the project properties of the project that I shared before.

In the cyfxtx.c file, just add the following line to make it compatible for CYUSB3011

#define CYMEM_256K

You can use the project that was shared before as a reference to understand where exactly this line needs to be added.

Best Regards,
Jayakrishna
0 Likes

Hi Jayakrishna,

In any new firmware that I will be making, how can I add the fx3_256k.ld to the project? I want to make sure that the firmware I built would be compatible with the CYUSB3011 to avoid possible problems in the future.

Regards,
jl46 

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

Hello,

In the project properties, just change the setting as shown below:

JayakrishnaT_76_0-1630912704466.png

 

Best Regards,
Jayakrishna
0 Likes

Hi Jayakrishna,

Thank you for this. I will take note of this in my next firmware.

By the way, I tried modifying the firmware you sent me (i.e. changed outBuf_p.count to 8192, outer loop a = 3) and the operation is still as expected. The firmware seems to be good and I will try to make a copy of this which I can modify.

thanks for the assistance!

regards,
jl46

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

Hello,

We are glad to hear that the issue is resolved!

Best Regards,
Jayakrishna
0 Likes

Hi Jayakrishna,

Again, thank you for the help. 

I just have some follow-up question.  What is the maximum dma size that I can set with the firmware you sent me? I was thinking of trying 16384 or maybe even 32768.

Thanks and regards,
jl46

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

Hello,

For the default memory map of 256KB SRAM, you can allocate a total of 32KB only for DMA channel. This includes DMA buffers for control (EP0), debug (CPU->UART) that are allocated inside the library. So, effectively you can use less than 32KB only for allocating DMA buffers. You can alternatively not use the second stage bootloader so that you can use a total of 64KB for allocating DMA buffer. Please refer to the following KBA to understand how the default memory map can be modified for this requirement:

https://community.cypress.com/t5/Knowledge-Base-Articles/Modifying-the-Default-Memory-Map-in-FX3-CX3...

Note that the total amount of memory that can be used for allocating DMA buffers will still be less than 64KB as the libraries will internally create DMA channels for debug and control channels as mentioned before.

Best Regards,
Jayakrishna
0 Likes

Hi Jayakrsihna,

I tried setting the dma.size to size * 16 but I had some problems in the transfers. Does this mean that I'm maxed out at size * 8 for the dma size? If I increase the buf count variable would that help?

Also, if I were to switch to the CYUSB3014, how much would I be able to set for the size? I was testing the firmware initially for 3011 but if the need arises, I might switch to the 3014.

thanks and regards,
jl46

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

Hello,

If you set the dma buffer size to size*8, then for a USB 3 connection, one DMA buffer will need 8KB of memory to be allocated. If you have 2 DMA channels, then it will take 16KB of memory (to allocate one buffer for each channel). As mentioned before, when you make use of default memory map for CYUSB3011, we only have 32KB in total for allocating DMA buffers. So, if you allocate 16KB for one channel, then the DMA channel creation will fail due to the lack of memory. The same will happen if you increase buf count also. 

If you are planning to use CYUSB3014, then you will have a total of 512KB RAM. The default memory map of CYUSB3014 will permit 224KB of memory for allocating DMA buffers. So, if you use CYUSB3014, then you can use greater DMA buffer size. The maximum size that can be allocated for a DMA buffer is 0xFFF0 bytes as mentioned in section 5.5.4 of the FX3 TRM. The FX3 TRM comes along with FX3 SDK and can be found in the following location:

C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\doc\firmware

Best Regards,
Jayakrishna
0 Likes

Hello Jayakrishna,

It seems that eventually, I will have to move up with the CYUSB3014. Thanks again for clarifications and support.

regards,
jl46

0 Likes