Building Linux with IIO using Petalinux 2019.1 for the USRP E310 (sg3)

Hi -

For the past few months, I have been trying many different methods to successfully build a functional Linux kernel with IIO and all the relevant boot files for the Ettus USRP E310.

I started out building them manually following Xilinx/ADI tutorials for the zc702 eval board and adapting them to the E310 but I could not successfully build the boot files or rootfs.

By doing this I learned how to correctly partition the 8GB SD card supplied with the E310. 

I then stumbled upon this post: https://ez.analog.com/linux-device-drivers/linux-software-drivers/f/q-a/104393/usrp-e31x-with-linux---2018_r2 

and attempted to boot the E310_IIO_2018_R2 files supplied by mhennerich but the boot fails due to "device descriptor read/64, error -32'   that I cannot troubleshoot as I did not create the files. 

I retrieved and edited the uEnv.txt to suit my needs from the files supplied by ADI on the purchase of another board I have accesible.

I then attempted to follow the instructions available here: https://github.com/analogdevicesinc/meta-adi/tree/master/meta-adi-xilinx

These instructions introduced me to Petalinux. However, the supported configs are not compatible with the E310, and despite trying many things I moved away from this github repository as 

nothing was working. 

I have more recently been trying to build a generic Linux Kernel using https://github.com/analogdevicesinc/linux and include LIBIIO through Petalinux.

How do I build a working ETTUS USRP E310 IIO Linux Kernel with the required boot files (and possibly rootfs) using Petalinux 2019.1?

I have the hdf file required by the     
petalinux-config --get-hw-description=    command in Petalinux 2019.1. 

Thank you,

