Wi-Fi Fundamentals Lesson 3 Exercise 2 - net_zperf: setsockopt SO_BINDTODEVICE error (-2)

Hello,

After successfully building Wi-Fi Fundamentals Lesson 3, Exercise 2 under nRF Connect SDK v2.9.1 & using nRF5340-DK with nRF7002-EK, I get the net_zperf: setsockopt SO_BINDTODEVICE error (-2).

I've also repeated by building and then running the provided l3_e2_sol. I ran the perf test on two completely different networks and got the same error. 

In both cases, nRF5340DK / nRF7002-EK connected successfully to the iperf server running on the same network as the nRF device. However, the nRF device was unable to receive any packets. I suspect because of the setsockopt SO_BINDTODEVICE error.

Please review the outputs below.

[00:00:00.305,877] <inf> wifi_nrf_bus: SPIM spi@a000: freq = 8 MHz
[00:00:00.305,908] <inf> wifi_nrf_bus: SPIM spi@a000: latency = 0
[00:00:00.425,659] <inf> wifi_nrf: Management buffer offload enabled

[00:00:00.557,586] <inf> fs_nvs: 2 Sectors of 4096 bytes
[00:00:00.557,586] <inf> fs_nvs: alloc wra: 0, fd0
[00:00:00.557,586] <inf> fs_nvs: data wra: 0, f4
*** Booting nRF Connect SDK v2.9.1-60d0d6c8d42d ***
*** Using Zephyr OS v3.7.99-ca954a6216c9 ***
[00:00:00.557,952] <inf> net_config: Initializing network
[00:00:00.557,983] <inf> net_config: Waiting interface 1 (0x20001e08) to be up...
[00:00:00.558,013] <inf> net_config: Running dhcpv4 client...
[00:00:00.558,288] <inf> Lesson3_Exercise2: Starting nrf5340dk with CPU frequency: 128 MHz
[00:00:00.558,471] <inf> wifi_supplicant: wpa_supplicant initialized
[00:00:01.533,355] <inf> wifi_mgmt_ext: Connection requested
[00:00:01.558,349] <inf> Lesson3_Exercise2: Waiting to connect to Wi-Fi
Connected
[00:00:07.383,575] <inf> net_dhcpv4: Received: 192.168.1.155
[00:00:07.383,636] <inf> net_config: IPv4 address: 192.168.1.155
[00:00:07.383,636] <inf> net_config: Lease time: 2592000 seconds
[00:00:07.383,666] <inf> net_config: Subnet: 255.255.255.0
[00:00:07.383,697] <inf> net_config: Router: 192.168.1.1
[00:00:07.383,758] <inf> Lesson3_Exercise2: Network connected
[00:00:10.383,880] <inf> Lesson3_Exercise2: IPv4 address 192.168.1.29
[00:00:10.383,880] <inf> Lesson3_Exercise2: Starting Wi-Fi throughput test: Zperf client
[00:00:10.383,911] <inf> Lesson3_Exercise2: New UDP session started
[00:00:10.384,063] <wrn> net_zperf: setsockopt SO_BINDTODEVICE error (-2)

[00:00:32.863,922] <inf> Lesson3_Exercise2: Wi-Fi throughput test: Upload completed!
[00:00:32.863,922] <inf> Lesson3_Exercise2: Upload results:
[00:00:32.863,922] <inf> Lesson3_Exercise2: 23536640 bytes in 20001 ms
[00:00:32.863,952] <inf> Lesson3_Exercise2: 22985 packets sent
[00:00:32.863,952] <inf> Lesson3_Exercise2: 82781 packets lost
[00:00:32.863,952] <inf> Lesson3_Exercise2: 0 packets received
[00:00:32.863,952] <inf> Lesson3_Exercise2: 9193 kbps throughput

iPerf server:

