Author Topic: Sata communication  (Read 1032 times)

IhebHnaien

  • Active Member
  • *
  • Posts: 19
Sata communication
« on: February 28, 2020, 04:00:50 PM »
Hi,

I'm working now on a xilinx project. I'm still a beginner and this is my first experience with Ultrascale+ MP.
I am working with TE0808 and I want to develop a Linux application on the Ultrascale MP to send data over the Sata interface. I installed Vivado 2017.4 and Petalinux 2017.4. First I started with designing a vivado project with ZynqUltraScale+ MP. Then I activated a Sata port (SATA Lane 1) and generated the hdf file of this design. Using this hdf file, I created a Petalinux project in oder to get a Linux kernel with enabled Sata support. I followed the hints given on the website of the xilinx wiki : https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842339/SATA . Since I am using a hdf file I configured only the Kernel via Menuconfig but I didn't modify the Device tree (It should be automatically generated in system-conf.dts file). After building the Petalinux project, I used the folder: PetalinuxProject/build/tmp/sysroots/plnx_aarch64-tcbootstrap as a rootfs for a new linux xsdk applicaion.

Here I got a little problem. I am not getting any sata support in the included libraries (Sata should be supported with the libata library but I can't find it in the included libraries).

How can I correctly configure the Petalinux kernel in order to get the required software support for the Sata communication on the xsdk interface ?

Thanks in advance  :)

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1413
Re: Sata communication
« Reply #1 on: March 02, 2020, 07:37:33 AM »
Hi,
at first, please use newer Vivado/Petalinux version. Xilinx has changed a lot of things (new features and a lot of bug fixes) a specially for ZynqMP devices.

We also provide reference designs, with basic setup (in case you use our TEBF0808 carrier) and petalinux template:
https://wiki.trenz-electronic.de/display/PD/TE0808+StarterKit
--> Sata works on these example design. We did not changed anything for SATA in linux.
--> try out prebuilt Boot.bin and image.ub at first, so you can test directly (Sata disk should be formate as ext4)
br
John

IhebHnaien

  • Active Member
  • *
  • Posts: 19
Re: Sata communication
« Reply #2 on: March 20, 2020, 12:33:16 PM »
Hi
Now I'm using Vivado/Petalinux 2019.2 .I created a Vivado project and generated the xsa file. Then I used this xsa file to create a linux kernel witth petalinux. In the linux kernel I activated the Sata interface and I generated all the files and directories required for Vitis. After that I launched Vitis from Vivado and created a linux platform based on my Petalinux project and my xsa file. But the problem is that my Platform is always out-of-date. I tried to rebuild my platform but it's always the same although the "problem window" of vitis doesn't show any errors and it says that the build was succesfully done.

BR
Iheb

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1413
Re: Sata communication
« Reply #3 on: March 20, 2020, 07:56:33 PM »
Hi,
 did you use Win OS or Linux for Vitis?
I didn't see the behavior which you wrote until now (We use WinOS).
Did you create platform project with our without fsbl and pmu?
I've done some short description for basic Vitis usage:
https://wiki.trenz-electronic.de/display/PD/Vitis#Vitis-CreatePlatformprojectforXSA
https://wiki.trenz-electronic.de/display/PD/Vitis#Vitis-BuildPlatformProject

PS: on our 808 series it was not need to change kernel for SATA (everything for sata was done with xsa import). Our manuel changes was:
https://wiki.trenz-electronic.de/display/PD/TE0808+StarterKit#TE0808StarterKit-SoftwareDesign-PetaLinux
what did you change?
br
John

IhebHnaien

  • Active Member
  • *
  • Posts: 19
Re: Sata communication
« Reply #4 on: March 24, 2020, 11:17:51 AM »
Hi,

I'm using vitis on WinOS too. I created the petalinux project on a virtual machine then I copied the Linux Folder on the shared Folder. In order to activate The Sata interface I've done the Kernel configurations as it was defined here:  https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842339/SATA  But I didn't modify the device tree file.

Then I created a linux platform with my xsa file and without fsbl and pmu (I have chosen : generate boot components).
In the Linux domain I defined the following 4 files:
BIF File: containing the files: system.bit, bl31.elf,u-boot.elf
Boot Components Directory: The Linux folder copied form The petalinux project
Linux Image directory: the same linux folder
Sysroot Directory : the Folder \linux\sysroots\aarch64-xilinx-linux

