Overview
========
The iperf3 example provides basic commands to measure performance of network stack.
Results will be shown on your iperf server. In the case of 'R' mode, server shows the amount of sent data,
check the terminal output in this case for the total amount of payload in bytes received over UDP,
which marks the device's throughput.

Known Issues
If the iperf3 server shows you that you have 0-bit/s bandwidth, it may be caused due to the version you are using.
This client works with Iperf v3.7. In case of any more issues, see https://github.com/esnet/iperf/labels/bug. 

Rx UDP mode ('R') has limited bandwidth by UDP_RX_BANDWIDTH macro as sending UDP packets too fast may cause
the control TCP socket to lost data and test failure.
Set the macro to a little bit higher than the device can receive or "0" for no limit.

The network throughput is limited by UART interface between board and Wi-Fi module. Default UART speed is set to 115200 Bd.


Toolchain supported
===================
- IAR embedded Workbench  8.50.9
- Keil MDK  5.33
- MCUXpresso  11.3.1
- GCC ARM Embedded  9.3.1

Hardware requirements
=====================
- Micro USB cable
- iMXRT1064 uCOM Developer's Kit
- Personal Computer
- Murata CMWC1ZZABR-107-EVB (a.k.a ABR Module)

Board settings
==============
The Wi-Fil module should be inserted in the mikroBUS connector (J31, J32).
Make sure that jumpers JP21, JP22, JP23 and JP24 are all in the 2-3 position.

Prepare the Demo
================
1.  Prepare iperf3 server on your machine:
    - Install iperf3 (Enter command "sudo apt install iperf3")
    - Start the server by running "iperf3 -s"
2.  Connect a micro USB cable between the PC host and the J29 USB port on the board.
3.  Open a serial terminal with the following settings:
    - 115200 baud rate
    - 8 data bits
    - No parity
    - One stop bit
    - No flow control
4.  Download the program to the target board.
5.  Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.
6.  The Wi-Fi module must be configured in runtime. Follow the instructions in the terminal for Wi-Fi module configuration or resetting to provisioning mode.
    If the module is in provisioning mode, it will create micro-AP:
        SSID: Serial2Wifi
        Passphrase: nxp12345
    Connect your PC or mobile phone to this Wi-Fi micro-AP, open address: http://192.168.10.1 in web browser, select "Provisioning" and then select WLAN for connection.
    Wi-Fi module stores the WLAN credentials and it will use them automatically for next connection.

Running the demo (shows provisioning mode)
================
This is an example of what it looks like when in Provisioning Mode:


Wi-Fi IPERF3 example for CMWC1ZZABR-107-EVB (a.k.a ABR Module).
Enter IP address of a server in format '192.168.1.2'

Using IP 192.168.6.21

Wi-Fi module is not configured for WLAN connection.
Connect to Wi-Fi AP: Serial2Wifi, open address: http://192.168.10.1 in web browser and configure WLAN connection.
Press any key to continue.






Running the demo (shows normal mode)
================
This is an example of what it looks like when NOT in Provisioning Mode:

Wi-Fi IPERF3 example for CMWC1ZZABR-107-EVB (a.k.a ABR Module).
Enter IP address of a server in format '192.168.1.2'

Using IP 192.168.6.21
Wi-Fi is connecting...
Wi-Fi is connecting...
Wi-Fi is connecting...
Wi-Fi is connected to: TestNet, IP Address: 192.168.50.85

To reset Wi-Fi module to provisioning mode connect to WLAN: TestNet, open address: http://192.168.50.85 in web browser and select "Reset to Provisioning".
Then restart this application.

Menu:
Press 's' to start client Tx mode
Press 'r' to start client Rx mode
Press 'S' to start client Tx UDP mode
Press 'R' to start client Rx UDP mode

Tx mode!
Connecting to the server...
Sending cookie!!...
Exchanging parameters
Creating streams
Starting test
Ending test
Exchanging results

===========================================================
Server Results
{"cpu_util_total":0.000038,
"cpu_util_user":0.000019,
"cpu_util_system":0.000019,
"sender_has_retransmits":-1,
"streams":[{"id":1,
"bytes":111616,
"retransmits":-1,
"jitter":0,
"errors":0,
"packets":0}]}
===========================================================
IPERF finished, supposed to send 111 kB (109 KiB)(111616 bytes)!
Transmited 111 kB (109 KiB)(111616 bytes).

===========================================================

PRESS "F" to restart...

