CX3 RAM memory size too small on SYS_MEM segment

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

cross mob
SimonP
Level 3
Level 3
25 replies posted 25 sign-ins 10 replies posted

Hello,

I am developing a firmware for a Cypress CX3 that control multiple sensor on top of streaming a camera sensor.

After integrating the last sensors, my code is now too big to fit in the SYS_MEM segment:

SimonP_0-1636129718336.png

I tried to increase its size as proposed on other topics but I cannot change "CY_U3P_SYS_MEM_TOP" as my firmware also requires a 2-stage bootloader. Increasing the SYS_MEM segment size reduced the other segments and the DMA streaming is not functioning anymore.

I need to increase the SYS_MEM length to at least 0x34000 to fit all my code. How can I increase it while keeping the DMA video streaming functional ?

 

Thank you for your help,

SimonP

0 Likes
1 Solution

Hello SimonP,

Yes, you should change the DMA buffer size or count so that the error CY_U3P_ERROR_MEMORY_ERROR can be avoided. For this, you can change the value of the macros CX3_UVC_STREAM_BUF_SIZE or CX3_UVC_STREAM_BUF_COUNT. When you change the value of CX3_UVC_STREAM_BUF_SIZE, please ensure that the following conditions are satisfied:

1. The DMA buffer size should be a multiple of 16 bytes

2. Keep the DMA buffer size as large as possible

3. The video frame should always end with a partial buffer. That is, the video frame size should not be perfectly divisible with the DMA buffer size.

Best Regards,
Jayakrishna

View solution in original post

5 Replies
JayakrishnaT_76
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hello SimonP,

 As you might be knowing, the total SRAM size for CX3 is 512KB. If you need to increase the memory allocated for one section, then you should decrease the memory allocated for another section. As you need second stage bootloader for this application, you can try to reduce the memory used for allocating DMA buffers. Please refer to the following KBA to understand more on modifying the default memory map of CX3:

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

Best Regards,
Jayakrishna
0 Likes

Hello Jayakrishna,

I've read this topic before but it only explains how to use the memory reserved for the bootloader to increase the code memory.

I increased the code area and therefore reduce the Buffer area in the fx3.ld as follow :

SimonP_0-1636368715661.png

and I updated the cyfxtx.c file accordingly :

SimonP_1-1636384204615.png

That means that my new BUFFER HEAP SIZE is now 0x31000 instead of 0x38000.

I tried to use this configuration but the method CyU3PDmaMultiChannelCreate fails with a CY_U3P_ERROR_MEMORY_ERROR.

I suppose this means there is not enough memory to allocate my DMA buffer.

I should probably change something in my DMA configuration :

SimonP_2-1636385196614.png

What should I change ? should I reduce the size of the buffer or the count ? Is there other places that needs to be changed when reducing the buffer memory size ?

Best regards,

SimonP

0 Likes

Hello SimonP,

Yes, you should change the DMA buffer size or count so that the error CY_U3P_ERROR_MEMORY_ERROR can be avoided. For this, you can change the value of the macros CX3_UVC_STREAM_BUF_SIZE or CX3_UVC_STREAM_BUF_COUNT. When you change the value of CX3_UVC_STREAM_BUF_SIZE, please ensure that the following conditions are satisfied:

1. The DMA buffer size should be a multiple of 16 bytes

2. Keep the DMA buffer size as large as possible

3. The video frame should always end with a partial buffer. That is, the video frame size should not be perfectly divisible with the DMA buffer size.

Best Regards,
Jayakrishna

Hello Jayakrishna,

Thank you for the answer. I reduced CX3_UVC_STREAM_BUF_SIZE as recommended and managed to make it work.

What are the impact of reducing the size of this buffer ? Will it impact the performances or the bandwidth of the interface for example ?

 

Best regards,

SimonP

0 Likes

Hello SImonP,

Yes, when the size of DMA buffers are reduced, you might face issues like commit buffer failures. This happens when the host is slow in issuing IN tokens to clear the DMA buffers filled by CX3. As the size of the DMA buffers are decreased, the chances for this to happen will be more. You can refer to the following KBA to understand more on commit buffer failures:

https://community.infineon.com/t5/Knowledge-Base-Articles/Handling-Commit-Buffer-Failures-Occurred-d...

The above KBA is applicable for CX3 too.

Best Regards,
Jayakrishna
0 Likes