Tests:SDIO-with-UHS

This document describes how to test SDIO at UHS speeds using a ZComax AC-180M card.

Setup
The following items are needed for this test:


 * the client - a Salvator-X board with a H3 SoC (firmware v2.12) and a ZComax AC-180M plugged into CN14
 * the server - a second computer running some Linux distribution with iperf3 installed
 * the network - capable of running 802.11ac

The client will be connected to the network via WIFI (802.11ac). The server is preferably connected to the network via Gigabit-LAN. Although connection with 802.11ac is also possible, the WIFI card of the server is unknown and might affect the measurement. Gigabit-LAN is more reliable in this regard.

The setup used for the below results is:


 * the client - a Salvator-X board with a H3 SoC (firmware v2.12) and a ZComax AC-180M plugged into CN14
 * the server - Fujitsu Lifebook E544 with RTL8111/8168 PCI Express Gigabit Ethernet controller running Debian Stretch
 * the network - an AVM Fritzbox 7490 router with 802.11ac and Gigabit-LAN

Branch for testing
The test should be used with the following branch:

git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git renesas/sdio-uhs

Ensure the mwifiex driver is activated in the kernel config
These symbols need to be active to enable the WLAN driver:

CONFIG_WLAN=y CONFIG_WLAN_VENDOR_MARVELL=y CONFIG_MWIFIEX=y CONFIG_MWIFIEX_SDIO=y

Prepare the root filesystem for your target
The root filesystem should have:


 * busybox with udhcpc (v1.24.2 used here)
 * wireless-tools (v3.0-pre9 used here)
 * wpa-supplicant (v2.5 used here)
 * iperf3 (v3.1.2 used here)
 * latest firmware for SD8887 from the linux-firmware tree.

All tools are standard linux tools and should be available through your buildsystem (buildroot, yocto...).

Boot the kernel
You should see this on successful probe: mmc2: new ultra high speed SDR50 SDIO card at address 0001 mwifiex: rx work enabled, cpus 4 mwifiex_sdio mmc2:0001:1: info: FW download over, size 391772 bytes mwifiex_sdio mmc2:0001:1: WLAN FW is active mwifiex_sdio mmc2:0001:1: info: MWIFIEX VERSION: mwifiex 1.0 (15.68.7.p5) mwifiex_sdio mmc2:0001:1: driver_version = mwifiex 1.0 (15.68.7.p5)

Please note the mmc device is mmc2 here. This is likely for connector CN14. For connector CN13, it is likely to be mmc1. However, keep in mind which one you have and replace the mmc device in the following commands, if necessary.

Also note that the AC-180M seems to be sensitive to IO line settings. On H3, it may be largely not possible to load the firmware on connector 13. Connector 14 seems to be more reliable, but needs the card to be held in place manually because of its physical dimension. M3-W seems to be more stable. Same problems also occured when inserting the card into a laptop. The best IO line settings for H3 have been committed to the above git branch. Another card (EMMY-W1, same chipset) did not have these issues.

Verify SD card speed and bus width
We want a UHS mode. Check the timing spec line:

clock:		100000000 Hz vdd:		21 (3.3 ~ 3.4 V) bus mode:	2 (push-pull) chip select:	0 (don't care) power mode:	2 (on) bus width:	2 (4 bits) timing spec:	5 (sd uhs SDR50) signal voltage:	1 (1.80 V) driver type:	0 (driver type B)
 * 1) cat /sys/kernel/debug/mmc2/ios

Check if there is the network device
It should show some mlan  device:

eth0     Link encap:Ethernet  HWaddr  BROADCAST MULTICAST MTU:1500  Metric:1 RX packets:202904 errors:0 dropped:0 overruns:0 frame:0 TX packets:405823 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:13393299 (12.7 MiB) TX bytes:614261381 (585.8 MiB) Interrupt:133
 * 1) ifconfig -a

lo       Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:65536  Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

mlan0    Link encap:Ethernet  HWaddr  UP BROADCAST RUNNING MULTICAST MTU:1500  Metric:1 RX packets:2 errors:0 dropped:0 overruns:0 frame:0 TX packets:2 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:282 (282.0 B) TX bytes:248 (248.0 B) Similar to above, the wireless network device is likely to be mlan0. If it has a different name in your setup, please adapt the following command-lines accordingly.

Activate the interface
Activate the mlan interface and disable ethernet. If ethernet happens to be connected to the same network as well, you might accidently test the ethernet throughput otherwise :)


 * 1) ifconfig eth0 down
 * 2) ifconfig mlan0 up

Now scan for networks
mlan0    Scan completed : [listing of networks in your area]
 * 1) iwlist mlan0 scan

Note: My AC-180M only found a fraction of networks with poor signal strength compared to another card (EMMY-W1, same chipset). It could be assumed that the antenna in my setup was broken or inadequate.

Create /etc/wpa_supplicant.conf for your network
Here is a template: ctrl_interface=/var/run/wpa_supplicant network={ ssid=" " scan_ssid=1 key_mgmt=WPA-PSK psk=" " }

