An SDR node at ExPECA is a USRP E320 which is powered over ethernet.
Make sure the following configurations are done before deplyment. You need to have connect to the SDR with a micro USB cable. Prepare a SD card reader as well.
Download NI Reference Design version 4.3.0.0
In order to change the UHD version on the radio, you must first install the desired UHD version on your host.
sudo apt install -y libboost-all-dev libusb-1.0-0-dev doxygen python3-docutils python3-mako python3-numpy python3-requests python3-ruamel.yaml python3-setuptools cmake build-essential
git clone https://github.com/EttusResearch/uhd.git ~/uhd
cd ~/uhd
git checkout v4.3.0.0
cd host
mkdir build
cd build
cmake ../
make -j $(nproc)
make test # This step is optional
sudo make install
sudo ldconfig
Use uhd_images_downloader to pull the relevant sd image and fpga bitstream.
expeca@forlong:~$ sudo uhd_images_downloader -t sdimg -t e320[INFO] Using base URL: https://files.ettus.com/binaries/cache/[INFO] Images destination: /usr/local/share/uhd/imagesThe file size for this target (565.1 MiB) exceeds the download limit (100.0 MiB). Continue downloading? [y/N]y233759 kB / 592569 kB (039%) e3xx_e320_sdimg_default-v4.0.0.0.zipexpeca@forlong:~$ uhd_images_downloader -t e320 -t fpga[INFO] Using base URL: https://files.ettus.com/binaries/cache/[INFO] Images destination: /usr/local/share/uhd/images[INFO] Target e3xx_e320_fpga_default is up to date.
Clean Copy NI Reference Design to SD Card
Insert E320's SD card and unmount all partitions. Running the command lsblk again will show these partitions have been unmounted. If they are not (MOUNTPOINT is specified) unmount them.
In order to make an E320 dual boot, we need to copy Mangocomm's boot files into the boot partition alongside the reference boot files. However, boot partition is too small and it needs to be resized. The approach is to append some storage from data partition which is almost free to boot partition.
We use Linux's GParted tool. Install it using the package manager and open the SD card using it. NI E320 SD card by default comes with 4 partitions:
Note that partition 1 is named boot, its type is FAT16 and has boot and lba flags.
Make a backup from both boot and data partitions that we want to resize. For the boot partition you can copy the files with cp command. But for the data partition use dd to create an image. We do that to avoid modifing the files permissions on this partition.
Create a new FAT16 partition with the label boot located after /dev/sda4 using the freed space.
Apply the operations, then don't forget to add the flags: 4. Add flags boot and lba to /dev/sda1
The result should look like this
expeca@forlong:~$ sudo fdisk -l /dev/sdaDisk /dev/sda: 14,9 GiB, 16022241280 bytes, 31293440 sectorsUnits: sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 512 bytesI/O size (minimum/optimal): 512 bytes / 512 bytesDisklabel type: dosDisk identifier: 0x7d6a2a38Device Boot Start End Sectors Size Id Type/dev/sda1 * 30400512 31293439 892928 436M e W95 FAT16 (LBA)/dev/sda2 81920 4079615 3997696 1,9G 83 Linux/dev/sda3 4079616 8077311 3997696 1,9G 83 Linux/dev/sda4 8077312 30400511 22323200 10,7G 83 LinuxPartition table entries are not in disk order.
Mount the new BOOT partition
sudo mkdir /media/BOOT
sudo mount /dev/sdb1 /media/BOOT
Copy from the host, boot partition files that you saved before to the new boot partition. Also create mango_bootbin and ni_bootbin folders on this partition. Copy NI's boot.bin file to its folder.
For each device, a new petalinux image must be built with a new MAC address for the rj45 port. Follow the instructions here to create the petalinux project.
wlab@forlong:~/new_mango_e320$ source ~/petalinux/2019.1/settings.shwlab@forlong:~/new_mango_e320$ petalinux-create -t project -s mango_wlan_E320_petalinux_v2.0.2.bspINFO: Create project: INFO: Projects: INFO: * mango_wlan_E320_petalinuxINFO: has been successfully installed to /home/wlab/new_mango_e320/INFO: New project successfully created in /home/wlab/new_mango_e320/
Open the project folder
wlab@forlong:~/new_mango_e320$ cd ~/new_mango_e320/mango_wlan_E320_petalinux
Modify /etc/network/interfaces file for the static ip of eth0
vim components/meta-mango-wlan/meta-mango/recipes-core/init-ifupdown/files/interfaces
...
auto eth0
iface eth0 inet static
address 10.30.10.1
netmask 255.255.255.0
Note that auto eth0 is important, otherwise the interface won't come up.
Then proceed to "Subsystem AUTO Hardware Settings" -> "Ethernet Settings" for setting the ethernet MAC address and static ip. Set the MAC to randomized address generation and static ip without gateway. Then, save the settings and exit the configuration. Return to the config's "Ethernet Settings" and check the generated MAC address. Write it down.
NOTE: the project creates u-boot with Xilinx's automatic configurations. However, the project does not compile successfully in Ubuntu 18.04. To bypass that, open petalinux-config and save it again without any change :D. Then build the project again.
root@ni-e320-3238BA5:~# networkctl status ● State: routable Address: 10.30.10.16 on eth0 10.30.1.16 on sfp0 169.254.0.1 on int0
Check eth0 network config. Verify that it is using 10-eth0.link and 40-eth0.network network file.
root@ni-e320-3238B97:~# networkctl status eth0* 2: eth0 Link File: /lib/systemd/network/99-default.link Network File: /lib/systemd/network/40-eth0.network Type: ether State: carrier (configuring) Path: platform-e000b000.ethernet Driver: macb HW Address: 00:80:2f:33:af:9d (NATIONAL INSTRUMENTS CORP.) MTU: 1500 (min: 68, max: 1500) Queue Length (Tx/Rx): 1/1 Auto negotiation: yes Speed: 1Gbps Duplex: full Port: mii Connected To: poe-switch-01 on port mg2
Check advertised link speeds and connection staatus via:
root@ni-e320-3238BA5:~# ethtool eth0Settings for eth0: Supported ports: [ TP MII ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Supported pause frame use: Symmetric Supports auto-negotiation: Yes Supported FEC modes: Not reported Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Advertised pause frame use: No Advertised auto-negotiation: Yes Advertised FEC modes: Not reported Link partner advertised link modes: 100baseT/Half 100baseT/Full 1000baseT/Full Link partner advertised pause frame use: No Link partner advertised auto-negotiation: Yes Link partner advertised FEC modes: Not reported Speed: 1000Mb/s Duplex: Full Port: MII PHYAD: 7 Transceiver: internal Auto-negotiation: on Link detected: yes
Update E320 FPGA on NI design
In this section we update the FPGA image to version 4.3.0.0 and the XG version to work with the SFP port and 9000 mtu. Put back the sd card into E320, load NI design if you haven't and make sure the host is connected to it via network. Load fpga image by running the following command on the host
wlab@forlong:~$ ping 10.30.10.5
PING 10.30.10.5 (10.30.10.5) 56(84) bytes of data.
64 bytes from 10.30.10.5: icmp_seq=1 ttl=64 time=0.515 ms
64 bytes from 10.30.10.5: icmp_seq=2 ttl=64 time=0.275 ms
64 bytes from 10.30.10.5: icmp_seq=3 ttl=64 time=0.272 ms
Run WiFi on Mango Design
Every time mango design boots up, modprobe should be run to bring up the wlan driver, then we change the mac address from default to another one in order to resolve mac address conflicts.
modprobe mango_wlan
iw wlan0 del
iw phy mango-wlan-phy interface add wlan0 type managed addr 40:d8:55:04:20:19
ip link set wlan0 up
./run_ap.sh
Fix UART preventing boot in Mango design
Mango design does not boot without a micro USB cable (UART) connected. In order to resolve that, we use the following hack:
Prepare a microUSB to USB cable, where the +5V wire and GND wire are untouched but data wires are grounded (solder them to the GND wire).
Connect the USB socket to E320's USB port, connect the microUSB socket to E320's microUSB port.
This way the E320's UART transciver which should be powered externally comes up, but since data pins are grounded, it finds nothing and continues.
Read more here: https://support.xilinx.com/s/question/0D52E00006iHma8SAC/zc702-booting-stops-without-uart?language=en_US
Use sdr-tools package to control the SDR
The sdr-tools Python package is developed to control the ExPECA SDRs from any device with network connection to the management port. We show how to do that on the controller node. It is containerized:
For example to change the design on SDR 3 to mango, run the following on the controller:
When the device is ready to be attached to the network, there will be 2 connections to the tenants switch: one rj45 and one sfp. Write down which ports they are connected to e.g. "te1/0/28" and "te2/0/15". Later, we register these two ports as one network segment in Openstack after deployment. Therefore, you must make sure that on the tenant switch, they are cleared of any default/native access VLANs. This is necessary to avoid access from other open ports on the switch.