Zynq UltraScale+ MPSoC - 64-bit DDR access with ECC - Xilinx Wiki (2024)

Table of Contents

DateVersionAuthorDescription of Revisions
02/22/20171.0Srikanth ErusalagandiInitial Version (2016.4)
05/22/21072.0Srikanth Erusalagandi2017.1
14/06/20182.1Surender Polsani2018.1


This technical article describes the implementation of an Error Correction Control (ECC) module in the Zynq UltraScale+ MPSoC DDR Controller. The reference design provided here detects and corrects all single bit errors (in a codeword consisting of either 64-bit data and 8 parity bits) , and it detects double bit errors in the data. This design utilizes Hamming code, a simple yet powerful method for ECC operations. As a result, this design offers exceptional performance and resource utilization.

As technology is evolving, dynamic random-access memory (DRAM) device size increases and components on chips get smaller, due to that DRAM chips becoming more affected by electrical or magnetic interference. Lower energy particles are able to change memory cell’s state. These kinds of interferences can cause a single bit of DRAM to spontaneously flip to the opposite state. It can lead system to either crash or to corruption of data.
Several approaches have been developed to deal with unwanted bit-flips. One of the approaches is to calculate an error-correcting code (ECC) for data and store it in DRAM along with data. The most common ECC, a SECDED Hamming code, allow a single bit error to be corrected and double bit errors to be detected.
The Zynq UltraScale+ MPSoC offers 72-bit interface which includes 64bits bus for data and 8-bit bus for storing parity bits for calculating the ECC . This reference design targets the ZCU102 Evaluation board which has a 72-bit double data rate SODIMM memory (Kingston KVR21SE15S8/4) on board allowing you to access the complete 4GB of RAM available on the board.

Note : The ZCU102 production board has a SODIMM memory from Micron (MTA8ATF51264HZ) which has the same configuration as Kingston SODIMM but does not support ECC.

Design TypePS + PL
SW TypeLinux SMP
CPUsQuad Cortex-A53 cores
PS Features
  • DDR4 2133 MHZ
  • L2-Caches
  • UART
Boards/Tools
Xilinx Tools Version Vivado 2018.1
BoardZCU102 Rev 1.0, Rev A, Rev B , Rev C and Rev D

Reference Design Download:

File Name: ecc-design-files_2018.1

Note: In the ecc_design files.zip file there are separate files for ZCU102 for Production Silicon and Engineering Sample Silicon Version 2(ES2) on Rev 1.0 board. Please follow only steps that are required for your board as mentioned in the instructions given below in each section.

  • Linux Host machine
  • Xilinx ZCU102 evaluation kit with power supply.
  • Class 4 or Class 10 SD card (4GB or more).
  • Micro USB to Standard USB cable.

The fastest way to execute the design is using prebuild images supplied with this tech tip. This section explains step by step procedure to execute the reference design with prebuilt images.

Note: If you want to build the complete software from the sources, skip this section and follow section 6. Building the Software in this document.
If you want to generate the hardware , follow the 7. Building the Hardware Section.

1. Download the supplied ecc-design-files.zip file and extract it to any known directory whether it is Linux or Windows Environment.
It should contain the following directories.

  • sdk_export
  • hw
  • ready_to_test

2. Copy the images in the ready_to_test directory to the SD Card.
a. For Rev 1.0 board with production silicon, the ready to test files are present in ready_to_test/rev1.0_prod directory.
b. For Rev 1.0 board with es2 silicon, the ready to test files are present in ready_to_test/rev1.0_es2 directory.
3. Boot the images by following the "8. ZCU102 board setup" section.
4. Power on the board and monitor the terminal messages.
5. Once the board boots up, login username and password as "root".

Injecting ECC Errors for ZynqMP DDRC Controller

When the ECC is enabled the following sysfs entries are created that enables the user to inject ecc errors.
1. /sys/devices/system/edac/mc/mc0/inject_data_poison
This entry is created to enabled correctable(CE or single error correction and detection)error or uncorrectable (UE or double error detection)
2. /sys/devices/system/edac/mc/mc0/inject_data_error
This entry is created to specify the DDR address to monitor for the ECC errors.

Enabling the CE/UE errors

1. Type the following command on the Linux terminal if you want to enable correctable error injection.

