Difference between revisions of "BELK-AN-003: Interfacing DDR3 SDRAM to PL"

From DAVE Developer's Wiki
Jump to: navigation, search
(Introduction)
(14 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{InfoBoxTop}}
 
{{InfoBoxTop}}
 
{{Applies To Bora}}
 
{{Applies To Bora}}
{{AppliesToBORA AN}}
 
 
{{InfoBoxBottom}}
 
{{InfoBoxBottom}}
{{WarningMessage|text=This application note was validated against specific versions of the kit only. It may not work with other versions. Supported versions are listed in the ''History'' section.}}
 
==History==
 
{| class="wikitable" border="1"
 
!Version
 
!Date
 
!BELK version
 
!Notes
 
|-
 
|1.0.0
 
|14:35, 31 August 2015 (CEST)
 
|[[Bora_Embedded_Linux_Kit_(BELK)#BELK_software_components|2.1.0]]
 
|First release
 
|-
 
|}
 
  
 
==Introduction==
 
==Introduction==
Even though PL can share main SDRAM with PS, several applications need a dedicated bank for FPGA IPs in order to have exclusive access and to maximize bandwidth. In any case, since this additional SDRAM bank is accessible via AXI bus, it is mapped in the processor's memory space and thus it can be accessed by PS as well.
+
Even if PL can share main SDRAM with PS, several applications need a dedicated bank for FPGA IPs in order to have exclusive access and to maximize bandwidth. In any case, since this additional SDRAM bank is accessible via AXI bus, it is mapped in the processor's memory space and thus it can be accessed by PS as well.
  
BoraEVB can optionally be populated with a 16-bit 512MB SDRAM chip that is directly connected to PL (1). This application note describes how to enable the support for this additional memory bank. An example Vivado design is released along with this application note, based on [[Bora_Embedded_Linux_Kit_%28BELK%29#BELK_software_components|BELK 2.1.0]].
+
BoraEVB can optionally be populated with a 16-bit 512MB SDRAM chip that is directly connected to PL (1). This application note describes how to enable the support for this additional memory bank. An example Vivado design is released along with this application note, based on BELK 2.1.0 (http://wiki.dave.eu/index.php/Bora_Embedded_Linux_Kit_%28BELK%29#BELK_software_components).
  
  
(1) For more information about this option, please contact technical support ([mailto:support-bora@dave.eu support-bora@dave.eu]).
+
(1) For more information about this option, please contact technical support (support-bora@dave.eu).
  
 
==Physical interfacing==
 
==Physical interfacing==
Line 41: Line 26:
 
[[File:an-belk-003_02.png | 800px | AXI Memory Controller Block Design]]
 
[[File:an-belk-003_02.png | 800px | AXI Memory Controller Block Design]]
  
The Vivado example project can be downloaded from the following URL:
 
  
[https://www.dave.eu/system/files/area-riservata/AN-BELK-003-bora-AXI-DDR3-BELK-2.1.0_no_results.xpr_.zip AN-BELK-003 Vivado project (without synthesis and implementation results)]
+
At this URL '''TBD''' a Vivado example project is available. This project requires a 200 MHz clock source. It has been tested with
 
 
This project requires a 200 MHz clock source. It has been tested with
 
 
* Silicon Labs Si511BBA200M000BAG active ocillator populating reference XO1 on BoraEVB
 
* Silicon Labs Si511BBA200M000BAG active ocillator populating reference XO1 on BoraEVB
 
* Micron MT41K64M16JT-15E DDR3 chip running at 400 MHz.
 
* Micron MT41K64M16JT-15E DDR3 chip running at 400 MHz.
  
The bitstream and boot binaries can be downloaded from the following URL:
+
Here '''TBD''' can be downloaded the resulting bitstream.
 
 
[https://www.dave.eu/system/files/area-riservata/AN-BELK-003.bitstream-boot-binaries.zip AN-BELK-003 binaries]
 
  
 
==SDRAM bank mapping==
 
==SDRAM bank mapping==
Line 59: Line 39:
 
[[File:an-belk-003_03.png | 800px | AXI Memory Controller Address Mapping]]
 
[[File:an-belk-003_03.png | 800px | AXI Memory Controller Address Mapping]]
  
The following dump shows a simple memory test run from U-Boot console:
 
<pre>
 
U-Boot 2013.04 (Aug 25 2014 - 23:52:57) [belk-2.1.0]
 
  
I2C:  ready
+
It's possible to extend Linux kernel memory with the external memory adding a second memory in the device tree:
Memory: ECC disabled
 
DRAM:  1 GiB
 
WARNING: Caches not enabled
 
Now running in RAM - U-Boot at: 3ff68000
 
NAND:  1024 MiB
 
MMC:  zynq_sdhci: 0
 
SF: Detected S25FL256S_64K with page size 64 KiB, total 32 MiB
 
In:    serial
 
Out:  serial
 
Err:  serial
 
Net:  Gem.e000b000
 
Hit any key to stop autoboot:  0
 
zynq-uboot> help mtest
 
mtest - simple RAM read/write test
 
 
 
Usage:
 
mtest [start [end [pattern [iterations]]]]
 
zynq-uboot>
 
zynq-uboot> mtest 0x48000000 0x4FFFFFFF
 
Testing 48000000 ... 4fffffff:
 
Pattern 00000000  Writing...  Reading...Iteration:    53
 
zynq-uboot> <INTERRUPT>
 
zynq-uboot>
 
zynq-uboot> mtest 0x48000000 0x4FFFFFFF 0xA5A5A5A5
 
Testing 48000000 ... 4fffffff:
 
Pattern A5A5A5A5  Writing...  Reading...Iteration:    19
 
zynq-uboot> <INTERRUPT>
 
</pre>
 
 
 
It's also possible to extend Linux kernel memory with the external memory adding a second memory in the device tree:
 
  
 
<pre>
 
<pre>
Line 102: Line 49:
 
</pre>
 
</pre>
  
The kernel patch can be downloaded from the following URL:
+
Here '''TBD''' can be downloaded the kernel patch.
 
 
[https://www.dave.eu/system/files/area-riservata/AN-BELK-003_Add_AXI_DDR3.patch_.zip AN-BELK-003 Linux patch]
 

Revision as of 09:20, 28 August 2015

Info Box
Bora5-small.jpg Applies to Bora

Introduction[edit | edit source]

Even if PL can share main SDRAM with PS, several applications need a dedicated bank for FPGA IPs in order to have exclusive access and to maximize bandwidth. In any case, since this additional SDRAM bank is accessible via AXI bus, it is mapped in the processor's memory space and thus it can be accessed by PS as well.

BoraEVB can optionally be populated with a 16-bit 512MB SDRAM chip that is directly connected to PL (1). This application note describes how to enable the support for this additional memory bank. An example Vivado design is released along with this application note, based on BELK 2.1.0 (http://wiki.dave.eu/index.php/Bora_Embedded_Linux_Kit_%28BELK%29#BELK_software_components).


(1) For more information about this option, please contact technical support (support-bora@dave.eu).

Physical interfacing[edit | edit source]

The following picture shows logical connection of the SDRAM bank.

AXI Memory Controller

Please note that the BANK #35 of Zynq must be powered at 1.5V to interface DDR3 SDRAM. To do that J11.1-2 must be opened and J11.3-4 must be shorted.

Integrating memory controller[edit | edit source]

As depicted in the block diagram below, a memory controller has to be instantiated in PL to access SDRAM. This block has been generated with Memory Interface Generator (MIG) tool (http://www.xilinx.com/products/intellectual-property/mig.html).

Memory Interface Generator (MIG) is configured properly to work with Micron MT41K64M16JT-15E DDR3 memory chip at the frequency of 400MHz. It needs a precise external reference clock of 200MHz provided by an active LVDS oscillator connected on BANK #34 pins. The MIG is then connected to the PS through the AXI GP0 interface to allow user to access the external memory.


AXI Memory Controller Block Design


At this URL TBD a Vivado example project is available. This project requires a 200 MHz clock source. It has been tested with

  • Silicon Labs Si511BBA200M000BAG active ocillator populating reference XO1 on BoraEVB
  • Micron MT41K64M16JT-15E DDR3 chip running at 400 MHz.

Here TBD can be downloaded the resulting bitstream.

SDRAM bank mapping[edit | edit source]

SDRAM bank is mapped in the PS's addressable space at physical address range 0x48000000-0x4FFFFFFF, as shown in the following picture:

AXI Memory Controller Address Mapping


It's possible to extend Linux kernel memory with the external memory adding a second memory in the device tree:

	axi_ddr: memory@48000000 {
		device_type = "memory";
		reg = < 0x48000000 0x08000000 >;
	} ;

Here TBD can be downloaded the kernel patch.