[ 2] local 192.168.1.29 port 5001 connected with 192.168.1.155 port 56794
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 2] 0.00-1.00 sec 577 KBytes 4.73 Mbits/sec 2.557 ms 544/1121 (49%)
[ 2] 1.00-2.00 sec 512 KBytes 4.19 Mbits/sec 2.488 ms 660/1172 (56%)
[ 2] 2.00-3.00 sec 612 KBytes 5.01 Mbits/sec 2.540 ms 536/1148 (47%)
[ 2] 3.00-4.00 sec 540 KBytes 4.42 Mbits/sec 3.276 ms 553/1093 (51%)
[ 2] 4.00-5.00 sec 620 KBytes 5.08 Mbits/sec 2.566 ms 602/1222 (49%)
[ 2] 5.00-6.00 sec 600 KBytes 4.92 Mbits/sec 2.505 ms 516/1116 (46%)
[ 2] 6.00-7.00 sec 604 KBytes 4.95 Mbits/sec 2.699 ms 559/1163 (48%)
[ 2] 7.00-8.00 sec 604 KBytes 4.95 Mbits/sec 2.481 ms 533/1137 (47%)
[ 2] 8.00-9.00 sec 597 KBytes 4.89 Mbits/sec 2.765 ms 564/1161 (49%)
[ 2] 9.00-10.00 sec 547 KBytes 4.48 Mbits/sec 2.528 ms 615/1162 (53%)
[ 2] 10.00-11.00 sec 608 KBytes 4.98 Mbits/sec 2.529 ms 554/1162 (48%)
[ 2] 11.00-12.00 sec 596 KBytes 4.88 Mbits/sec 2.671 ms 544/1140 (48%)
[ 2] 12.00-13.00 sec 596 KBytes 4.88 Mbits/sec 2.864 ms 527/1123 (47%)
[ 2] 13.00-14.00 sec 568 KBytes 4.65 Mbits/sec 2.673 ms 628/1196 (53%)
[ 2] 14.00-15.00 sec 608 KBytes 4.98 Mbits/sec 2.726 ms 534/1142 (47%)
[ 2] 15.00-16.00 sec 612 KBytes 5.01 Mbits/sec 2.562 ms 529/1141 (46%)
[ 2] 16.00-17.00 sec 512 KBytes 4.19 Mbits/sec 2.564 ms 650/1162 (56%)
[ 2] 17.00-18.00 sec 560 KBytes 4.59 Mbits/sec 2.566 ms 596/1156 (52%)
[ 2] 18.00-19.00 sec 560 KBytes 4.59 Mbits/sec 2.504 ms 589/1149 (51%)
[ 2] 19.00-20.00 sec 574 KBytes 4.70 Mbits/sec 3.580 ms 524/1098 (48%)
[ 2] 20.00-21.00 sec 0.000 Bytes 0.000 bits/sec 0.000 ms 0/0 (0%)
[ 2] 21.00-22.00 sec 0.000 Bytes 0.000 bits/sec 0.000 ms 0/0 (0%)
[ 2] 0.00-22.08 sec 11.3 MBytes 4.31 Mbits/sec 2.836 ms 11377/22985 (49%)

What would be the reason for the setsockopt error? Thank you.