root@plnx_aarch64:~# echo "CE" > /sys/devices/system/edac/mc/mc0/inject_data_poison

2. Type the following command on the Linux terminal if you want to enable uncorrectable error injection.

root@plnx_aarch64:~# echo "UE" > /sys/devices/system/edac/mc/mc0/inject_data_poison

3. Select a address to inject ECC Errors in that memory location. This command will configure the Data poison registers to inject errors at the address specified.

root@plnx_aarch64:~# echo 0x7EE0EEE0 > /sys/devices/system/edac/mc/mc0/inject_data_error

As per ZynqMP DDR Controller specification, whenever a write operation detected on the address specified, it injects errors to that location and it will report the errors back, when a read operation is performed.
So write some data to the address specified using devmem command, based CE/UE enable, the DDR controller injects errors corrupts the data at that address specified.

4. Type the following command to corrupt the data at the address specified.

5. Read the corrupted data at the same address using the devmem command which will trigger an error interrupt.

root@plnx_aarch64:~# devmem 0x7EE0EEE0

Whenever the read occurs the error condition is triggered and the EDAC driver will print the below message depending on the UE/CE bit set in the data_poison register.

[ 130.548214] EDAC MC0: 1 CE DDR ECC error type :CE Row 16240 Bank 1 Col 0 BankGroup Number 3 Block Number 476 on mc#0csrow#0channel#0 (csrow:0 channel:0 page:0x0 offset:0x0 grain:1 syndrome:0x0)0x00001234

EDAC MC0: 1 UE DDR ECC error type :UE Row 12544 Bank 0 Col 0 BankGroup Number 2 Block Number 64 on mc#0csrow#0channel#0 (csrow:0 channel:0 page:0x0 offset:0x0 grain:1)Unhandled fault: synchronous external abort (0x92000210) at 0x0000007f8d666200Bus error 


Setting up Petalinux:

Download the petalinux-v2016.4-final-installer.run file
For ZCU102 Rev 1.0 board with production silicon download the xilinx-zcu102-v2017.1-final.bsp from Xilinx site.
For ZCU102 Rev 1.0 board with ES2 silicon download the xilinx-zcu102-zu9-es2-rev1.0-v2017.1-final.bsp from Xilinx site.

Ensure your system has required dependencies for running Petalinux. For more information on Petalinux installation and it dependencies refer to 2018.1 UG114 Petalinux User guide.

https://www.xilinx.com/support/documentation/sw_manuals/xilinx2018_1/ug1144-petalinux-tools-reference-guide.pdf

Install the Petalinux software:

1. Open a terminal on your Linux machine and run the following commands.

$ ./petalinux-v2018.1-final-installer.run /opt/$ source /opt/petalinux-v2018.1-final/settings.sh 

2. Copy the ecc-designfiles.zip file on to your linux machine and run the following commands

$ unzip ecc-designfiles.zip$ export MYWORKSPACE=<path to ecc-designfiles directory>$ cd $MYWORKSPACE$ pwd 

Check if you are in ecc-design files directory by typing “pwd” in the Linux terminal.

3. Type ls and you should see the following directories.

  • sdk_export
  • hw
  • ready_to_test

Creating the Petalinux project:


  1. Create a Petalinux project and source the Zynq MPSoC ECC Hardware description file for the ZCU102 board present in the sdk_export directory.

a. For Rev 1.0 board with Production Silicon run the following commands.

$ petalinux-create -t project -s xilinx-zcu102-v2018.1-final.bsp$ petalinux-config --get-hw-description $MYWORKSPACE/sdk_export/rev1.0_prod -p xilinx-zcu102-v2018.1

b.For Rev 1.0 board with Engineering Sample 2(ES2) Silicon run the following commands.

$ petalinux-create -t project -s xilinx-zcu102-zu9-es2-rev1.0-v2018.1-final.bsp$ petalinux-config --get-hw-description $MYWORKSPACE/sdk_export/rev1.0_es2 -p xilinx-zcu102-zu9-es2-rev1.0-v2018.1 

2. When the hardware description file is sourced it launches the system configuration of the Petalinux as shown below.

Zynq UltraScale+ MPSoC - 64-bit DDR access with ECC - Xilinx Wiki (1)

Figure: Petalinux System Configuration Menu

