Changes between Initial Version and Version 1 of expansion/gw16146


Ignore:
Timestamp:
09/09/2021 09:09:34 PM (3 years ago)
Author:
Tim Harvey
Comment:

initial page

Legend:

Unmodified
Added
Removed
Modified
  • expansion/gw16146

    v1 v1  
     1 [[PageOutline]]
     2
     3= GW16146 miniPCIe 802.11ah Radio Module
     4The GW16146 is a miniPCIe form factor 802.11ah radio consisting of:
     5- FT232H MPSSE USB to SPI bridge
     6- [https://www.silextechnology.com/connectivity-solutions/embedded-wireless/sx-newah Silex SX-NEWAH] module based on [https://www.newracom.com/product/nrc7292 Newracom NRC7292] (US only)
     7
     8The GW16146 differs from the Newracom NRC7292 EVK in the following ways:
     9 * Sits behind a FT232H USB to SPI bridge
     10 * Uses software polling instead of an interrupt
     11 * Uses the Silex SX-NEWAH radio containing the NRC7292 but RF tuned for US operation
     12
     13== Features
     14The [https://www.silextechnology.com/connectivity-solutions/embedded-wireless/sx-newah Silex SX-NEWAH module] featuring the [https://www.newracom.com/product/nrc7292 Newracom 7292] features:
     15 * IEEE 802.11ah operating in Sub 1GHz license-exempt band
     16  - offers a much greater range over 2.5GHz and 5GHz technologies
     17  - offers a much higher data rate than proprietary Low-Power Wide-Area (LPWA) technologies such as LoRa and Sigfox
     18  - full IP stack lowers barrier to entry over proprietary Low-Power Wide-Area (LPWA) technologies such as LoRa and Sigfox
     19 * latest generation Wi-Fi security - WPA3
     20 * channel widths: 1/2/4MHz channel widths with optional short guard interval (SGI) (yield 150Kbps to 15Mbps PHY throughput at the PHY layer but due to USB-to-SPI and driver polling maxes out at about 3mbps)
     21 * streams: 1 spatial stream
     22 * data rates: MCS0-MCS7, MCS10 (1MHz only)
     23 * country: US support only
     24 * modes: infrastructure, monitor, 802.11s mesh
     25 * auth / encryption: open, WPA2-PSK(AES), WPA3-OWE, WPA3-SAE
     26 * OFDM modulation
     27 * AES-CCMP encryption
     28 * 750 to 950MHz frequency band
     29 * TX gain range: 30dB
     30 * RX noise figure: <4dB
     31 * Max input level: -10dBm
     32 * dual embedded ARM Cortex-M0 and Cortex-M3 processor
     33 * SPI host interface
     34 * only 1 GW16146 is supported on a give system; as there is no concrete way to associate SPI bus number with particular device. The bus number assignment relies on USB
     35bus scan and device probe sequence
     36
     37RF transmitter specifications:
     38||= BW =||= Freq (MHz) =||= Data Rates (MCS) =||= TX Power (min/typ/max dBm) =||
     39|| 1MHz || 903.5 ~ 915.5 || 0,1,2,3,4,10 || 20.5 / 23.0 / 25.5 ||
     40||           ||                        || 5                  || 19.5 / 22.0 / 24.5 ||
     41||           ||                        || 6                  || 15.5 / 18.0 / 20.5 ||
     42||           ||                        || 7                  || 11.5 / 14.0 / 16.5 ||
     43||           || 916.5 ~ 926.5 || 0,1,2,3,4,10 || 19.5 / 22.0 / 24.5 ||
     44||           ||                        || 5                  || 18.5 / 21.0 / 23.5 ||
     45||           ||                        || 6                  || 15.5 / 18.0 / 20.5 ||
     46||           ||                        || 7                  || 11.5 / 14.0 / 16.5 ||
     47|| 2MHz || 905 ~ 917      || 0,1,2,3,4      || 20.5 / 22.0 / 24.5 ||
     48||           ||                        || 5                  || 19.5 / 21.0 / 23.5 ||
     49||           ||                        || 6                  || 12.5 / 18.0 / 20.5 ||
     50||           ||                        || 7                  || 11.5 / 14.0 / 16.5 ||
     51||           || 9195 ~ 925     || 0,1,2,3,4     || 19.5 / 22.0 / 24.5 ||
     52||           ||                        || 6                  || 12.5 / 15.0 / 17.5 ||
     53||           ||                        || 7                  || 11.5 / 14.0 / 16.5 ||
     54|| 4MHz || 910 ~ 922      || 0,1,2,3,4,5   || 18.5 / 21.0 / 23.5 ||
     55||           ||                        || 6                  || 12.5 / 15.0 / 17.5 ||
     56||           ||                        || 7                  || 11.5 / 14.0 / 16.5 ||
     57
     58Modulation and coding schemes (for 1 spatial stream 1/2/4MHz channels):
     59||= MCS index =||= Modulation and coding rate =||||= 1MHz (mbps) =||||= 2MHz (mbps) =||||= 4MHz (mbps) =||
     60||    || ||= long GI =||= short GI =||= long GI =||= short GI =||= long GI =||= short GI =||
     61|| 0  || BPSK 1/2     || 0.3  || 0.33 || 0.65 || 0.72 || 1.35 || 1.5  ||
     62|| 1  || QPSK 1/2     || 0.6  || 0.67 || 1.3  || 1.44 || 2.7  || 3.0  ||
     63|| 2  || QPSK 3/4     || 0.9  || 1.0  || 1.95 || 2.17 || 4.05 || 4.5  ||
     64|| 3  || 16-QAM 1/2   || 1.2  || 1.33 || 2.6  || 2.89 || 5.4  || 6.0  ||
     65|| 4  || 16-QAM 3/4   || 1.8  || 2.0  || 3.9  || 4.33 || 8.1  || 9.0  ||
     66|| 5  || 64-QAM 2/3   || 2.4  || 2.67 || 5.2  || 5.78 || 10.8 || 12.0 ||
     67|| 6  || 64-QAM 3/4   || 2.7  || 3.0  || 5.85 || 6.5  || 12.2 || 13.5 ||
     68|| 7  || 64-QAM 5/6   || 3.0  || 3.34 || 6.5  || 7.22 || 13.5 || 15.0 ||
     69|| 10 || BPSK 1/2 x 2 || 0.15 || 0.17 || -    || -    || -    || -    ||
     70 - see rate table at: https://en.wikipedia.org/wiki/IEEE_802.11ah
     71 - **these are maximum PHY data rates - actual throughput depends also on packet loss and most importantly SPI and USB bus overhead and latency which effectively reduces throughput to a max of around 3mbps.**
     72
     73
     74RF receiver specifications:
     75||= BW =||= Modulation =||= Data Rates =||= Rx Minimum Sensitivity (typ/max dBm) =||
     76|| 1MHz || BPSK         || MCS10        || -104 / -98 ||
     77||      || BPSK         || MCS0         || -102 / -95 ||
     78||      || QPSK         || MCS1         || -100 / -92 ||
     79||      || QPSK         || MCS2         || -95 / -90 ||
     80||      || 16 QAM       || MCS3         || -92 / -87 ||
     81||      || 16 QAM       || MCS4         || -88 / -83 ||
     82||      || 64 QAM       || MCS5         || -89 / -79 ||
     83||      || 64 QAM       || MCS6         || -86 / -78 ||
     84||      || 64 QAM       || MCS7         || -85 / -77 ||
     85|| 2MHz || BPSK         || MCS0         || -96 / -92 ||
     86||      || QPSK         || MCS1         || -96 / -89 ||
     87||      || QPSK         || MCS2         || -94 / -87 ||
     88||      || 16 QAM       || MCS3         || -92 / -84 ||
     89||      || 16 QAM       || MCS4         || -88 / -80 ||
     90||      || 64 QAM       || MCS5         || -84 / -76 ||
     91||      || 64 QAM       || MCS6         || -83 / -75 ||
     92||      || 64 QAM       || MCS7         || -81 / -74 ||
     93|| 4MHz || BPSK         || MCS0         || -92 / -89 ||
     94||      || QPSK         || MCS1         || -92 / -86 ||
     95||      || QPSK         || MCS2         || -92 / -84 ||
     96||      || 16 QAM       || MCS3         || -88 / -81 ||
     97||      || 16 QAM       || MCS4         || -85 / -77 ||
     98||      || 64 QAM       || MCS5         || -81 / -73 ||
     99||      || 64 QAM       || MCS6         || -80 / -72 ||
     100||      || 64 QAM       || MCS7         || -78 / -71 ||
     101
     102
     103Channel Mapping (US):
     104 - The SX-NEWAH Channel Mapping application note from Silex states the frequency range is 903.5 MHz to 926.5 MHz supporting channel widths of 1MHz, 2MHz, or 4MHz. The channel map (differs a bit from Newracom's info due to US) is:
     105 - 1 MHz Wide channel mappings:
     106||= Wi-Fi channel setting =||= Sub 1 GHz frequency [MHz] =||
     107|| 3 || 903.5 ||
     108|| 5 || 904.5 ||
     109|| 7 || 905.5 ||
     110|| 9 || 906.5 ||
     111|| 11 || 907.5 ||
     112|| 36 || 908.5 ||
     113|| 37 || 909.5 ||
     114|| 38 || 910.5 ||
     115|| 39 || 911.5 ||
     116|| 40 || 912.5 ||
     117|| 41 || 913.5 ||
     118|| 42 || 914.5 ||
     119|| 43 || 915.5 ||
     120|| 44 || 916.5 ||
     121|| 45 || 917.5 ||
     122|| 46 || 918.5 ||
     123|| 47 || 919.5 ||
     124|| 48 || 920.5 ||
     125|| 149 || 921.5 ||
     126|| 150 || 922.5 ||
     127|| 151 || 923.5 ||
     128|| 152 || 924.5 ||
     129|| 100 ^^^1^^^ || 925.5 ||
     130|| 104 ^^^1^^^ || 926.5 ||
     131  1. use of these channels is not recommended as these are Clear Access Channels (CAC) which when used will takea  full 60 seconds before they are operational
     132 - 2 MHz Wide channel mappings:
     133||= Wi-Fi channel setting =||= Sub 1 GHz frequency [MHz] =||
     134|| 6 || 905 ||
     135|| 10 || 907 ||
     136|| 153 || 909 ||
     137|| 154 || 911 ||
     138|| 155 || 913 ||
     139|| 156 || 915 ||
     140|| 157 || 917 ||
     141|| 158 || 919 ||
     142|| 159 || 921 ||
     143|| 160 || 923 ||
     144|| 161 || 925 ||
     145- 4 MHz Wide channel mappings:
     146||= Wi-Fi channel setting =||= Sub 1 GHz frequency [MHz] ||
     147|| 162 || 910 ||
     148|| 163 || 914 ||
     149|| 164 || 918 ||
     150|| 165 || 922 ||
     151
     152== Documentation
     153There are a number of documents in the Newracom nrc7292 driver repository which may prove useful:
     154 * [https://github.com/Gateworks/nrc7292/blob/master/package/host/doc/AN-7292-002-Dynamic%20Vendor%20IE.pdf AN-7292-002-Dynamic Vendor IE.pdf]
     155 * [https://github.com/Gateworks/nrc7292/blob/master/package/host/doc/AN-7292-007-11s_mesh_network.pdf AN-7292-007-11s_mesh_network.pdf]
     156 * [https://github.com/Gateworks/nrc7292/blob/master/package/host/doc/UG-7292-002-Host%20driver%20porting.pdf UG-7292-002-Host%20driver%20porting.pdf]
     157 * [https://github.com/Gateworks/nrc7292/blob/master/package/host/doc/UG-7292-007-Commnad%20line%20application.pdf UG-7292-007-Commnad%20line%20application.pdf]
     158 * [https://github.com/Gateworks/nrc7292/blob/master/package/host/doc/UG-7292-011-NewraPeek.pdf UG-7292-011-NewraPeek.pdf]
     159 * [https://github.com/Gateworks/nrc7292/blob/master/package/host/doc/UG-7292-015-Transmit_Power_Control.pdf UG-7292-015-Transmit_Power_Control.pdf]
     160  - Note that some of these documents are heavily tailored to the Newracom NRC7292 EVK which may differ in some ways to the GW16146
     161
     162Other references:
     163 * [https://www.silextechnology.com/connectivity-solutions/embedded-wireless/sx-newah Silex SX-NEWAH product page] - contains various specs and documents
     164 * https://en.wikipedia.org/wiki/IEEE_802.11ah
     165
     166== Software
     167Software support consists of the following items:
     168 - Linux kernel driver for FT232H as a USB to SPI bridge
     169 - Linux kernel driver for the NRC7292 SPI Radio chip
     170 - Firmware files required for NRC7292 driver in /lib/firmware: nrc7292_cspi.bin and nrc7292_bd.dat
     171 - Userspace cli_app application to performing miscellaneous configuration via Netlink to the NRC7292 driver
     172
     173The above software support is present in the following:
     174 - Venice Ubuntu Focal (20.04) pre-built images
     175 - Newport Ubuntu Focal (20.04) pre-built images
     176
     177[=#spi_ft232h]
     178=== FT232H USB to SPI bridge
     179The FT232H features an multi-protocol engine that can be used for UART, JTAG, SPI among perhaps other things.
     180
     181Gateworks has programmed the USB VID:PID to 0x2beb:0x0146 which binds to the out-of-tree Linux kernel [https://github.com/Gateworks/ftdi-usb-spi spi-ft232h driver].
     182
     183When a GW16146 is found on the USB bus a SPI master host controller will be registered with the Linux kernel which you can see in /sys/class/spi_master. Note that various SoC's used for Gateworks boards also have built-in SPI controllers so you will need to look at the directory in /sys/class/spi_master to see what drivers each spi controller is bound to to find the right one.
     184
     185Examples:
     186 * show spi master controllers
     187{{{#!bash
     188# ls /sys/class/spi_master/
     189spi1  spi3
     190}}}
     191 * show drivers providing each master:
     192{{{#!bash
     193# ls -l /sys/class/spi_master/
     194total 0
     195lrwxrwxrwx 1 root root 0 Aug 27 17:59 spi1 -> ../../devices/platform/soc@0/soc@0:bus@30800000/30830000.spi/spi_master/spi1
     196lrwxrwxrwx 1 root root 0 Aug 27 17:59 spi3 -> ../../devices/platform/soc@0/soc@0:bus@32c00000/32e50000.usb/ci_hdrc.1/usb2/2-1/2-1.3/2-1.3:1.0/spi-ft232h.0/spi_master/spi3
     197
     198# for i in $(ls /sys/class/spi_master/); do echo $i:$(basename $(readlink /sys/class/spi_master/$i/device)); done
     199spi1:30830000.spi
     200spi3:spi-ft232h.0
     201}}}
     202 * find spi master bound to spi-ft232h:
     203{{{#!bash
     204# for i in $(ls /sys/class/spi_master/); do if [ "$(basename $(readlink /sys/class/spi_master/$i/device))" == "spi-ft232h.0" ]; then echo $i; fi; done
     205spi3
     206}}}
     207 * assign the bus number of the first spi-ft232h bus to a var:
     208{{{#!bash
     209# BUSNO=$(for i in $(ls /sys/class/spi_master/); do if [ "$(basename $(readlink /sys/class/spi_master/$i/device))" == "spi-ft232h.0" ]; then echo $i | sed 's/[^0-9]*//g'; fi; done)
     210# echo $BUSNO
     2113
     212}}}
     213
     214Note that the SPI bus frequency can range from 450KHz to 30Mhz in 30MHz/n divisions where n is 1 to 65535 thus 30, 15, 10, 7.5, 6, 3.75MHz and so on. Invalid values will round up to the next highest freq. The frequency will be requested from the nrc.ko driver via the hifspeed kernel param (see below)
     215
     216Building:
     217 - The driver compiles a single module 'spi-ft232h.ko' and can be built out-of-tree by assigning KDIR to the directory of your kernel:
     218{{{#!bash
     219KDIR=/usr/src/venice/bsp/linux make
     220}}}
     221
     222
     223[=#nrc7292]
     224=== NRC7292 kernel driver
     225The Silex SX-NEWAH module on the GW16146 has a Newracom NRC7292 and thus is mostly supported by Newracom's open-source driver. However, the Newracom driver assumes a SoC GPIO is used for SPI IRQ and in the case of the GW16146 this does not exist. Therefore a SPI polling feature was added to the driver therefore Gateworks has its own [https://github.com/Gateworks/nrc7292 nrc7292] driver.
     226
     227There is a large set of kernel params (which you can see via 'modinfo nrc.ko')  but for our purposes the following are needed:
     228 * fw_name - firmware file from /lib/firmware
     229 * bd_name - Board data file from /lib/firmware
     230 * hifspeed - port speed in MHz (recommend 30000000 for 30MHz; available frequencies are 450KHz to 30Mhz in 30MHz/n divisions where n is 1 to 65535 thus 30, 15, 10, 7.5, 6, 3.75MHz and so on. Invalid values will round up to the next highest freq)
     231 * spi_bus_num - SPI bus number (find this dynamically from /sys/class/spi_master)
     232 * spi_cs_num - SPI chip select (must be 0 for FTDI USB_SPI bridge)
     233 * spi_polling_interval - SPI polling interval in ms (recommend 5ms)
     234
     235You must determine the SPI bus at runtime which can be done via:
     236{{{#!bash
     237# BUSNO=$(for i in $(ls /sys/class/spi_master/); do if [ "$(basename $(readlink /sys/class/spi_master/$i/device))" == "spi-ft232h.0" ]; then echo $i | sed 's/[^0-9]*//g'; fi; done)
     238# echo $BUSNO
     239}}}
     240
     241Now the module can be loaded as such:
     242{{{#!bash
     243# modprobe nrc fw_name=nrc7292_cspi.bin bd_name=nrc7292_bd.dat spi_bus_num=$BUSNO spi_polling_interval=5 hifspeed=30000000
     244}}}
     245
     246After several seconds due to the timing of firmware loading you should see a new wlan device under /sys/class/net. To find the correct wlan interface that is bound to the NRC7292 driver:
     247{{{#!bash
     248# WLAN="$(for i in $(ls -d /sys/class/net/wlan* 2>/dev/null); do if [ "$(basename $(readlink $i/device))" == "nrc80211" ]; then basename $i; fi; done)"
     249# echo $WLAN
     250wlan0
     251}}}
     252
     253After bringing up the interface you can perform more configuration on it via the 'cli_app' (see below)
     254{{{#!bash
     255ifconfig $WLAN up
     256}}}
     257
     258
     259Building:
     260 - The driver compiles a single module 'nrc.ko' and can be built out-of-tree by assigning KDIR to the directory of your kernel:
     261{{{#!bash
     262KDIR=/usr/src/venice/bsp/linux make
     263}}}
     264 - kernel requirements: CONFIG_CRYPTO_CCM, CONFIG_CRYPTO_GCM, CONFIG_CRYPTO_SEQIV, CONFIG_CRYPTO_CBC, CONFIG_CRYPTO_CTR, CONFIG_CRYPTO_ECB, CONFIG_CRYPTO_AES
     265
     266[=#cli_app]
     267=== cli_app
     268There is a 'cli_app' that is part of the driver code which communicates with the driver via the Netlink generic socket family API. Netlink is a Linux kernel interface used for inter-process communication between kernel and userspace similar to unix domain sockets designed for transferring miscellaneous networking information between kernel space and userspace processes. See https://en.wikipedia.org/wiki/Netlink for details.
     269
     270The cli_app facilitates setting misc details that are not handled via iw. The app can be used in interactive mode by running without args or by sending commands.
     271
     272Example usage showing useful features:
     273 * interactive mode
     274{{{#!bash
     275# ./cli_app
     276===================================================
     277     Newracom Command Line Application (2.4)     
     278===================================================
     279NRC> help
     280===================================================================================================
     281 help                                                   :show CLI tree
     282 exit                                                   :exit program
     283 show version                                           :show version
     284 show config [vif_id]                                   :show configuration
     285 show edca                                              :show EDCA parameters
     286 show uinfo [vif_id]                                    :show UMAC information
     287 show ampdu [clear]                                     :show/clear AMPDU count
     288 show signal [start|stop] [interval] [number]           :show rssi/snr
     289 show maxagg                                            :show max aggregation
     290 show duty                                              :show duty cycle
     291 show autotxgain                                        :show autotxgain
     292 show cal_use                                           :show cal_use
     293 show bdf_use                                           :show board data use
     294 show recovery stats                                    :show recovery
     295 show detection stats                                   :show detection
     296 show temp                                              :show temp
     297 show wakeup_pin                                        :show wakeup pin configuration
     298 show wakeup_source                                     :show wakeup source configuration
     299 show stats simple_rx                                   :show received packet information
     300 show mac clear                                         :clear TX/RX Statistics
     301 show mac tx stats                                      :show TX Statistics
     302 show mac tx clear                                      :clear TX Statistics
     303 show mac rx stats                                      :show RX Statistics
     304 show mac rx clear                                      :clear RX Statistics
     305 set gi <short|long|auto>                               :set guard interval
     306 set maxagg <AC(0-3)> <Max(0-13,0:off)> {size:default=0}:set aggregation
     307 set config <ack[0,1]> <agg[0,1]> <mcs>                 :set ack, aggregation, mcs
     308 set rc <on|off> [vif_id] [mode]                        :set rate control
     309 set duty <on|off> {duty window} {tx duration} {exclude mgmt[0|1]}:set duty cycle
     310 set cal_use <on|off>                                   :set cal_use
     311 set bdf_use <on|off>                                   :set board data use
     312 set txpwr <value(1~30)>                                :set txpwrt
     313 set wakeup_pin {Debounce:on|off} {PIN Number:0~31}     :set wakeup pin for deepsleep
     314 set wakeup_soruce rtc gpio hspi                        :set wakeup source for deepsleep
     315 set addba [tid] {mac address}                          :set addba tid / send addba with mac address
     316 set delba [tid] {mac address}                          :set delba tid / send delba with mac address
     317 set rts <on|off|default> <threshold> <vif_id>          :set rts on/off
     318 test mcs <mcs value>                                   :set mcs
     319 test country JP <CS time> <Blank time> or <show>       :set/show tx time control for JP(Japan)
     320===================================================================================================
     321OK
     322NRC> exit
     323===================================================
     324      Exit Newracom Command Line Application     
     325===================================================
     326}}}
     327 * show software/hardware version info:
     328{{{#!bash
     329# ./cli_app show version
     330Newracom Firmware Version        : 01.03.03
     331gerrit/master                    : c977f
     332Board Revision                   : 7292A
     333OK
     334}}}
     335 * set use of board data for tx power levels and calibration:
     336{{{#!bash
     337# ./cli_app set bdf_use on
     338Board Data use                   : on
     339OK
     340}}}
     341 * enable A-MPDU (frame aggregation):
     342{{{#!bash
     343# ./cli_app set maxagg 1 8
     344-------------------------------- updated aggregation ----------------------------------
     345AC       : BK           State    : OFF          Value    : 8            Size    : 0
     346AC       : BE           State    : ON           Value    : 8            Size    : 0
     347AC       : VI           State    : OFF          Value    : 8            Size    : 0
     348AC       : VO           State    : OFF          Value    : 8            Size    : 0
     349---------------------------------------------------------------------------------------
     350OK
     351root@focal-venice-sta:~# ./cli_app set maxagg 1 on
     352-------------------------------- updated aggregation ----------------------------------
     353AC       : BK           State    : OFF          Value    : 8            Size    : 0
     354AC       : BE           State    : ON           Value    : 8            Size    : 0
     355AC       : VI           State    : OFF          Value    : 8            Size    : 0
     356AC       : VO           State    : OFF          Value    : 8            Size    : 0
     357---------------------------------------------------------------------------------------
     358OK
     359}}}
     360 * set guard band interval to long (or short if you wish)
     361{{{#!bash
     362# ./cli_app set gi long
     363guard interval : long
     364OK
     365}}}
     366 * enable RF calibration:
     367{{{#!bash
     368# ./cli_app set cal_use on
     369Calibration_use : on                    Country  : US
     370OK
     371}}}
     372
     373For more info see [https://github.com/Gateworks/nrc7292/blob/master/package/host/doc/UG-7292-007-Commnad%20line%20application.pdf UG-7292-007-Command line application.pdf]
     374
     375Note that the interface needs to be up.
     376
     377
     378[=#examples]
     379=== Configuration and Usage examples
     3801. Loading drivers:
     381 a. lsusb shows GW16046 on bus with VID:0x2beb and PID=0x0146
     382{{{#!bash
     383# lsusb -d 0x2beb:0x0146
     384Bus 001 Device 003: ID 2beb:0146 
     385}}}
     386 b. Obtain the SPI bus number created by the spi-ft232h driver which has bound to the GW16046 via VID/PID (Note that we save this in the BUSNO env variable which will be used below)
     387{{{#!bash
     388# BUSNO="$(for i in $(ls /sys/class/spi_master/); do if [ "$(basename $(readlink /sys/class/spi_master/$i/device))" == "spi-ft232h.0" ]; then echo $i | sed 's/[^0-9]*//g'; fi; done)"
     389# echo $BUSNO
     3903
     391}}}
     392 c. Load the NRC7292 driver providing the SPI bus number from above (we use the BUSNO env var here):
     393{{{#!bash
     394# modprobe nrc fw_name=nrc7292_cspi.bin bd_name=nrc7292_bd.dat spi_bus_num=$BUSNO spi_polling_interval=5 hifspeed=30000000
     395}}}
     396  - after several seconds you should see a new wlan device under /sys/class/net
     397 d. obtain the wlan device that is bound to the driver (note it takes several seconds after loading the driver module for the device to get registered due to firmware loading and timing) (Note that we save this in the WLAN env variable which will be used below)
     398{{{#!bash
     399# WLAN="$(for i in $(ls -d /sys/class/net/wlan* 2>/dev/null); do if [ "$(basename $(readlink $i/device))" == "nrc80211" ]; then basename $i; fi; done)"
     400# echo $WLAN
     401wlan0
     402}}}
     403 e. bring up the interface (required for configuration below)
     404{{{#!bash
     405# ifconfig $WLAN up
     406}}}
     407
     4082. Configure miscellaneous parameters via cli_app Netlink tool
     409 * enable transmission power controL (TPC)
     410{{{#!bash
     411# cli_app set bdf_use on # enable transmission power control (TPC)
     412Board Data use                   : on
     413OK
     414}}}
     415 * configure frame aggregation
     416{{{#!bash
     417# cli_app set maxagg 1 8 # configure frame aggregation
     418-------------------------------- updated aggregation ----------------------------------
     419AC       : BK           State    : OFF          Value    : 8            Size    : 0
     420AC       : BE           State    : OFF          Value    : 8            Size    : 0
     421AC       : VI           State    : OFF          Value    : 8            Size    : 0
     422AC       : VO           State    : OFF          Value    : 8            Size    : 0
     423---------------------------------------------------------------------------------------
     424OK
     425# cli_app set maxagg 1 on # enable frame aggregation
     426-------------------------------- updated aggregation ----------------------------------
     427AC       : BK           State    : OFF          Value    : 8            Size    : 0
     428AC       : BE           State    : ON           Value    : 8            Size    : 0
     429AC       : VI           State    : OFF          Value    : 8            Size    : 0
     430AC       : VO           State    : OFF          Value    : 8            Size    : 0
     431---------------------------------------------------------------------------------------
     432OK
     433}}}
     434  - The Access Category (BK/BE/VI/VO) are based on ToS field in an IP header:
     435   * BK: 0x20, 0x28, 0x38, 0x48, 0x58
     436   * BE: 0x00, 0x60, 0x70
     437   * VI: 0x88, 0x90, 0x98, 0xa0, 0xb8
     438   * VO: 0xc0, 0xe0
     439 * configure guard band interval
     440{{{#!bash
     441# cli_app set gi long # set long guard interval
     442guard interval : long
     443OK
     444}}}
     445 * configure power calibration
     446{{{#!bash
     447# cli_app set cal_use on # enable power calibration
     448Calibration_use : on                    Country  : US
     449OK
     450}}}
     451 - for the Command Line App usage details see [https://github.com/Gateworks/nrc7292/blob/master/package/host/doc/UG-7292-007-Commnad%20line%20application.pdf UG-7292-007-Command Line Application.pdf]
     452
     4533. Configure AP or STA mode:
     454 * Define your channel and SSID via env variables (used in scripts below)
     455{{{#!bash
     456SSID=halow_demo
     457CH=161
     458PSK=12345678
     459}}}
     460  - For Channel mapping details see: [https://github.com/Gateworks/nrc7292/blob/master/package/host/doc/UG-7292-003-S1G_Channel.pdf UG-7292-003-S1G_Channel.pdf]
     461 * Open security model:
     462  - AP (using WLAN/SSID/CH env variables)
     463{{{#!bash
     464# apt install hostapd # make sure hostapd is installed
     465# /etc/init.d/hostapd stop # make sure its not running
     466# cat << EOF > /tmp/hostapd.conf
     467ctrl_interface=/var/run/hostapd
     468country_code=US
     469interface=$WLAN
     470ssid=$SSID
     471hw_mode=a
     472channel=$CH
     473ieee80211h=1
     474ieee80211d=1
     475ieee80211n=1
     476macaddr_acl=0
     477driver=nl80211
     478beacon_int=100
     479ap_max_inactivity=16780
     480EOF
     481# hostapd /tmp/hostapd.conf &
     482[1] 1006
     483Configuration file: /tmp/hostapd.conf
     484rfkill: Cannot open RFKILL control device
     485wlan0: interface state UNINITIALIZED->COUNTRY_UPDATE
     486Using interface wlan0 with hwaddr 84:25:3f:87:fc:b6 and ssid "halow_demo"
     487wlan0: interface state COUNTRY_UPDATE->ENABLED
     488wlan0: AP-ENABLED
     489}}}
     490  - STA (using WLAN/SSID env variables)
     491{{{#!bash
     492# cat << EOF > /tmp/wpa_supplicant.conf
     493ctrl_interface=/var/run/wpa_supplicant
     494
     495country=US
     496network={
     497    ssid="$SSID"
     498    scan_ssid=1
     499    key_mgmt=NONE
     500    freq_list=2412 2422 2432 2442 2452 2462 5180 5185 5190 5195 5200 5205 5210 5215 5220 5225 5230 5235 5240 5745 5750 5755 5760 5500 5520 5540 2417 2437 2457 5765 5770 5775 5780 5785 5790 5795 5800 5805 5560 2447 5810 5815 5820 5825 5580
     501    scan_freq=2412 2422 2432 2442 2452 2462 5180 5185 5190 5195 5200 5205 5210 5215 5220 5225 5230 5235 5240 5745 5750 5755 5760 5500 5520 5540 2417 2437 2457 5765 5770 5775 5780 5785 5790 5795 5800 5805 5560 2447 5810 5815 5820 5825 5580
     502}
     503
     504p2p_disabled=1
     505EOF
     506# wpa_supplicant -i $WLAN -c /tmp/wpa_supplicant.conf &
     507}}}
     508 * WPA2-PSK security
     509  - AP (using WLAN/SSID/CH/PSK env variables)
     510{{{#!bash
     511# cat << EOF > /tmp/hostapd.conf
     512ctrl_interface=/var/run/hostapd
     513country_code=US
     514interface=$WLAN
     515ssid=$SSID
     516hw_mode=a
     517channel=$CH
     518ieee80211h=1
     519ieee80211d=1
     520ieee80211n=1
     521macaddr_acl=0
     522driver=nl80211
     523beacon_int=100
     524ap_max_inactivity=16780
     525wpa=2
     526wpa_key_mgmt=WPA-PSK
     527wpa_pairwise=CCMP
     528rsn_pairwise=CCMP
     529wpa_passphrase=$PSK
     530EOF
     531# hostapd /tmp/hostapd.conf &
     532}}}
     533  - STA (using WLAN/SSID/PSK env variables)
     534{{{#!bash
     535# cat << EOF > /tmp/wpa_supplicant.conf
     536ctrl_interface=/var/run/wpa_supplicant
     537 
     538country=US
     539update_config=1
     540network={
     541    ssid="$SSID"
     542    scan_ssid=1
     543    proto=RSN
     544    key_mgmt=WPA-PSK
     545    pairwise=CCMP
     546    group=CCMP
     547    psk="$PSK"
     548    freq_list=2412 2422 2432 2442 2452 2462 5180 5185 5190 5195 5200 5205 5210 5215 5220 5225 5230 5235 5240 5745 5750 5755 5760 5500 5520 5540 2417 2437 2457 5765 5770 5775 5780 5785 5790 5795 5800 5805 5560 2447 5810 5815 5820 5825 5580
     549    scan_freq=2412 2422 2432 2442 2452 2462 5180 5185 5190 5195 5200 5205 5210 5215 5220 5225 5230 5235 5240 5745 5750 5755 5760 5500 5520 5540 2417 2437 2457 5765 5770 5775 5780 5785 5790 5795 5800 5805 5560 2447 5810 5815 5820 5825 5580
     550}
     551p2p_disabled=1
     552ignore_old_scan_res=1
     553EOF
     554# wpa_supplicant -i $WLAN -c /tmp/wpa_supplicant.conf &
     555}}}
     556 * WPA3-SEA (see https://en.wikipedia.org/wiki/Simultaneous_Authentication_of_Equals)
     557  - AP (using WLAN/SSID/PSK env variables)
     558{{{#!bash
     559# cat << EOF > /tmp/hostapd.conf
     560ctrl_interface=/var/run/hostapd
     561country_code=US
     562interface=$WLAN
     563ssid=$SSID
     564hw_mode=a
     565channel=$CH
     566ieee80211h=1
     567ieee80211d=1
     568ieee80211n=1
     569ieee80211w=2
     570macaddr_acl=0
     571driver=nl80211
     572beacon_int=100
     573ap_max_inactivity=16780
     574wpa=2
     575wpa_key_mgmt=SAE
     576wpa_pairwise=CCMP
     577rsn_pairwise=CCMP
     578wpa_passphrase=$PSK
     579EOF
     580# hostapd /tmp/hostapd.conf &
     581}}}
     582  - STA (using WLAN/SSID/PSK env variables)
     583{{{#!bash
     584# cat << EOF > /tmp/wpa_supplicant.conf
     585ctrl_interface=/var/run/wpa_supplicant
     586
     587country=US
     588update_config=1
     589network={
     590    ssid="$SSID"
     591    scan_ssid=1
     592    proto=RSN
     593    key_mgmt=SAE
     594    pairwise=CCMP
     595    group=CCMP
     596    psk="$PSK"
     597    ieee80211w=2
     598    freq_list=2412 2422 2432 2442 2452 2462 5180 5185 5190 5195 5200 5205 5210 5215 5220 5225 5230 5235 5240 5745 5750 5755 5760 5500 5520 5540 2417 2437 2457 5765 5770 5775 5780 5785 5790 5795 5800 5805 5560 2447 5810 5815 5820 5825 5580
     599    scan_freq=2412 2422 2432 2442 2452 2462 5180 5185 5190 5195 5200 5205 5210 5215 5220 5225 5230 5235 5240 5745 5750 5755 5760 5500 5520 5540 2417 2437 2457 5765 5770 5775 5780 5785 5790 5795 5800 5805 5560 2447 5810 5815 5820 5825 5580
     600}
     601p2p_disabled=1
     602ignore_old_scan_res=1
     603EOF
     604# wpa_supplicant -i $WLAN -c /tmp/wpa_supplicant.conf &
     605}}}
     606 * WPA3-OWE (see https://en.wikipedia.org/wiki/Opportunistic_Wireless_Encryption)
     607  - AP (using WLAN/SSID/PSK env variables)
     608{{{#!bash
     609# cat << EOF > /tmp/hostapd.conf
     610ctrl_interface=/var/run/hostapd
     611country_code=US
     612interface=$WLAN
     613ssid=$SSID
     614hw_mode=a
     615channel=$CH
     616ieee80211h=1
     617ieee80211d=1
     618ieee80211n=1
     619ieee80211w=2
     620macaddr_acl=0
     621driver=nl80211
     622beacon_int=100
     623ap_max_inactivity=16780
     624wpa=2
     625wpa_key_mgmt=OWE
     626wpa_pairwise=CCMP
     627rsn_pairwise=CCMP
     628EOF
     629# hostapd /tmp/hostapd.conf &
     630}}}
     631  - STA (using WLAN/SSID/PSK env variables)
     632{{{#!bash
     633# cat << EOF > /tmp/wpa_supplicant.conf
     634ctrl_interface=/var/run/wpa_supplicant
     635
     636country=US
     637update_config=1
     638pmf=2
     639network={
     640    ssid="$SSID"
     641    scan_ssid=1
     642    proto=RSN
     643    key_mgmt=OWE
     644    pairwise=CCMP
     645    group=CCMP
     646    psk="$PSK"
     647    ieee80211w=2
     648    freq_list=2412 2422 2432 2442 2452 2462 5180 5185 5190 5195 5200 5205 5210 5215 5220 5225 5230 5235 5240 5745 5750 5755 5760 5500 5520 5540 2417 2437 2457 5765 5770 5775 5780 5785 5790 5795 5800 5805 5560 2447 5810 5815 5820 5825 5580
     649    scan_freq=2412 2422 2432 2442 2452 2462 5180 5185 5190 5195 5200 5205 5210 5215 5220 5225 5230 5235 5240 5745 5750 5755 5760 5500 5520 5540 2417 2437 2457 5765 5770 5775 5780 5785 5790 5795 5800 5805 5560 2447 5810 5815 5820 5825 5580
     650}
     651p2p_disabled=1
     652ignore_old_scan_res=1
     653EOF
     654# wpa_supplicant -i $WLAN -c /tmp/wpa_supplicant.conf &
     655}}}
     656
     657
     658
     659Troubleshooting:
     6601. Ensure the device can be seen on the USB bus:
     661{{{#!bash
     662# lsusb -d 0x2beb:0x0146
     663Bus 001 Device 003: ID 2beb:0146 
     664}}}
     6651. Ensure the spi_ft232h driver is loaded
     666{{{#!bash
     667# lsmod | grep ft232
     668spi_ft232h             24576  0
     669# dmesg | grep ft232
     670[    7.555554] usbcore: registered new interface driver spi_ft232h
     671}}}
     6721. Ensure the spi_ft232h driver has registers a SPI bus:
     673{{{#!bash
     674# ls -l /sys/class/spi_master/ | grep ft232h
     675lrwxrwxrwx 1 root root 0 Aug 31 20:13 spi3 -> ../../devices/platform/soc@0/soc@0:bus@32c00000/32e50000.usb/ci_hdrc.1/usb1/1-1/1-1.3/1-1.3:1.0/spi-ft232h.0/spi_master/spi3
     676}}}