Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > USB Controllers > How to use the complete DMA buffer area with CyU3PDmaChannelCreate?

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



How to use the complete DMA buffer area with CyU3PDmaChannelCreate?
Moderator:
RSKV

Post Reply
Follow this topic



How to use the complete DMA buffer area with CyU3PDmaChannelCreate?

dtromp_nl posted on 26 Nov 2012 8:31 AM PST
Senior Member
11 Forum Posts

How to use the complete DMA buffer area?

I like to know how to use the complete DMA buffer area (of where the unallocatable part is going)

When using the default fx3.ld linker script, I can allocate a maximum of 13 x 16Kb Dma buffers with CyU3PDmaChannelCreate, any requests for more buffer will fail.

When reading the fx3.ld and the FX3 Memory Map section of the programmers manual, I come to the conclusion there is 256Kb available for dma buffers. So where is the remaining 3 x 16Kb?

The default memory map used for FX3 applications is as follows:

   Descriptor area Base: 0x40000000 Size: 12KB
   Code area       Base: 0x40003000 Size: 180KB   
   Data area       Base: 0x40030000 Size: 32KB    
  
   Driver heap     Base: 0x40038000 Size: 32KB  (0x8000)  (Update cyfxtx.c to change this.)
   Buffer area     Base: 0x40040000 Size: 256KB (0x40000) (Update cyfxtx.c to change this.)
  

I also adapted the fx3.ld and cyFxTx.c to change the allocatable DMA buffer area to 336Kb.
When I use these settings, I manage to allocate 18*16Kb Dma buffers with CyU3PDmaChannelCreate (in my application this is a buffer of 1.6ms)


I expect to get 21 x 16KByte buffers. So again I am missing 3 x 16Kbyte...

Adapted CyFxtc.c (set USE_CUSTOMLD compile flag to use)
----------------
#ifdef USE_CUSTOMLD
#define CY_U3P_MEM_HEAP_BASE         ((uint8_t *)0x40024000)   // custom. Must match fx3.ld in current dir
#else
#define CY_U3P_MEM_HEAP_BASE         ((uint8_t *)0x40038000)
#endif

Adapted fx3.ld
---------------
   /*
   Descriptor area Base: 0x40000000 Size: 12KB    
   Code area       Base: 0x40003000 Size: Reduced to 116KB (0x1D000)
   Data area       Base: 0x40020000 Size: Reduced to 16KB (0x04000)
  
   Driver heap     Base: 0x40024000 Size: 32KB  (0x8000) (Update cyfxtx.c to change this.)
   Buffer area     Base: 0x4002C000 Size: 336KB (0x54000)  (Update cyfxtx.c to change this.)
   */  
  
   ...
  
 SYS_MEM  : ORIGIN = 0x40003000 LENGTH = 0x1D000  
 DATA  : ORIGIN = 0x40020000 LENGTH = 0x4000  
 
Any suggestions?

 




Re: How to use the complete DMA buffer area with CyU3PDmaChannelCreate?

Lumpi6 posted on 27 Nov 2012 01:46 AM PST
Top Contributor
183 Forum Posts

Hello dtromp_nl,

have you also changed the address ranges in the SECTION area of the *.ld file? You should change the data region as you changed it in the header of the .ld file.

SECTIONS
{
    . = 0x100;
    .vectors :
    {
        *(CYU3P_ITCM_SECTION);
    } >I-TCM

    . = 0x40003000; /* SYS_MEM ORIGIN */
    .text :
    {
        *(.text*)
        *(.rodata)
        *(.rodata*)
        *(.constdata)
        *(.emb_text)
        *(.init_array)
        *(.data*)
        *(CYU3P_EXCEPTION_VECTORS);
         _etext = .;
    } > SYS_MEM

  . = ALIGN(4);
 
    .ctors :
    {
        PROVIDE(__ctors_start__ = .);
        KEEP(*(SORT(.ctors.*)))
        KEEP(*(.ctors))
        PROVIDE(__ctors_end__ = .);
    } >SYS_MEM
   
    .dtors :
    {
        PROVIDE(__dtors_start__ = .);
        KEEP(*(SORT(.dtors.*)))
        KEEP(*(.dtors))
        PROVIDE(__dtors_end__ = .);
    } >SYS_MEM
 
    . = ALIGN(4);


    . = 0x40020000; /* DATA ORIGIN */
    .data :
    {
        _data = .;
        *(.data)
        * (+RW, +ZI)
        _edata = .;
    } > DATA
.

.

.

regards,

lumpi

 



Re: How to use the complete DMA buffer area with CyU3PDmaChannelCreate?

Lumpi6 posted on 27 Nov 2012 06:45 AM PST
Top Contributor
183 Forum Posts

Hi I forgot,

it is just a code snippet of a .ld file it must not be the same as yours. You just have to take care, that the beginning of code and data section is the same as you defined at to of the .ld file.

regards,

lumpi



Re: How to use the complete DMA buffer area with CyU3PDmaChannelCreate?

dtromp_nl posted on 04 Dec 2012 01:11 AM PST
Senior Member
11 Forum Posts

Hi,

I tried your suggestion. But I am still missing 3x16Kb buffer when I check the return value of

  CyU3PDmaChannelCreate

 

 



Re: How to use the complete DMA buffer area with CyU3PDmaChannelCreate?

Lumpi6 posted on 04 Dec 2012 01:54 AM PST
Top Contributor
183 Forum Posts

Hi,

I belief that a thread stack and some other stuff of peripherals also allocate in these memory regions. May be you can find some documentation in the FX3 manual memory map.

regards,

lumpi






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.