Regards,
Ravi

  • Hello,

    By dropping the WIFI_ZPERF_RATE I was able to get dropped packets down to zero percentage on the iperf server side and no longer got the setsockopt SO_BINDTODEVICE error.

    I ran some additional tests using zperf on the nRF5340DK with nRF7002EK and iperf on the peer. It looks the best I can do before the packet drop rate gets above 10%, is ~1.5-2 Mbps.

    I also built & ran the "throughput" Wi-Fi sample with the "High Performance" overlay. The maximum data rate I achieved was ~2.5 Mbps. This is significantly lower than those posted using the nRF7002DK at here.

    In addition to other network conditions and router, I wonder how much a factor is the QSPI (24Mhz) on the nRF7002DK compared to the 8MHz SPI on the nRF7002EK.

    Does Nordic Support have any throughput results for nRF5340DK with nRF7002EK?

    Running zperf on the nRF5340-DK,

    uart:~$ zperf udp download 5001
    UDP server started on port 5001
    New session started.
    End of session!
    duration: 9.92 s
    received packets: 1248
    nb packets lost: 59
    nb packets outorder: 0
    jitter: 1.08 ms
    rate: 1.47 Mbps
    New session started.
    
    uart:~$ 
    End of session!
    duration: 9.77 s
    received packets: 1393
    nb packets lost: 350
    nb packets outorder: 0
    jitter: 1.23 ms
    rate: 1.67 Mbps


    Above corresponded to running iperf on peer 192.168.1.29,

    quark14@quark14 bgnet_source % iperf -c 192.168.1.155 -i 1 -t 10 -u -b 1500K
    ------------------------------------------------------------
    Client connecting to 192.168.1.155, UDP port 5001
    Sending 1470 byte datagrams, IPG target: 0.00 us (kalman adjust)
    UDP buffer size: 9.00 KByte (default)
    ------------------------------------------------------------
    [ 1] local 192.168.1.29 port 61559 connected with 192.168.1.155 port 5001
    [ ID] Interval Transfer Bandwidth
    [ 1] 0.00-1.00 sec 188 KBytes 1.54 Mbits/sec
    [ 1] 1.00-2.00 sec 187 KBytes 1.53 Mbits/sec
    [ 1] 2.00-3.00 sec 188 KBytes 1.54 Mbits/sec
    [ 1] 3.00-4.00 sec 188 KBytes 1.54 Mbits/sec
    [ 1] 4.00-5.00 sec 187 KBytes 1.53 Mbits/sec
    [ 1] 5.00-6.00 sec 188 KBytes 1.54 Mbits/sec
    [ 1] 6.00-7.00 sec 187 KBytes 1.53 Mbits/sec
    [ 1] 7.00-8.00 sec 188 KBytes 1.54 Mbits/sec
    [ 1] 8.00-9.00 sec 188 KBytes 1.54 Mbits/sec
    [ 1] 9.00-10.00 sec 187 KBytes 1.53 Mbits/sec
    [ 1] 0.00-10.01 sec 1.83 MBytes 1.54 Mbits/sec
    [ 1] Sent 1309 datagrams
    [ 1] Server Report:
    [ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
    [ 1] 0.00-922120.00 sec 7.00 PBytes 68.4 Gbits/sec 0.000 ms 0/0 (0%)
    [ 1] 0.00-922120.00 sec 1248 datagrams received out-of-order
    
    
    quark14@quark14 bgnet_source % iperf -c 192.168.1.155 -i 1 -t 10 -u -b 2000K
    ------------------------------------------------------------
    Client connecting to 192.168.1.155, UDP port 5001
    Sending 1470 byte datagrams, IPG target: 0.00 us (kalman adjust)
    UDP buffer size: 9.00 KByte (default)
    ------------------------------------------------------------
    [ 1] local 192.168.1.29 port 55605 connected with 192.168.1.155 port 5001
    [ ID] Interval Transfer Bandwidth
    [ 1] 0.00-1.00 sec 250 KBytes 2.05 Mbits/sec
    [ 1] 1.00-2.00 sec 251 KBytes 2.06 Mbits/sec
    [ 1] 2.00-3.00 sec 250 KBytes 2.05 Mbits/sec
    [ 1] 3.00-4.00 sec 250 KBytes 2.05 Mbits/sec
    [ 1] 4.00-5.00 sec 250 KBytes 2.05 Mbits/sec
    [ 1] 5.00-6.00 sec 250 KBytes 2.05 Mbits/sec
    [ 1] 6.00-7.00 sec 250 KBytes 2.05 Mbits/sec
    [ 1] 7.00-8.00 sec 250 KBytes 2.05 Mbits/sec
    [ 1] 8.00-9.00 sec 251 KBytes 2.06 Mbits/sec
    [ 1] 9.00-10.00 sec 250 KBytes 2.05 Mbits/sec
    [ 1] 0.00-10.01 sec 2.44 MBytes 2.05 Mbits/sec
    [ 1] Sent 1745 datagrams
    [ 1] Server Report:
    [ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
    [ 1] 0.00-776825.00 sec 7.81 PBytes 90.6 Gbits/sec 0.000 ms 0/0 (0%)
    [ 1] 0.00-776825.00 sec 1393 datagrams received out-of-order


    Regards,
    Ravi

  • Hi Ravi,

    When using the nRF5340 DK with the nRF7002 EK, communication between the nRF5340 and the nRF7002 goes through SPI, while on the nRF7002 DK it is QSPI. If you look at nRF7002 product specification - Throughput, you can see that there is a big difference in throughput between QSPI and SPI.
    I did a quick test on my desk to compare the nRF7002 DK with the nRF5340 DK + nRF7002 EK, and I got a throughput of 18.26 Mbps for the nRF7002 DK and 8.64 Mbps (average of 4 tests) for the nRF5340 DK + nRF7002 EK. These tests were done in the exact same test environment.

    Additionally, the throughput will depend on the test environment, such as the distance between the computer running iPerf and the DK, noise from other devices, etc. As is stated in the documentation of the Throughput sample, the results listed there were obtained with a good RSSI signal in a clean environment.

    Best regards,
    Marte

  • Hi Marte,

    Thank you for the additional testing with the nRF5340-DK + nRF7002-EK. I guess, I have a slow network connectivity. Anyway, I'll try again closer to the router to see what difference, if any, it makes.

    Any ideas on what may be the cause of the net_zperf: setsockopt SO_BINDTODEVICE error (-2)?

    Have you seen this error before? Thanks.


    Kind Regards,
    Ravi

Related