Then I tried to build the Platform. The Vitis Console and Vitis log didn't show any errors but I'm getting always an out_of_date platform.

BR
Iheb

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1413
Re: Sata communication
« Reply #5 on: March 24, 2020, 11:35:35 AM »
Hi,
bif need also fsbl and pmu in your boot.bin  Check the bif file of our reference design
For barmetal mostly fsbl pmu bitfiles(optional) and application(elf) are necessary
For linux  fsbl pmu bitfiles(optional), ATF(bl31) and u-boot(elf)  are necessary

Quote
  https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842339/SATA
we must not change any kernel setup manually for sata on our reference designs.

Use Vitis only to generate FSBL, PMU and Boot.bin on WinOS
Instead of system directory use directly generated image.ub from petalinux.
br
John

br
John

IhebHnaien

  • Active Member
  • *
  • Posts: 19
Re: Sata communication
« Reply #6 on: March 24, 2020, 11:47:43 AM »
I already tried to use a bif file which is containing the pmu and fsbl files too. I generated this bif file with the Petalinux-package instruction. But I got the same problem.

I will try now to generate a new petalinux project without changing any kernel setups. And I hope that it solves the problem.

BR
Iheb

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1413
Re: Sata communication
« Reply #7 on: March 24, 2020, 12:24:57 PM »
Hi,
PS configuration on the Vivado design (the resulting XSA), FSBL, PMU, ATF, uboot, linux ...all work thogether.
Where did you get your SATA reference CLK? Did you use PLL form the module or external ref from a carrier? In this case you use module FSBL, you must also initilise PLL, see FSBL code of our starterkit reference design.

br
John

IhebHnaien

  • Active Member
  • *
  • Posts: 19
Re: Sata communication
« Reply #8 on: March 24, 2020, 12:44:46 PM »
Hi,

We used PLL from the Module.

BR
Iheb

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1413
Re: Sata communication
« Reply #9 on: March 24, 2020, 12:46:20 PM »
you has initilised PLL correctly?
br
John

IhebHnaien

  • Active Member
  • *
  • Posts: 19
Re: Sata communication
« Reply #10 on: March 24, 2020, 01:24:08 PM »
Here are some screenshots showing the initializations that we have made.

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1413
Re: Sata communication
« Reply #11 on: March 24, 2020, 04:09:36 PM »
Your Screenshot is only REF CLK selection and expected CLK.

SI5345 will be initialisation is done with FSBL.

Please check our reference design:
https://wiki.trenz-electronic.de/display/PD/TE0808+StarterKit
https://wiki.trenz-electronic.de/display/PD/TE0808+StarterKit#TE0808StarterKit-Application

br
John

IhebHnaien

  • Active Member
  • *
  • Posts: 19
Re: Sata communication
« Reply #12 on: March 26, 2020, 04:19:17 PM »
Hi,

I still have the same problem.
1/ Petalinux Project
I created first a petalinux project on the Virtual machine. And I created a BIF File (you can find below its content). Then I copied the linux folder and the bif file from the virtual machine through the shared folder.

2/ Vitis
Then I created a platform on Vitis:
       1- I used my xsa file and I have selected Linux as my os
       2- I left the "generate boot components" selected
       3- I added the Paths of the bif file, Linux Directory, boot components directory and the sysroot directory
       4- I copied the FSBL Files of the reference design as described on your website.
       5- Then I builded the Platform but it's still out of date

PS: I tried to not use the auto-generated boot components and instead of it I used the zynqmp_fsbl.elf File for the the FSBL and the pmufw.elf File  for the PMU (both are created by petalinux). And unfortunately I still have the same problem.

BIF File:
the_ROM_image:
{
   [bootloader, destination_cpu=a53-0] /home/iheb/Desktop/patalinux_sata/images/linux/zynqmp_fsbl.elf
   [pmufw_image] /home/iheb/Desktop/patalinux_sata/images/linux/pmufw.elf
   [destination_device=pl] /home/iheb/Desktop/patalinux_sata/images/linux/system.bit
   [destination_cpu=a53-0, exception_level=el-3, trustzone] /home/iheb/Desktop/patalinux_sata/images/linux/bl31.elf
   [destination_cpu=a53-0, exception_level=el-2] /home/iheb/Desktop/patalinux_sata/images/linux/u-boot.elf
}

BR
Iheb

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1413
Re: Sata communication
« Reply #13 on: March 30, 2020, 09:20:37 AM »
Hi Iheb,
which Reference CLK did you select on your PS IP? --> you has select valid REFCLK and this REF CLK is also available?
PS: In case you use SI5345 output from the module, you must initilise SI. Use or FSBL modifications or write NVM with valid configuration.

