How to use ZYNQ SDR in Linux mode

Attention

You are not allowed to download any native file from the zc706 board, because the project hasn’t been released formally.

The following steps describe how to run an experiment using the ZYNQ SDR in Linux mode.

First start an experiment:

  • Start an experiment with nodes apuV4 and zc706zyncSDR2. Do not draw any links between the two nodes. Do not specify any image for apuV4 (in this case the default image will be used).

Then bring up the correct network interface on the APU to connect to the ZYNQ board:

  • On apuV4 run:
sudo ifconfig eth2 up ; sudo ifconfig eth2 192.168.10.254/24 ; ping 192.168.10.122
  • Login to the zc706 board from the apuV4:
ssh root@192.168.10.122 (password: 123456)
  • Load openwifi driver:
./wgd.sh
  • Bring up openwifi interface sdr0:
ifconfig sdr0 up
  • Run the following commands to check the interface capabilities:
# iwconfig

sdr0      IEEE 802.11  ESSID:off/any
          Mode:Managed  Access Point: Not-Associated   Tx-Power=20 dBm
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off

Followed by:

# iw list

Experiment 1: openwifi NIC as client and connect to an AP

Read this tutorial first: Access point and client.

1 . Configure wlan0 in apuV4 as AP.
You need to set
hw_mode=a
channel=36

for hostapd, because currently the openwifi NIC sdr0 supports only OFDM. Use hostapd /root/hostapd.conf -dd to see more debug information.

2 . operate openwifi NIC sdr0 in zc706.

Run: iwlist sdr0 scan

You should see AP information like:

Cell 01 - Address: 04:F0:21:11:E5:55
          Channel:36
          Frequency:5.18 GHz (Channel 36)
          Quality=41/70  Signal level=-69 dBm
          Encryption key:off
          ESSID:"iperfAP"
          Bit Rates:6 Mb/s; 9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s
                    36 Mb/s; 48 Mb/s; 54 Mb/s
          Mode:Master
          Extra:tsf=00000000019c80dc
          Extra: Last beacon: 10ms ago
          IE: Unknown: 000769706572664150
          IE: Unknown: 01088C129824B048606C
          IE: Unknown: 030124
          IE: Unknown: 7F080000000000000040
          IE: Unknown: AF00

Then:

iwconfig sdr0 mode managed
iwconfig sdr0 essid iperfAP
ifconfig sdr0 192.168.1.10/24 up
ping 192.168.1.1

Experiment 2: openwifi communicate with commercial wifi card in ad-hoc mode

You need a commercial wifi card that support IBSS mode. To check the wifi card capability (mode, rate, etc), you can use iw list command. Please make sure they have Wi-Fi card AR9462 or AR93xx. Please avoid nodes with Wi-Fi card AR928X (ZOTAC) , QCA988x or QCA986x/988x (APU).

1 . Start ad-hoc mode of DSS node, for example dssK5 or dssJ5 :

($xxx means a parameter you should specify. The ad-hoc network SSID will be "ad-hoc-test")
($nic_name, the network interface name when you run ifconfig)
($ch_number, Wi-Fi channel number, such as 1, 6, 11)
($ip_addr, IP address you want)

sudo ip link set $nic_name down
sudo iwconfig $nic_name mode ad-hoc
sudo iwconfig $nic_name essid 'ad-hoc-test'
sudo ip link set $nic_name up
sudo iwconfig $nic_name channel $ch_number
sudo ifconfig $nic_name $ip_addr netmask 255.255.255.0
ifconfig
iwconfig $nic_name

(Now you should see … ESSID “ad-hoc-test” … Cell: xx:yy:zz…)

2 . Start ad-hoc mode of node 2 (openwifi or ZOTAC), and let it to join the “ad-hoc-test” network:

($cell should be xx:yy:zz... you saw in node 1)
sudo ip link set $nic_name down
sudo iwconfig $nic_name mode ad-hoc
sudo iwconfig $nic_name essid 'ad-hoc-test'
sudo ip link set $nic_name up
sudo iwconfig $nic_name channel $ch_number
sudo iwconfig $nic_name ap $cell
sudo ifconfig $nic_name $ip_addr netmask 255.255.255.0
ifconfig
iwconfig $nic_name

Advanced topics

Serial connection to zc706

When the zc706 has issue or Linux in it is not booting correctly, you can use UART to access the zc706 terminal (bootloader for example):

sudo apt-get install minicom
sudo minicom -s

Then Serial port setup, device should be /dev/ttyUSB1 and Hardware Flow Control should be disabled.

Fail Safe Backup

There are directory called important_bak that contains original files. You can copy files from that directory to overwrite files that is suspected broken. So DO NOT change/delete any files in important_bak directory!

Changing FPGA image, Linux kernel, booting, etc.

Mount the boot partition of SD card in zc706 Linux:

cd /
mkdir sdcard
mount /dev/mmcblk0p1 /sdcard

In sdcard directory:

  • BOOT.BIN: FPGA bitstream and other necessary initialization program.
  • Devicetree.dtb: devicetree corresponds to the FPGA design.
  • uImage: Customized Linux kernel.

Please check https://wiki.analog.com/resources/eval/user-guides/ad-fmcomms2-ebz/software/linux/zynq_2014r2 to learn how to generate above files.

Again, DO NOT change/delete any files in ``important_bak`` directory!

After you change files in the root directory of boot partition, you need to reboot the zc706. Then boot loader will load those new files. If new files break Linux, you need serial/UART connection, and try to boot to original status from files in important_bak.

SDR TX time slicing

For SDR TX, there is a hardware/FPGA timer based slicing mechanism.

Example of two time slices (2:98 allocation) for explanation:

  • In FPGA, a timer counts from 0 to 50000us again and again.
  • When timer value is between 1000us~50000us, we do tx for slice0 if there are any packets left in the FPGA slice0 queue. (Linux driver receives packets from Linux upper layer, and put packets in FPGA hardware queue. Depending on the target MAC address and type of the packet, driver knows that the packet should be put into FPGA slice0 queue or slice1 queue).
  • For slice1, same procedure except that timer value has to be between 0~1000us. So 0~1000us means 2% (1000/50000) air time of SDR tx, 1000~50000 means 98% (49000/50000) air time of SDR tx.

We only do above slicing operation for unicast data packet. For 802.11 management/control packet or broadcasting packet, we will send immediately, because they don’t belong to any slice and they are important for the whole Wi-Fi network.

Note that all above numbers (10000us, 50000us, etc) are configurable. The minimum time unit is 1us.

Slice config command:

# set SDR tx slice0 target MAC address (assume it is 6c:fd:b9:4c:b1:c1)
     ./sdrctl dev sdr0 set addr0 b94cb1c1
# set SDR tx slice0 cycle length in us
     ./sdrctl dev sdr0 set slice_total0 49999
     # set SDR tx slice0 start time in us
     ./sdrctl dev sdr0 set slice_start0 1000
     # set SDR tx slice0 end time in us
     ./sdrctl dev sdr0 set slice_end0  49999

To set for slice1, just replace those “0” to “1”.

To get value of above configurations, just replace “set” to “get”