element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Path to Programmable
  • Challenges & Projects
  • Design Challenges
  • Path to Programmable
  • More
  • Cancel
Path to Programmable
Blog Working with DMA through AXI between DDR and PL BlockRAM
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: mu.udhay
  • Date Created: 18 Nov 2018 7:08 PM Date Created
  • Views 6540 views
  • Likes 5 likes
  • Comments 6 comments
  • dma
  • dma in minized
Related
Recommended

Working with DMA through AXI between DDR and PL BlockRAM

mu.udhay
mu.udhay
18 Nov 2018

Hello Everyone, My peers in Path to Programable have Done Great work in giving step by step procedure to implement DMA transfer so Why Reinvent the Wheel , I take a different approach.

I will try to present a vivid picture regarding Why we need to implement few IPs to achieve DMA transfer between BRAM and DDR instead of using PS and How?

First As always we take Bottom Up approach , Fasten your Seat Belts !

 

What is DMA ?

DMA refers to Direct Memory Access , which in short is used to releive the PS from the Burden of Transfering Data from Memory (DDR in this case)

to other I/O device (BRAM in PL for this case) , so that PS may do other important tasks , It also reduces the possible length of the Path through which Data will travese.

So DMA is simply a peripheral device/Functional Block  which requires the Source Address and Destination Address with the Size of Block of Data to transfer.

 

What is Block RAM (BRAM)?

It is some Dedicated Portion in PL section where only memory structures are fabricated which is different from logical block(slice) in PL where other elements (Mulltiplexers/LUTs , FlipFlops ) are present.It is made so that we don't waste a Logical Block for storing Data.

Functionally a BRAM is used for storing Blocks of Data , It can also be used as a FIFO between PL and PS blocks and other only when we use it with help of a Controller which is responsible for synchronizing reading and writing data in BRAM.

So a BRAM is just some bunch or Raw space for Bits and the BRAM controller is the Brain which uses the Space for our Needs .

 

Implementation:

In minized we  implement it on PL fabric by using BLOCK MEMORY GENERATOR IP which creates the space (for bunch of data in blocks) and also the Controller where we selected Dual Port so that we can Read Data from One End and Write Data into it from Other End (more flexible than a FIFO) and also use it as a DDR for PL blocks to Process Data.

 

1.)In your Existing project just go for add IP and type "GENERATOR" and select the "BLOCK MEMORY GENERATOR IP"

Configure the Controller as you wish based on your Requirement , For instance I used these settings :

image

image

 

2.)

a.)Reconfigure "ZYNQ7 PROCESSING SYSTEM" ip block to Enable Fabric Clock 'FCLK_CLK0' in 'Clock Configuration' section for PL (every system needs clock Isn't It) and

 

image

 

b.)Enable 'M AXI GP0 Interface' in 'PS-PL Configuration'

image

 

3.)Add Another IP "AXI BRAM CONTROLLER" and configure it based on above settings (for Instance)as shown below  :

image

What Is this AXI ?

AXI is simply a bus Standard in which there will be a master and slave , the master generates the control signals to decide when to transfer or allow slave to send Data , we use multiple masters and slaves by means of AXI interconnect(we will see it).

 

 

What is This AXI BRAM CONTROLLER used for ?

It acts as a Bridge to connect PS to BRAM Controller, since we are using AXI bridge we need to make sure BRAM Controller to understands  AXI's language , so we add this IP to our Design.

 

4.) Add 'AXI Interconnect' (If you got More Devices) or 'AXI smart connect' (for single device) IP in your Design to connect the Master AXI of PS connect to the above PL blocks seen as Slaves .In my case i sort for AXI Smart Connect (because Small Work Isn't It image):

image

 

5.)Add "Processor System Reset" IP which is neccesary to prevent crazy things to happen and Synchronize it by reseting PL blocks to some known state

image

How they Work ?

For Eg. Consider you want to Add data read by MEMS sensor connected to PS whose Data stored in DDR using Adders implemented in PL.

On starting the minized the "Processor System Reset" resets the PL,AXI(other peripherals if any) and maintain them in a predefined state until PS starts up and running.

Since data is continuously generated from Sensor we can use BRAM Controller in PL to store data to process by Adder in PL logic .

We connect the DDR through PS to 'BRAM Controller'  through AXI Interconnect(or smart connect) and 'AXI BRAM Conroller'  and transfer that Data to BRAM Port A  and this Data is used by Adder Logic in PL through Port B of BRAM ,In this way a Dual Port BRAM can be used in Variety of ways and it makes our lives easierimage

 

Exporting the Hardware

Validate the design ->Reset Output Products and then Generate Output Product under the sources and the SystemWrapper

Generate Bitstream -> Export Hardware to SDK workspace

Launch SDK with the same location mentioned as workspace (where we stored Bitstream)

 

SDK Part Folks !

 

1.)In SDK, Create a New BSP -> Import your previous peripheral projects for using those devices such as UART for serial communication

image

 

2.)Create a new application project (File ->New -> Application Project)

3.)Enter BRAM_DMA_Test for the Project name and select Use existing for the BSP. Click NEXT ->Select Empty Application ->Finish.

4.)Then Import the BRAM program code(attached below) into your Project src by:

imageimage

 

Select the Path where you stored the "dma_test.c" attached here and select this file -> Finish

 

Running The Program

 

1.)Connect Minized to computer

2.)Program the FPGA ( PL ) :

image

     Then Go for Default options -> Program

3.)Open Serial Terminal like Putty or Teraterm at 115200 baud rate

4.)Right-click on BRAM_DMA_Test and select Run As ->Launch on Hardware (System Debugger)

5.)Once the code is downloaded to the board, TeraTerm/Putty should show the burst size prompt.

image

 

That's It image

Meet you guys in my Next Post , where we will create a Custom IP for Ourselves.

 

Feel Free to Comment !

Attachments:
dma_test.c.zip
  • Sign in to reply

Top Comments

  • mu.udhay
    mu.udhay over 6 years ago in reply to DAB +3
    Hi DAB , thank you for the Remainder , I placed the screen shot of my test results below: As we can see by Increasing the Block size of transfer through DMA we are getting higher Performance over transfer…
  • DAB
    DAB over 6 years ago +2
    Did you do any timing tests for these test cases and compare them to non-DMA transfers of the same size? DAB
Parents
  • DAB
    DAB over 6 years ago

    Did you do any timing tests for these test cases and compare them to non-DMA transfers of the same size?

     

    DAB

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • DAB
    DAB over 6 years ago

    Did you do any timing tests for these test cases and compare them to non-DMA transfers of the same size?

     

    DAB

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
  • mu.udhay
    mu.udhay over 6 years ago in reply to DAB

    Hi DAB , thank you for the Remainder , I placed the screen shot of my test results below:

    As we can see by Increasing the Block size of transfer through DMA we are getting higher Performance over transfer through PS with upto 22x , huge PS computing time can be saved by using DMA.

    image

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube