Home - bkushal26/ELM_Bring_up_Petalinux GitHub Wiki

Welcome to the ELM_Bring_up_Petalinux wiki!

This page serves as instructions and a user guide for the ELM board bring-up tests (Individual Tests, for integrated Tets, visit Integrated-Tests wiki page ). In order to conduct these tests, the test scripts need to be transferred to the board. These can be transferred by using scp.

GEM Project

GEM Bring up Tests-

Two tests are conducted-

  • Ping
  • iperf

GEM folder includes shell scripts to automate the tests.

  1. ping_iperf_client.sh-To be sourced on Board by- sh ping_iperf_clinet.sh
  2. ping_iperf_server.sh-To be sourced on Host PC by- sh ping_iperf_server.sh
  • Note-Current Petalinux images are configured to static IP settings

Notes regarding iperf tests-

  • User first needs to start Iperf server on the host system by running ping_iperf_server.sh script.
  • If after launching shell script on the server, if this error is printed-iperf3: error - unable to connect to server: No route to host then chances are firewall is blocking the iperf data packets. In that case, Follow the following steps-
  1. Check if the port is open by- sudo firewall-cmd --list-ports
  2. If you dont see 5201/udp or 5201/tcp, add them by-
sudo firewall-cmd --permanent --add-port=5201/udp 
sudo firewall-cmd --permanent --add-port=5201/tcp 
sudo firewall-cmd --reload 

EEPROM Tests

Testing Codes

C Program

We also attempted to test both the EEPROMS using i2cset and i2cget with the help of a C program which could be compiled directly on the board.

This file can be found at -> ELM_Bring_up_Petalinux/I2C/C_program/

Considering current changes in onboard Linux. These scripts are to be compiled on the target directly. The configuration file(executable) can be created as follows:

> gcc eeprom_config.c -o name_of_the_executable_file

  • Run the executable by,
> cd path/to/executable
> ./name_of_the_executable_file

Clock Distribution Network.

This section is divided into 2 sub-sections.

  1. Clock synthesizers
  2. Frequency check firmware

Clock Synthesizers

Configuration of Si5344

The SI devices have a proprietary software called ClockBuilder Pro which can generate the register values for any necessary and possible output frequency. This file can be generated as a header file for a C code which can write the register values using i2c-tools commands. The SI5338 had a readymade sample project which was used by us to configure the IC directly. On the basis of this project, SI5344 was actually configured from scratch. The steps mentioned below are given for reference. However, for configuring the synthesizers, directly jump to the 'Test Scripts ' section.

ClockBuilder-Pro Application Flow

Version 3.3 was used while building this project. The basic logic must be the same in all further or previous versions

  1. Create a New project
  2. Choose Jitter Attenuators(SI5344)
  3. Set any 8 character or less Device ID (NULL PADDED)
  4. Device Revision D
  5. Vdd core 1.8V of host device. This is found from the schematics for this device.(Set address as 11010XX==0x68)
  6. External Source Type Xtal= 48 Mhz (schematics)
  7. Enable Free run only mode (suggested in reference project)
  8. All outputs should be enabled (suggested in reference project)
    1. Stop Low
    2. LVDS 3.3V
    3. 250Mhz with Auto Divider
  9. DCO should be set to FINC/FDEC register control
  10. Maximize the number of low jitter outputs in the frequency planner
  11. All other steps are taken care of by the software because of Step 7 choice.
  12. After finishing the project export the project, especially the register file as a C code header file

Test scripts-

  • The config and header file for the example project of Si5338 can be found at ELM_Bring_up_Petalinux/Clk_Synthesizers/SI5338/

  • The config and header file for the Si5344 can be found at ELM_Bring_up_Petalinux/Clk_Synthesizers/SI5344/

  • Considering current changes in onboard Linux. These scripts are to be compiled on the target directly. The configuration file(executable) can be created as follows:

> gcc si5344_config.c -o name_of_the_executable_file

  • Run the executable by,
> cd path/to/executable
> ./name_of_the_executable_file

Frequency Check firmware

The frequency check firmware includes an RTL block() which contains a frequency meter. This design checks the GTH clock frequencies connected to GTH (currently only 2). The output of this frequency block is connected to the custom AXI-SLAVE register. The shell script located here is used to check the frequency output. To perform the frequency tests, first, copy the script onto the board and then do -

sh clkFreqCheck.sh

This checks frequency output stored at respective clock status registers. In the case of REV2 of the test board, just update the clock mappings in the clkTestTop.v firmware.

Custom Axi-Slave