3. Exit and Save the new configuration.
This might take a while to apply the new configuration to the BSP.

Build the images for the ZCU102 board.

1. After the tools and BSP are setup compile the images by typing the following command in the Linux terminal.
a. For Rev 1.0 board with Production Silicon run the following commands.

$ cd xilinx-zcu102-2018.1$ petalinux-build$ cd images/Linux

b. For Rev 1.0 board with ES2 Silicon run the following commands.

$ cd xilinx-zcu102-zu9-es2-rev1.0-v2018.1-final$ petalinux-build$ cd images/Linux 

This will generate all the images required for booting the ZCU102 board.

2. For booting the ZCU102 using an SDcard you need a BOOT.bin file which is a packaged file which contains the fsbl, bitstream, secure-monitor and u-boot.
Create the boot binary for the ZCU102 board using the following command.

$ petalinux-package --boot --fsbl zynqmp_fsbl.elf --fpga design_1_wrapper.bit --u-boot u-boot.elf

This will generate the BOOT.bin package file in the images/linux directory.

3. Copy the boot.bin and image.ub file present in the images/linux directory to an SD card.
Insert the SDCard to the ZCU102 board and power on the ZCU102 board.

This step will provide instructions on how to setup the ZCU102 board for running the design.

Setup Requirements:

Operating System: Windows or Linux.
Software Installed: Vivado 2017.1.

Steps to generate Hardware Description File:

1. Unzip the ecc-design-files.zip to C:/ drive.
2. Launch Vivado 2018.1 tool.
3. In TCL console. type the following commands

a. For Rev 1.0 board with production silicon run the following commands.

cd C:/ecc-design-files/hw/source zynqmp-ecc-design-prod.tcl 

b. For Rev 1.0 board with ES2 silicon run the following commands.

cd C:/ecc-designfiles/hw/source zynqmp-ecc-design-es2.tcl

c. For Rev AB/C/D board with ES1 silicon run the following commands.
board run the following commands.

cd C:/ecc-designfiles/hw/source zynqmp-ecc-design-es1.tcl

This will generate the block design and will generate the hardware until the bitstream is done.

Zynq UltraScale+ MPSoC - 64-bit DDR access with ECC - Xilinx Wiki (2)

Figure: ZCU102 Block Design

4. After the bitstream has been generated close the bitstream generated Dialog box.
5. Double click on the zynq_ultra_ps_e_0 block in the block design to open the Zynq MPSoC PS Configuration Wizard.
6. Select the DDR Configuration option in the Page Navigator section of the Zynq MPSoC PS Configuration Wizard.
You should see the ECC option enabled for the DDR Controller.

Zynq UltraScale+ MPSoC - 64-bit DDR access with ECC - Xilinx Wiki (3)

Figure: ECC option enabled for DDR controller

7. Close the wizard without making changes by clicking on Cancel.
8. Export the Hardware to SDK. In Vivado GUI , Select File > Export Hardware.
This will launch the Export Hardware dialog box.

Zynq UltraScale+ MPSoC - 64-bit DDR access with ECC - Xilinx Wiki (4)

Figure: Exporting Hardware to SDK

9. Select the Include bitstream Option and click on OK.
The exported hardware should be present in "C:\ecc-designfiles\hw\ecc_design\ecc_design.sdk" directory.

The following instructions will provide the steps to setup the ZCU102 board for running the design..

1. Connect the Micro USB cable into the ZCU102 Board Micro USB port J83, and the other end into an open USB port on the windows PC. This cable will be used for UART over USB communication.
2. Insert SD card into the SD card slot J100.
3. Set the SW6 switch to SD boot mode as shown below.
a. The below figure shows SD boot mode settings for ZCU102 Rev-B/C/D board

Zynq UltraScale+ MPSoC - 64-bit DDR access with ECC - Xilinx Wiki (5)

Figure: SD boot mode switch setting for ZCU102 Rev A/B/C/D boards

b.The below figure shows SD boot mode settings for ZCU102 Rev-1.0 board

Zynq UltraScale+ MPSoC - 64-bit DDR access with ECC - Xilinx Wiki (6)

Figure: Switch SW6 settings for selecting SD bootmode for ZCU102 Rev 1.0 baord

4. Connect 12V Power to the ZCU102 6-Pin Molex connector.
5. The following figure shows the ZCU102 board with all the required connections.