-Dominic



  • 0
    •  Analog Employees 
    on Feb 25, 2020 12:29 PM

    Hi Dominic,

    Are you planning to use our kernel? Note that this project is not supported in our meta-adi which is the one to use on petalinux (when building ADI reference designs). So, at this point you need to bring support for this on your own. I can give you some pointer though. After enabling our layer (check the Github layer), you need to change the kernel recipe to use Usrp e310 defconfig file. After this, you need to provide the devicetree to use. For this device, I guess this should be the one... To add a new dts on our recipe try to look at this example...

    Also, did you looked here?? It seems to be something to look at...

    Hope this helps,

    -Nuno Sá

  • Hi Nuno,

    Thank you for the reply.


    I was planning on using the ADI kernel. 
    I have been correctly telling petalinux to use the E310 defconfig file but I hadn't tried the example you showed me, I will try that and get back to you.


    In my question, I mentioned using files supplied by mhennerich (
    E310_IIO_2018_R2.ZIP), when I put these on the E310 SD card I get them to work correctly until the end where it cannot start IIOD.  I had to procure an uEnv.txt from elsewhere and somehow it worked. I believe this to be due to "device descriptor read/64, error -32' that occurs shortly before the end when enumerating a usb port. For the purpose of my work, it would be beneficial to me to get these files working so that I can run IIO on the E310 as soon as possible.
    Is there anything you can do to help with that ? 

    Thanks again.

    -Dominic


    Here is the screen output when I use the files supplied by mhennerich:

    U-Boot 2016.07-03729-g45e5971-dirty (Dec 07 2016 - 10:25:56 +0100)

     

    Model: Zynq E310 Board

    Board: Xilinx Zynq

    I2C:   ready

    DRAM:  ECC disabled 1 GiB

    MMC:   sdhci@e0100000: 0

    Invalid bus 0 (err=-19)

    *** Warning - spi_flash_probe() failed, using default environment

     

    In:    serial@e0000000

    Out:   serial@e0000000

    Err:   serial@e0000000

    Model: Zynq E310 Board

    Board: Xilinx Zynq

    Net:   ZYNQ GEM: e000b000, phyaddr 7, interface rgmii-id

    eth0: ethernet@e000b000

    reading uEnv.txt

    376 bytes read in 9 ms (40 KiB/s)

    Importing environment from SD ...

    Hit any key to stop autoboot:  0

    Device: sdhci@e0100000

    Manufacturer ID: 27

    OEM: 5048

    Name: APUSD

    Tran Speed: 50000000

    Rd Block Len: 512

    SD version 3.0

    High Capacity: Yes

    Capacity: 7.4 GiB

    Bus Width: 4-bit

    Erase Group Size: 512 Bytes

    reading uEnv.txt

    376 bytes read in 8 ms (45.9 KiB/s)

    Loaded environment from uEnv.txt

    Importing environment from SD ...

    Running uenvcmd ...

    Copying Linux from SD to RAM...

    reading uImage

    4222256 bytes read in 410 ms (9.8 MiB/s)

    reading devicetree.dtb

    22782 bytes read in 18 ms (1.2 MiB/s)

    reading uramdisk.image.gz

    ** Unable to read file uramdisk.image.gz **

    ## Booting kernel from Legacy Image at 03000000 ...

       Image Name:   Linux-4.14.0-11500-gad03b79d

       Image Type:   ARM Linux Kernel Image (uncompressed)

       Data Size:    4222192 Bytes = 4 MiB

       Load Address: 00008000

       Entry Point:  00008000

       Verifying Checksum ... OK

    ## Flattened Device Tree blob at 02a00000

       Booting using the fdt blob at 0x2a00000

       Loading Kernel Image ... OK

       Loading Device Tree to 1fff7000, end 1ffff8fd ... OK

     

    Starting kernel ...

     

    Booting Linux on physical CPU 0x0

    Linux version 4.14.0-11500-gad03b79d (michael@mhenneri-D06) (gcc version 4.9.2 (Sourcery CodeBench Lite 2015.05-17)) #501 SMP PREEMPT Thu Nov 29 10:27:35 CET 2018

    CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d

    CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache

    OF: fdt: Machine model: Ettus Research E310 IIO (Z7020/AD9361)

    earlycon: cdns0 at MMIO 0xe0000000 (options '115200n8')

    bootconsole [cdns0] enabled

    Memory policy: Data cache writealloc

    cma: Reserved 128 MiB at 0x38000000

    random: fast init done

    percpu: Embedded 16 pages/cpu @ef7c8000 s33088 r8192 d24256 u65536

    Built 1 zonelists, mobility grouping on.  Total pages: 260608

    Kernel command line: earlycon console=ttyPS0,115200 root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait

    PID hash table entries: 4096 (order: 2, 16384 bytes)

    Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)

    Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)

    Memory: 897068K/1048576K available (6144K kernel code, 284K rwdata, 2192K rodata, 1024K init, 159K bss, 20436K reserved, 131072K cma-reserved, 131072K highmem)

    Virtual kernel memory layout:

        vector  : 0xffff0000 - 0xffff1000   (   4 kB)

        fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)

        vmalloc : 0xf0800000 - 0xff800000   ( 240 MB)

        lowmem  : 0xc0000000 - 0xf0000000   ( 768 MB)

        pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)

        modules : 0xbf000000 - 0xbfe00000   (  14 MB)

          .text : 0xc0008000 - 0xc0700000   (7136 kB)

          .init : 0xc0a00000 - 0xc0b00000   (1024 kB)

          .data : 0xc0b00000 - 0xc0b47100   ( 285 kB)

           .bss : 0xc0b4c470 - 0xc0b74094   ( 160 kB)

    Preemptible hierarchical RCU implementation.

    RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.

    Tasks RCU enabled.

    RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2

    NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16

    efuse mapped to f0802000

    slcr mapped to f0804000

    L2C: platform modifies aux control register: 0x72360000 -> 0x72760000

    L2C: DT/platform modifies aux control register: 0x72360000 -> 0x72760000

    L2C-310 erratum 769419 enabled

    L2C-310 enabling early BRESP for Cortex-A9

    L2C-310 full line of zeros enabled for Cortex-A9

    L2C-310 ID prefetch enabled, offset 1 lines

    L2C-310 dynamic clock gating enabled, standby mode enabled

    L2C-310 cache controller enabled, 8 ways, 512 kB

    L2C-310: CACHE_ID 0x410000c8, AUX_CTRL 0x76760001

    zynq_clock_init: clkc starts at f0804100

    Zynq clock init

    sched_clock: 64 bits at 333MHz, resolution 3ns, wraps every 4398046511103ns

    clocksource: arm_global_timer: mask: 0xffffffffffffffff max_cycles: 0x4ce07af025, max_idle_ns: 440795209040 ns

    Switching to timer-based delay loop, resolution 3ns

    clocksource: ttc_clocksource: mask: 0xffff max_cycles: 0xffff, max_idle_ns: 537538477 ns

    timer #0 at f080c000, irq=17

    Console: colour dummy device 80x30

    Calibrating delay loop (skipped), value calculated using timer frequency.. 666.66 BogoMIPS (lpj=3333333)

    pid_max: default: 32768 minimum: 301

    Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)

    Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)

    CPU: Testing write buffer coherency: ok

    CPU0: thread -1, cpu 0, socket 0, mpidr 80000000

    Setting up static identity map for 0x100000 - 0x100060

    Hierarchical SRCU implementation.

    smp: Bringing up secondary CPUs ...

    CPU1: thread -1, cpu 1, socket 0, mpidr 80000001

    smp: Brought up 1 node, 2 CPUs

    SMP: Total of 2 processors activated (1333.33 BogoMIPS).

    CPU: All CPU(s) started in SVC mode.

    devtmpfs: initialized

    VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4

    clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns

    futex hash table entries: 512 (order: 3, 32768 bytes)

    pinctrl core: initialized pinctrl subsystem

    NET: Registered protocol family 16

    DMA: preallocated 256 KiB pool for atomic coherent allocations

    cpuidle: using governor ladder

    hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.

    hw-breakpoint: maximum watchpoint size is 4 bytes.

    zynq-ocm f800c000.ocmc: ZYNQ OCM pool: 256 KiB @ 0xf0880000

    zynq-pinctrl 700.pinctrl: zynq pinctrl initialized

    e0000000.serial: ttyPS0 at MMIO 0xe0000000 (irq = 26, base_baud = 6249999) is a `��k׋��+W/�*LW�Y�X��ed

    console [ttyPS0] enabled

    bootconsole [cdns0] disabled

    bootconsole [cdns0] disabled

    e0001000.serial: ttyPS1 at MMIO 0xe0001000 (irq = 27, base_baud = 6249999) is a xuartps

    GPIO line 1015 (txrx1_tx_led) hogged as output/high

    GPIO line 1013 (txrx2_tx_led) hogged as output/high

    GPIO line 1011 (rx1_rx_led) hogged as output/high

    GPIO line 1010 (rx2_rx_led) hogged as output/high

    SCSI subsystem initialized

    usbcore: registered new interface driver usbfs

    usbcore: registered new interface driver hub

    usbcore: registered new device driver usb

    media: Linux media interface: v0.10

    Linux video capture interface: v2.00

    pps_core: LinuxPPS API ver. 1 registered

    pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>

    PTP clock support registered

    Advanced Linux Sound Architecture Driver Initialized.

    clocksource: Switched to clocksource arm_global_timer

    NET: Registered protocol family 2

    TCP established hash table entries: 8192 (order: 3, 32768 bytes)

    TCP bind hash table entries: 8192 (order: 4, 65536 bytes)

    TCP: Hash tables configured (established 8192 bind 8192)

    UDP hash table entries: 512 (order: 2, 16384 bytes)

    UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)

    NET: Registered protocol family 1

    hw perfevents: no interrupt-affinity property for /pmu@f8891000, guessing.

    hw perfevents: enabled with armv7_cortex_a9 PMU driver, 7 counters available

    workingset: timestamp_bits=30 max_order=18 bucket_order=0

    bounce: pool size: 64 pages

    io scheduler noop registered

    io scheduler deadline registered

    io scheduler cfq registered (default)

    io scheduler mq-deadline registered

    io scheduler kyber registered

    dma-pl330 f8003000.dmac: Loaded driver for PL330 DMAC-241330

    dma-pl330 f8003000.dmac: DBUFF-128x8bytes Num_Chans-8 Num_Peri-4 Num_Events-16

    brd: module loaded

    loop: module loaded

    MACsec IEEE 802.1AE

    libphy: Fixed MDIO Bus: probed

    tun: Universal TUN/TAP device driver, 1.6

    libphy: MACB_mii_bus: probed

    macb e000b000.ethernet eth0: Cadence GEM rev 0x00020118 at 0xe000b000 irq 30 (00:0a:35:00:01:22)

    Marvell 88E1510 e000b000.ethernet-ffffffff:00: attached PHY driver [Marvell 88E1510] (mii_bus:phy_addr=e000b000.ethernet-ffffffff:00, irq=POLL)

    ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver

    usbcore: registered new interface driver usb-storage

    usbcore: registered new interface driver usbserial

    usbcore: registered new interface driver usbserial_generic

    usbserial: USB Serial support registered for generic

    usbcore: registered new interface driver ftdi_sio

    usbserial: USB Serial support registered for FTDI USB Serial Device

    chipidea-usb2 e0002000.usb: e0002000.usb supply vbus not found, using dummy regulator

    ULPI transceiver vendor/product ID 0x0424/0x0009

    Found SMSC USB334x ULPI transceiver.

    ULPI integrity check: passed.

    ci_hdrc ci_hdrc.0: EHCI Host Controller

    ci_hdrc ci_hdrc.0: new USB bus registered, assigned bus number 1

    ci_hdrc ci_hdrc.0: USB 2.0 started, EHCI 1.00

    hub 1-0:1.0: USB hub found

    hub 1-0:1.0: 1 port detected

    i2c /dev entries driver

    rtc-ds1307 0-0068: registered as rtc0

    cdns-i2c e0004000.i2c: 400 kHz mmio e0004000 irq 23

    IR NEC protocol handler initialized

    IR RC5(x/sz) protocol handler initialized

    IR RC6 protocol handler initialized

    IR JVC protocol handler initialized

    IR Sony protocol handler initialized

    IR SANYO protocol handler initialized

    IR Sharp protocol handler initialized

    IR MCE Keyboard/mouse protocol handler initialized

    IR XMP protocol handler initialized

    usbcore: registered new interface driver uvcvideo

    USB Video Class driver (1.1.1)

    gspca_main: v2.14.0 registered

    cdns-wdt f8005000.watchdog: Xilinx Watchdog Timer at f0967000 with timeout 10s

    Xilinx Zynq CpuIdle Driver started

    sdhci: Secure Digital Host Controller Interface driver

    sdhci: Copyright(c) Pierre Ossman

    sdhci-pltfm: SDHCI platform and OF driver helper

    mmc0: SDHCI controller on e0100000.sdhci [e0100000.sdhci] using ADMA

    ledtrig-cpu: registered to indicate activity on CPUs

    hidraw: raw HID events driver (C) Jiri Kosina

    usbcore: registered new interface driver usbhid

    usbhid: USB HID core driver

    ad9361 spi0.0: ad9361_probe : enter (ad9361)

    mmc0: new high speed SDHC card at address 0007

    mmcblk0: mmc0:0007 APUSD 7.42 GiB

     mmcblk0: p1 p2 p3

    usb 1-1: new high-speed USB device number 2 using ci_hdrc

    ad9361 spi0.0: ad9361_probe : AD936x Rev 2 successfully initialized

    cf_axi_dds 79024000.cf-ad9361-dds-core-lpc: Analog Devices CF_AXI_DDS_DDS MASTER (9.00.b) at 0x79024000 mapped to 0xf0978000, probed DDS AD9361

    NET: Registered protocol family 17

    Registering SWP/SWPB emulation handler

    hub 1-1:1.0: USB hub found

    hub 1-1:1.0: 3 ports detected

    usb 1-1.3: new full-speed USB device number 3 using ci_hdrc

    usb 1-1.3: device descriptor read/64, error -32

    usb 1-1.3: device descriptor read/64, error -32

    cf_axi_adc 79020000.cf-ad9361-lpc: ADI AIM (10.00.b) at 0x79020000 mapped to 0xf0980000, probed ADC AD9361 as MASTER

    input: gpio-keys as /devices/soc0/gpio-keys/input/input0

    usb 1-1.3: new full-speed USB device number 4 using ci_hdrc

    rtc-ds1307 0-0068: setting system clock to 2000-01-01 03:27:56 UTC (946697276)

    ALSA device list:

      No soundcards found.

    usb 1-1.3: device descriptor read/64, error -32

    usb 1-1.3: device descriptor read/64, error -32

    usb 1-1.3: new full-speed USB device number 5 using ci_hdrc

    usb 1-1.3: device not accepting address 5, error -32

    usb 1-1.3: new full-speed USB device number 6 using ci_hdrc

    usb 1-1.3: device not accepting address 6, error -32

    usb 1-1-port3: unable to enumerate USB device

    EXT4-fs (mmcblk0p2): recovery complete

    EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)

    VFS: Mounted root (ext4 filesystem) on device 179:2.

    devtmpfs: mounted

    Freeing unused kernel memory: 1024K

    Mount failed for selinuxfs on /sys/fs/selinux:  No such file or directory

     * Setting up X socket directories...                                    [ OK ]

     * STARTDISTCC is set to false in /etc/default/distcc

     * /usr/bin/distccd not starting

     * Starting IIO Daemon iiod                                              [ OK ]

     

    Last login: Sat Jan  1 03:25:59 UTC 2000 on ttyPS0

    Welcome to Linaro 14.04 (GNU/Linux 4.14.0-11500-gad03b79d armv7l)

     

     * Documentation:  https://wiki.analog.com/ https://ez.analog.com/

     

     

    Login timed out after 60 seconds.

     

    Last login: Sat Jan  1 03:28:11 UTC 2000 on tty1

    Welcome to Linaro 14.04 (GNU/Linux 4.14.0-11500-gad03b79d armv7l)

     

     * Documentation:  https://wiki.analog.com/ https://ez.analog.com/

  • Hi Nuno,

    Thank you for your reply.

    It seems I was correctly getting it to use the E310 defconfig file but I was incorrectly adding my device tree to the mix. I will try that using the example you gave to me and get back to you.

    In my question, I mentioned using files supplied by mhennerich ( https://ez.analog.com/linux-device-drivers/linux-software-drivers/f/q-a/87727/usrp-e31x-with-linux from this post: https://ez.analog.com/linux-device-drivers/linux-software-drivers/f/q-a/104393/usrp-e31x-with-linux---2018_r2 ), when I put these on the E310 SD card I get them to work correctly until the end where it cannot start IIOD. I believe this to be due to "device descriptor read/64, error -32' that occurs shortly before the end when enumerating a usb port. I had to obtain my own uEnv.txt file to go with the files provided.

    For the purpose of my work, it would be beneficial to me to get these files working so that I can run IIO on the E310 as soon as possible.

    Is there anything you, or mhennerich, can do to help with that ? 

    Thank you,

    Dominic

    Here is a portion of the screen output when I run the files:

    usbcore: registered new interface driver usbhid

    usbhid: USB HID core driver

    ad9361 spi0.0: ad9361_probe : enter (ad9361)

    mmc0: new high speed SDHC card at address 0007

    mmcblk0: mmc0:0007 APUSD 7.42 GiB

     mmcblk0: p1 p2 p3

    usb 1-1: new high-speed USB device number 2 using ci_hdrc

    ad9361 spi0.0: ad9361_probe : AD936x Rev 2 successfully initialized

    cf_axi_dds 79024000.cf-ad9361-dds-core-lpc: Analog Devices CF_AXI_DDS_DDS MASTER (9.00.b) at 0x79024000 mapped to 0xf0978000, probed DDS AD9361

    NET: Registered protocol family 17

    Registering SWP/SWPB emulation handler

    hub 1-1:1.0: USB hub found

    hub 1-1:1.0: 3 ports detected

    usb 1-1.3: new full-speed USB device number 3 using ci_hdrc

    usb 1-1.3: device descriptor read/64, error -32

    usb 1-1.3: device descriptor read/64, error -32

    cf_axi_adc 79020000.cf-ad9361-lpc: ADI AIM (10.00.b) at 0x79020000 mapped to 0xf0980000, probed ADC AD9361 as MASTER

    input: gpio-keys as /devices/soc0/gpio-keys/input/input0

    usb 1-1.3: new full-speed USB device number 4 using ci_hdrc

    rtc-ds1307 0-0068: setting system clock to 2000-01-01 03:27:56 UTC (946697276)

    ALSA device list:

      No soundcards found.

    usb 1-1.3: device descriptor read/64, error -32

    usb 1-1.3: device descriptor read/64, error -32

    usb 1-1.3: new full-speed USB device number 5 using ci_hdrc

    usb 1-1.3: device not accepting address 5, error -32

    usb 1-1.3: new full-speed USB device number 6 using ci_hdrc

    usb 1-1.3: device not accepting address 6, error -32

    usb 1-1-port3: unable to enumerate USB device

    EXT4-fs (mmcblk0p2): recovery complete

    EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)

    VFS: Mounted root (ext4 filesystem) on device 179:2.

    devtmpfs: mounted

    Freeing unused kernel memory: 1024K

    Mount failed for selinuxfs on /sys/fs/selinux:  No such file or directory

     * Setting up X socket directories...                                    [ OK ]

     * STARTDISTCC is set to false in /etc/default/distcc

     * /usr/bin/distccd not starting

  • 0
    •  Analog Employees 
    on Feb 26, 2020 7:50 AM in reply to dborth

    Hi Dominic,

    In one of your logs it seems iiod is starting:

     * Starting IIO Daemon iiod                                              [ OK ]

     

    Are you sure it is not running? Do you want to use usb as backend or do you have internet? error -32 means Broken pipe, which can happen if one of the ends exits or it's not there...

    You can also try to manually start iiod and see what happens... Maybe even with strace

    Also, did you looked at this link?

    At this point this I cannot do much more. Also note that this is a NI/Ettus product and they do have a yocto bsp layer for this product which is probably the best place to have the board booting properly... Also, if something is not working there, I guess they should give you support...

    -Nuno Sá

  • Hi, 

    Sorry for posting twice, I replied once but it was signalled as abuse, so I posted again, I didn't expect the first one to be posted.

    Yes it does say that it starts, but then the login times out and then it displays the line : 

    Starting IIO Daemon iiod [FAIL]

    When you say manually start iiod how would I do that once I get a terminal ?

    I was enquiring about those files as they were supplied by someone who works at ADI and so has done this before and would now how to get it to work, it was the person I mentioned, mhennerich. 

    I looked at all of the links you sent me, however yocto is not something I am permitted to use for the work I am doing.

    I have not yet had the chance to attempt the changes with the meta-adi github you suggested to me, but I will let you know how I get on when I do.

    I do not want to use the E310 as intended by Ettus I am merely interested in the AD chip that it uses.

    What I am trying to do is possible as you have provided the files I am using to do this, all I am asking is how you created these files.

    Regards,

    Dominic