The purpose of implementing this module is to be able to store the output of the frequency meter into memory-mapped registers and then read the contents of those using some Linux userspace application. Current firmware includes in total 64 registers, Out of 64, 32 of them are used as status registers and 32 of them are used as control registers. The control registers can have read and write access from Linux userspace and can control any firmware implemented on the PL side of the ZYNQ. The status registers on the other hand can be only read from PS, but get written by firmware in PL. This arrangement is made for REV2 of the test board for ELM where there will be provision to test 12 clocks. The base address for this register is 0x80020000 and the status registers start from 0x80020080. Users can verify this by opening the address editor tab in the Vivado design suite.

Xilinx Virtual Cable (XVC)

  • First, the User needs to start the XVC server onto the board. This can be done by doing-
> cd path/to/xvc/execuatble
> ./xvcserver

Note- Currently, the XVC source code and working executable is stored at /root/xvc_mem directory onboard running Linux.

  • Connect from Vivado to 192.168.100.2 port 2542:-
    • Open New--> Open New Target.. --> Next --> Connect to : Local server (target is on local machine) --> Add Xilinx Virtual Cable (XVC)
      • Host Name:- 192.168.100.2
      • Port:- 2542

old settings backup

This section includes old settings and approaches explored earlier. Keeping them as a backup.

EEPROM related-

Vivado Project

  • Creating a project in Vivado by sourcing given .tcl file and enabling i2c0 with MIO 10-11

  • Then running synthesis, implementation and generating bitstream as EEPROM is directly connected to PS through MIO. Then exporting the hardware.

The hardware TCL file of the Vivado Project can be found at-> ELM_Bring_up_Petalinux/I2C/TCL

Petalinux Project

  • Then creating Petalinux project following the steps given below:

Kernel Configuration

In step where command petalinux-config -c kernel is executed; we have to make following kernel configurations to get inbuilt i2c petalinux driver-

  • Kernel Configuration->Device Drivers->I2C Support->I2C Hardware Support-> Cadence I2c Controller

Rootfs Configuration

  • Can include custom made applications
  • The path to include gcc compiler, i2ctools and custom applications goes like:
    • Filesystem Packages->misc->gcc-runtime->Enable ALL
    • Filesystem Packages->misc->packagegroup-core-buildessential->Enable ALL
    • base->i2ctools->Enable ALL

Device Tree Settings

As a requirement for this driver you need to add the device to the device tree as shown below:

  • The structure of device tree is influenced by the generated device tree by Vivado itself. This is present in directory

/plnx-proj/components/plnx_workspace/device-tree/device-tree

i2c0: i2c@ff020000 {
compatible = "cdns,i2c-r1p14", "cdns,i2c-r1p10";
status = "disabled";
interrupt-parent = <&gic>;
interrupts = <0 17 4>;
reg = <0x0 0xff020000 0x0 0x1000>;
#address-cells = <1>;
#size-cells = <0>;
power-domains = <&zynqmp_firmware 37>;
};
  • Editing this DT for our use and placing in user-made DT directory:

/plnx-proj/project-spec/meta-user/recipes-bsp/device-tree/files

  • The new Device Tree(including both the MAC and Utility EEPROM) is:
/include/ "system-conf.dtsi"
/ {

i2c0 {

status = "okay";
clock-frequency = <400000>;
bus-id = <0>;
clocks = <&zynqmp_clk 61>;
compatible = "cdns,i2c-r1p14", "cdns,i2c-r1p10";
interrupt-parent = <&gic>;
interrupts = <0 17 4>;
reg = <0x0 0xff020000 0x0 0x1000>;
xlnx,has-interrupt = <0x0>;

eeprom@50 {

compatible = "microchip,24aa02e48";
reg = <0x50>;
};

eeprom@51{
                compatible = "at24,24a256";
                reg = <0x51>;
        };
};
};
  • Build the Petalinux Project

EEPROM Tests

Shell Scripts

Both the EEPROMS were attempted to test through this Driver after making some necessary changes to accommodate our design.

But we first need to Instantiate the Device before executing the code by (for the utility and MAC EEPROM respectively)-

> echo eeprom 0x50 > /sys/bus/i2c/devices/i2c-0/new_device

> echo eeprom 0x51 > /sys/bus/i2c/devices/i2c-0/new_device The final shell script can be found at -> ELM_Bring_up_Petalinux/I2C/Shell_Scripts/

The script can be executed using

> cd path/to/script
> ./i2c_eeprom_helper.sh i2c 0 16

where the arguments are-

  • i2c The EEPROM to test in the /sys filesystem, a full path.
  • 0 is the offset from the start of the EEPROM, this allows multiple tests to be run at the same time on the same EEPROM.
  • 16 is the number of bytes to read/write at the offset from the start of the EEPROM.
⚠️ **GitHub.com Fallback** ⚠️