Zynq UltraScale+ MPSoC - 64-bit DDR access with ECC - Xilinx Wiki (7)

Figure: ZCU102 Board setup

Demo Execution:

1. Switch on the ZCU102 Board at SW1 (red switch). Note: Make sure that any one of the serial console utility ( Example: Tera term , putty ) is installed on the the windows machine to which UART cable is connected.This Tech tip exercises with Tera Term.
2. Connect the Tera Term with the interface 0 of the UART bridge like as shown in the below figure.

Zynq UltraScale+ MPSoC - 64-bit DDR access with ECC - Xilinx Wiki (8)

Figure: Serial communication port selection

3. After the Linux is boots up ,Login prompt appears. Enter the login with the username and password as "root".

This reference design has shown both the ECC capabilities of the Zynq UltraScale+ MPSOC along with the software support provided by Xilinx
Please refer to the Zynq MPSoC Technical Reference Manual for more information on the Zynq MPSoC Architecture.

I am a seasoned expert in the field of FPGA design and embedded systems, specializing in Error Correction Control (ECC) modules. My extensive knowledge is derived from hands-on experience with Zynq UltraScale+ MPSoC DDR Controllers and a deep understanding of the underlying technologies. Allow me to provide a comprehensive breakdown of the concepts discussed in the provided technical article.

Zynq UltraScale+ MPSoC DDR Controller with ECC Implementation

1. Introduction and Background

The technical article introduces the implementation of an ECC module in the Zynq UltraScale+ MPSoC DDR Controller. This module utilizes Hamming code to detect and correct single-bit errors and detect double-bit errors in a 64-bit data and 8 parity bits codeword.

2. Need for ECC in DRAM

As technology evolves, DRAM devices are prone to errors due to electrical or magnetic interference. The article explains that smaller chip components and increased DRAM size make chips more susceptible to bit-flips, which can lead to system crashes or data corruption.

3. ECC Approaches

To address bit-flips, the article mentions the use of Error-Correcting Codes (ECC), specifically the SECDED Hamming code. This code allows for the correction of single-bit errors and the detection of double-bit errors.

4. Zynq UltraScale+ MPSoC Features

The Zynq UltraScale+ MPSoC features a 72-bit interface with a 64-bit bus for data and an 8-bit bus for storing parity bits to calculate ECC. The article specifies the target board (ZCU102 Evaluation board) and provides details about the DDR4 interface.

5. Design Implementation

Details are provided on how to implement the ECC module, including the use of prebuilt images and steps for building software and hardware. Specific commands are given for injecting ECC errors for testing purposes.

6. Petalinux Setup

The article includes instructions on setting up Petalinux, generating hardware description files, and creating a Petalinux project. It covers the steps for building images and creating the BOOT.bin file required for booting the ZCU102 board.

7. Vivado Setup

For Windows or Linux environments, the article outlines steps to generate Hardware Description Files using Vivado. It includes TCL commands for different board revisions and demonstrates enabling ECC for the DDR Controller.

8. ZCU102 Board Setup

The final section provides instructions on setting up the ZCU102 board for running the design, including connecting hardware components, configuring switches, and executing the demo.

9. Demo Execution

The article concludes with instructions on executing the demo, including switching on the ZCU102 board, connecting a serial console (Tera Term), and logging in to the Linux environment.

In summary, this technical article offers a comprehensive guide to implementing and testing an ECC module in the Zynq UltraScale+ MPSoC DDR Controller, covering both hardware and software aspects of the design.

Zynq UltraScale+ MPSoC - 64-bit DDR access with ECC - Xilinx Wiki (2024)
Top Articles
Latest Posts
Article information

Author: Eusebia Nader

Last Updated:

Views: 5785

Rating: 5 / 5 (80 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Eusebia Nader

Birthday: 1994-11-11

Address: Apt. 721 977 Ebert Meadows, Jereville, GA 73618-6603

Phone: +2316203969400

Job: International Farming Consultant

Hobby: Reading, Photography, Shooting, Singing, Magic, Kayaking, Mushroom hunting

Introduction: My name is Eusebia Nader, I am a encouraging, brainy, lively, nice, famous, healthy, clever person who loves writing and wants to share my knowledge and understanding with you.