Do you use our TEBF0808 carrier? If yes, did you try out our reference design (prebuilt Boot.bin and image.ub are also included)? Sata is enabled on these reference design.
br
John

IhebHnaien

  • Active Member
  • *
  • Posts: 19
Re: Sata communication
« Reply #14 on: March 30, 2020, 01:23:54 PM »
Hi John,

The reference clock can be seen in the two screenshots. According to the circuit diagram of the TEBF0808 (YES we use this carrier), THIS Ref Clock 1 which we use for SATA is not even connected to the PLL (SI5345) but directly to a 150MHz oscillator. Therefore, the FSBL has no effect since the Ref Clock 1 is not configurable but constant. Nevertheless, we are using your FSBL now, and it initializes all PLL clocks from the SI5345 as you did in the reference design.

I can't try out your prebuilt reference design because I am doing only homeoffice now and I don't have the hardware at home.

To sum up, my colleague prepared the vivado project and the xsa File. My task is to write a linux application which receives data from the PL part and sends it over the Sata interface. So I have to use Vitis to prepare this application.

I would be glad to use your prebuilt design. This will save me a lot of time and effort. You said the sata interface is already enabled on your reference design. But I can't use it as it is. I have first to use Vitis to write a code which receives data from PL and sends it automatically through the SATA interface.