Start wpa_supplicant to connect to the network
mlan0: Trying to associate with  (SSID='' freq=5180 MHz) [ 191.786663] mwifiex_sdio mmc2:0001:1: info: trying to associate to '' bssid  [ 191.834724] mwifiex_sdio mmc2:0001:1: info: associated to bssid  successfully mlan0: Associated with  WMM AC: Missing IEs mlan0: WPA: Key negotiation completed with  [PTK=CCMP GTK=CCMP] mlan0: CTRL-EVENT-CONNECTED - Connection to  completed [id=0 id_str=]
 * 1) wpa_supplicant -i mlan0 -c /etc/wpa_supplicant.conf &

Start iperf3 (in server mode) on the server
[SERVER] $ iperf3 -s --- Server listening on 5201 ---

Check you are connected to an AC network
eth0     no wireless extensions.
 * 1) iwconfig mlan0

lo       no wireless extensions.

mlan0    IEEE 802.11  ESSID:"" Mode:Managed Frequency:5.18 GHz  Access Point:  Bit Rate=433.3 Mb/s  Tx-Power=8 dBm Retry short limit:9  RTS thr=2347 B   Fragment thr=2346 B             Encryption key:off Power Management:on Link Quality=60/70 Signal level=-50 dBm Rx invalid nwid:0 Rx invalid crypt:0  Rx invalid frag:0 Tx excessive retries:0 Invalid misc:0   Missed beacon:0

The frequency should be in the 5GHz range and the bit rate should be 433.3 MB/s.

Get an address and say hello to the iperf3 server
udhcpc (v1.24.2) started Sending discover... Sending select for ... Lease of  obtained, lease time 1209600 deleting routers adding dns  PING  (<iperf3-server-ip>): 56 data bytes 64 bytes from <iperf3-server-ip>: seq=0 ttl=64 time=10.912 ms 64 bytes from <iperf3-server-ip>: seq=1 ttl=64 time=5.023 ms 64 bytes from <iperf3-server-ip>: seq=2 ttl=64 time=5.015 ms 64 bytes from <iperf3-server-ip>: seq=3 ttl=64 time=7.734 ms ...
 * 1) udhcpc -i mlan0; ping <iperf3-server-ip>

Test the connection with iperf3
On the target board, run:

Connecting to host 192.168.213.157, port 5201 [ 4] local 192.168.213.160 port 32934 connected to 192.168.213.157 port 5201 [ 106.338303] sh_mobile_sdhi ee100000.sd: timeout waiting for SD bus idle [ 106.363612] sh_mobile_sdhi ee100000.sd: timeout waiting for SD bus idle [ ID] Interval          Transfer     Bandwidth       Retr  Cwnd [ 4]   0.00-1.00   sec  10.4 MBytes  87.4 Mbits/sec    0    133 KBytes [ 4]   1.00-2.00   sec  11.6 MBytes  97.6 Mbits/sec    0    133 KBytes [ 108.256587] sh_mobile_sdhi ee100000.sd: timeout waiting for SD bus idle [ 4]   2.00-3.00   sec  11.3 MBytes  95.0 Mbits/sec    0    148 KBytes [ 4]   3.00-4.00   sec  11.4 MBytes  95.6 Mbits/sec    0    148 KBytes [ 4]   4.00-5.00   sec  11.4 MBytes  96.0 Mbits/sec    0    148 KBytes [ 4]   5.00-6.00   sec  11.4 MBytes  95.2 Mbits/sec    0    148 KBytes [ 4]   6.00-7.00   sec  11.3 MBytes  94.6 Mbits/sec    0    148 KBytes [ 4]   7.00-8.00   sec  11.3 MBytes  94.7 Mbits/sec    0    148 KBytes [ 4]   8.00-9.00   sec  11.4 MBytes  95.3 Mbits/sec    0    148 KBytes [ 4]   9.00-10.00  sec  11.5 MBytes  96.1 Mbits/sec    0    148 KBytes - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval          Transfer     Bandwidth       Retr [ 4]   0.00-10.00  sec   113 MBytes  94.8 Mbits/sec    0             sender [ 4]   0.00-10.00  sec   113 MBytes  94.6 Mbits/sec                  receiver
 * 1) iperf3 -c <iperf3-server-ip>

Note that the "timeout" messages appeared on my H3 ES1.0, but not on my M3-W.

Results
Test results as obtained on 15. Nov. 2016. Will be updated on new discoveries:


 * Test with AC-180M and 802.11ac network using H3 Salvator-X: ~200Kbits/sec(!)

Comparison tests:
 * Test with EMMY-W1 (UHS, SDR50) and 802.11ac network using H3 Salvator-X: ~94Mbits/sec
 * Test with EMMY-W1 (non-UHS) and 802.11ac network using H3 Salvator-X: ~75Mbits/sec
 * Test with EMMY-W1 (UHS, SDR50) and 802.11n network using H3 Salvator-X: ~44Mbits/sec
 * Test with second laptop and 802.11ac network: ~400Mbits/sec

Tests were also made with M3-W instead of H3. They did not show a notable difference in throughput.