I would be grateful if I could get the four directories to create a Linux Platform based on your Reference design (I didn't find them in your uplaoded starter Kit) so that I can create a Platfrom on vitis and develop an application which sends the data over the SATA interface:
                                -BIF File: containing the files: bitstreeam.bit, bl31.elf,u-boot.elf
                                -Boot Components Directory: The Linux folder copied form The petalinux project
                                -Linux Image directory: the same linux folder
                                -Sysroot Directory : the Folder \linux\sysroots\aarch64-xilinx-linux

BR
Iheb

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1413
Re: Sata communication
« Reply #15 on: March 30, 2020, 01:31:10 PM »
All included, expected  Sysroot directory, I used only image.ub

You can also export vitis platform from the reference design with our scripts.
Download the version with prebuilts, generate the vivado design for your assembly variant with my scripts and start vitis with our scripts, see:
https://wiki.trenz-electronic.de/display/PD/TE0808+StarterKit#TE0808StarterKit-DesignFlow
--> I will add some notes to to this manually in the future on this page: https://wiki.trenz-electronic.de/display/PD/Vitis
br
John

IhebHnaien

  • Active Member
  • *
  • Posts: 19
Re: Sata communication
« Reply #16 on: March 30, 2020, 02:10:36 PM »
Hi,
In the step 2 of your design flow, which modules should I select after pressing 0 and starting the Module Selection Guide.

And in step 4,should I start vivado manually and create a project or it should be done with one of your scripts ?

https://wiki.trenz-electronic.de/display/PD/TE0808+StarterKit#TE0808StarterKit-DesignFlow


BR
Iheb

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1413
Re: Sata communication
« Reply #17 on: March 30, 2020, 03:02:18 PM »
Hi,
all with scripts.
run "_create_win_setup.cmd", press zero and follow instructions on the console. It generates the  Vivado reference design with your selected TE0808 variant.
On Vivado you can build the project and generate the Vitis project with additional script functions on the Vivado TCL console.

br
John

IhebHnaien

  • Active Member
  • *
  • Posts: 19
Re: Sata communication
« Reply #18 on: April 02, 2020, 02:50:15 PM »
Hi,
I generated successfully the vitis platform with the reference design. Now I created a hello world application and I want to write a linux application which sends and receives data over the sata interface. In the design flow I noticed that we have included the smartmontools in our kernel. This tool can be used but I can't find any smartmontools functions in the source files and header files provided by the platfrom.
In order to use the Sata interface in a linux application a library called libata should be used. But I didn't get the libata library in the vitis platform.

How can I get the required firmware in order to start using the sata interface in the developpement of the linux application.

BR
Iheb

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1413
Re: Sata communication
« Reply #19 on: April 02, 2020, 03:09:59 PM »
Hi,
use petalinux enviroment to develop linux application or the running system itself.
on the petalinux project, you can change kernel, rootfs setup or add(and compile) own application to the project. See petalinux documentation.
br
John

IhebHnaien

  • Active Member
  • *
  • Posts: 19
Re: Sata communication
« Reply #20 on: April 02, 2020, 03:50:06 PM »
I thought I have to develop the application on the Vitis sdk. shouldn't we just make use of the provided Platform to develop a linux application on vitis ?

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1413
Re: Sata communication
« Reply #21 on: April 02, 2020, 04:12:44 PM »
Hi,

We use vitis only for baremetal applications and to generate final Boot.bin. 
Generate linux application is also possible, but that's a question for Xilinx support. :-)



br
John

IhebHnaien

  • Active Member
  • *
  • Posts: 19
re
« Reply #22 on: May 27, 2020, 12:42:55 PM »
 ,

IhebHnaien

  • Active Member
  • *
  • Posts: 19
Re: Sata communication
« Reply #23 on: May 27, 2020, 02:40:34 PM »
Hi

I have a new issue now with booting my board with sd-card. I tried to create a new post but I couldn't do it so that's why I'm writing here on this old post.

The problem is that I'm getting the following error: not syncing: No working init found.  Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance.

I tried to solve this problem and I added init=/init to the bootargs but I got this new error: not syncing: No working requested init /init failed.

I followed the starterkit guide in order to create my petalinux project and configure it and I copied the device tree that you have posted on your website. Then I copied following files in the (FAT) boot partition of my sd card : BOOT.BIN , image.ub , bl31.elf and u-boot.elf. But I got the errors mentioned above.

Actually I tried to copy the same files from your prebuilt starterkit project and the booting was done successfully. So there is no problem in my sd card partitions. The problem is in my petalinux configurations. The init files are not found on my root Partition. Should I do any other petalinux configurations except those which were mentioned on the following guide : https://wiki.trenz-electronic.de/display/PD/TE0808+StarterKit#TE0808StarterKit-SoftwareDesign-PetaLinux

thanks in advance
BR
Iheb

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1413
Re: Sata communication
« Reply #24 on: May 27, 2020, 03:24:26 PM »
Hi,
you must put FSBL, PMU Firmware(pmu.elf), ATF(BL31.elf), Bitstream and Uboot.elf into the Boot.bin
See *.bif file from the reference design or Xilinx documentation.
br
John

IhebHnaien

  • Active Member
  • *
  • Posts: 19
Re: Sata communication
« Reply #25 on: May 28, 2020, 08:11:46 PM »
I tried with a boot.bin file which is including the following files:zynqmp_fsbl.elf ,pmufw.elf, loopback_0_wrapper.bit, bl31.elf, u-boot.elf. In the beginning it was booting perfectly but  then I tried to add remote processor firmware images to my petalinux project via:
petalinux-config -c rootfs--->
Filesystem Packages --->
misc --->
openamp-fw-echo-testd --->
  • openamp-fw-echo-testd


Then I rebuilt my petalinux project and included the 4 files mentioned above in my boot.bin. I copied boot.bin ,image.ub , u-boot.elf nd bl31.elf in the boot partition of my sd card. Then when booting I got again the following error: end Kernel panic - not syncing: No working init found. Try passing init= option to kernel.

I would be grateful if you could help me to find an explanation for this error.
BR
iheb

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1413
Re: Sata communication
« Reply #26 on: June 02, 2020, 07:27:08 AM »
Hi,
 openAMP is for asymmetric multi processor usage.  You must pay much more attention on memory usage.
But I havn't any experience with openAMP. Please check Xilinx documentation:
https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18841718/OpenAMP
https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/150568961/OpenAMP+2019.2

br
John

IhebHnaien

  • Active Member
  • *
  • Posts: 19
Re: Sata communication
« Reply #27 on: June 02, 2020, 04:46:03 PM »
The problem Is solved. now I followed your starterkit guide and I created a new project again. I connected a Sata drive to the board but unfortunately I can't find the SATA drive under the following path : dev/sda

running dmesg|grep -i ata showed the following message:

[    0.000000] Memory: 3729512K/4193024K available (10748K kernel code, 630K rwdata, 5396K rodata, 832K init, 314K bss, 201368K reserved, 262144K cma-reserve
[    0.324138] vdso: 2 pages (1 code @ (____ptrval____), 1 data @ (____ptrval____))
[    1.464875] libata version 3.00 loaded.
[    6.572758] ata1: SATA max UDMA/133 mmio [mem 0xfd0c0000-0xfd0c1fff] port 0x100 irq 39
[    6.580672] ata2: SATA max UDMA/133 mmio [mem 0xfd0c0000-0xfd0c1fff] port 0x180 irq 39
[    6.767286] dwc3-of-simple ff9d0000.usb0: dwc3_simple_set_phydata: Can't find usb3-phy
[    6.781446] xilinx-psgtr fd400000.zynqmp_phy: xpsgtr_config_usbpipe: No valid Platform_data found
[    6.903001] ata2: SATA link down (SStatus 0 SControl 330)
[    6.909040] ata1: SATA link down (SStatus 0 SControl 330)
[    7.167540] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    8.244103] EXT4-fs (mmcblk1p2): mounted filesystem with ordered data mode. Opts: (null)
[    8.247561] FAT-fs (mmcblk1p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.

I have tried even with your prebuilt starterkit project and I got the same problem.

do we need any other configurations to detect the sata drive ?

BR
Iheb
« Last Edit: June 02, 2020, 05:00:16 PM by IhebHnaien »

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1413
Re: Sata communication
« Reply #28 on: June 02, 2020, 05:06:15 PM »
Hi,
Quote
[    6.903001] ata2: SATA link down (SStatus 0 SControl 330)
[    6.909040] ata1: SATA link down (SStatus 0 SControl 330)
your sata link is down.

Quote
I have tried even with your prebuilt starterkit project and I got the same problem.
which reference design did you use? Can you send me the zip file name.
Did you use Boot.bin and image.ub from the reference design or only some part of the prebuilts?

br
John

IhebHnaien

  • Active Member
  • *
  • Posts: 19
Re: Sata communication
« Reply #29 on: June 02, 2020, 05:17:57 PM »
I downlowded this zip file :https://www.trenz-electronic.de/fileadmin/docs/Trenz_Electronic/Modules_and_Module_Carriers/5.2x7.6/TE0808/Reference_Design/2019.2/StarterKit/TE0808-StarterKit-vivado_2019.2-build_8_20200325083436.zip

 
Did you use Boot.bin and image.ub from the reference design or only some part of the prebuilts?
I tested with your image.ub and boot.bin (the 15eg_1e_4gb) .

BR
Iheb

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1413
Re: Sata communication
« Reply #30 on: June 03, 2020, 08:17:51 AM »
Hi,
can you send me the whole boot log when you use Boot.bin and image.ub from our newest reference design.

Can you also check that SATA disc is connected and powered (maybe cable is not plugged completely or so) correctly.

I've tried out the starterkit reference design and sata works fine.

Can you also type " dmesg | grep SATA" in the linux console. I my case I see:
Code: [Select]
[    5.237351] ata1: SATA max UDMA/133 mmio [mem 0xfd0c0000-0xfd0c1fff] port 0x100 irq 44
[    5.245268] ata2: SATA max UDMA/133 mmio [mem 0xfd0c0000-0xfd0c1fff] port 0x180 irq 44
[    5.567466] ata2: SATA link down (SStatus 0 SControl 330)
[    5.733288] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 330)
My disk is formatted as ext4 and this partion is also mounted (ls /run/media/ ...).

br
John

IhebHnaien

  • Active Member
  • *
  • Posts: 19
Re: Sata communication
« Reply #31 on: June 03, 2020, 10:25:15 AM »
thank you. The problem was with the power supply cable.
Now dmesg shows that the sata link is up


[    8.761878] ata1: SATA max UDMA/133 mmio [mem 0xfd0c0000-0xfd0c1fff] port 0x100 irq 44
[    8.769795] ata2: SATA max UDMA/133 mmio [mem 0xfd0c0000-0xfd0c1fff] port 0x180 irq 44
[    9.096771] ata2: SATA link down (SStatus 0 SControl 330)
[    9.253518] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 330)

But I still can't find the drive under the following path: dev/sda or run/media...
My disk is still not formatted as ext4. I wanted to use our linux kernel to format it. but I can't find the mount point of the sata drive.

BR
Iheb

JH

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1413
Re: Sata communication
« Reply #32 on: June 03, 2020, 11:06:44 AM »
Hi,
it will be only mounted in case the disk is formated (ext4 is default available)


if the name is sda or sdb or sdc... depends on what you has connected on your board (for example usb stick or so.)

for ext4 I didn't add additional drivers. --> But you can check kernel setup for other formats


try

fdisk -l

or

 ls -ltr /dev/sd*

do you see your disk?

to formate your disk, google for "linux fdisk create partition"

br
John