NetHubQuickBringup:修订间差异

来自Bouffalo Lab Docs
跳转到导航 跳转到搜索
张良留言 | 贡献
Sync NetHub docs from local Markdown
张良留言 | 贡献
Add more NetHubQuickBringup FAQs (2026-04-24)
 
(未显示同一用户的5个中间版本)
第1行: 第1行:
= NetHub Quick Start =
= NetHub Quick Start =


This document is for customers who are using NetHub for the first time. The goal is to help you complete device and host bring-up as quickly as possible.
This document is for customers using NetHub for the first time. The goal is to get you to the current default interface as quickly as possible.


[[文件:Nethub_sdio_quickstart_demo.gif | NetHub SDIO Quick Start Demo]]
[[文件:Nethub_sdio_quickstart_demo.gif | NetHub SDIO Quick Start Demo]]


If you only care about the currently available solution, keep these points in mind:
== 1. Current Support Matrix ==


* The current primary path is <code>SDIO</code>
{| class="wikitable"
* The device runs <code>Wi-Fi backend (fhost / wl80211) + lwIP</code>
|-
* <code>nethub</code> bridges device-side Wi-Fi capabilities to the host
! Item !! Current status
* The control channel and <code>USER virtual channel</code> both run on the same host link
|-
| Default interface || <code>SDIO</code>
|-
| USB interface || device-side backend implemented with <code>USB ECM + USB ACM</code>
|-
| SPI interface || not implemented
|-
| USER virtual channel || default interface is <code>SDIO</code>
|-
| Optional AT control solution || available, but not mandatory
|-
| Low power || currently <code>BL618DG</code> only
|}


Active directories:
Read this table literally:


* device side
* if you want the shortest successful path today, choose <code>SDIO</code>
** <code>components/net/nethub</code>
* if you are evaluating the USB interface, focus on the device-side backend and USB descriptors first
** <code>examples/wifi/nethub</code>
* do not plan on <code>SPI</code> bring-up yet
* host side
** <code>bsp/common/msg_router/linux_host/kernel</code>
** <code>bsp/common/msg_router/linux_host/userspace/nethub</code>


== 1. Confirm Two Choices Before Bring-Up ==
== 2. Main Configuration Switches ==


=== 1.1 Choose the Wi-Fi Backend ===
For most users, the main configuration changes are these:
 
Default configuration:
 
* <code>CONFIG_WL80211</code> is disabled
* <code>fhost</code> is used
 
If you want to switch to <code>wl80211</code>, enable this option in <code>examples/wifi/nethub/defconfig</code>:


<syntaxhighlight lang="makefile">
<syntaxhighlight lang="makefile">
CONFIG_WL80211=y
CONFIG_NETHUB_CTRLCHANNEL_USE_ATMODULE =y
CONFIG_NETHUB_LOWPOWER_ENABLE          =y
CONFIG_NETHUB_PROFILE_USB              =n
CONFIG_NETHUB_PROFILE_SDIO            =y
</syntaxhighlight>
</syntaxhighlight>


Notes:
Notes:


* <code>fhost</code> and <code>wl80211</code> are mutually exclusive
* the config symbol names still use <code>PROFILE</code>, but they select the active host interface
* The current <code>nethub</code> implementation supports both device-side Wi-Fi backends
* set <code>CONFIG_NETHUB_PROFILE_SDIO=y</code> for the current default interface
* set <code>CONFIG_NETHUB_PROFILE_USB=y</code> only when you want to evaluate the USB interface
* <code>CONFIG_NETHUB_CTRLCHANNEL_USE_ATMODULE=n</code> means <code>ATModule</code> will not participate in the build
* <code>CONFIG_NETHUB_LOWPOWER_ENABLE=y</code> is currently meaningful only on <code>BL618DG</code>
 
Additional current default facts in <code>examples/wifi/nethub/defconfig</code>:
 
* <code>CONFIG_MR_VIRTUALCHAN=y</code>
* <code>CONFIG_NETHUB_AT_USE_VCHAN=n</code>
* <code>CONFIG_MR_TTY=n</code>


=== 1.2 Choose the Control Channel ===
== 3. Wi-Fi Backend Selection ==


device and host settings must match:
Default configuration:


{| class="wikitable"
* <code>CONFIG_WL80211</code> disabled
|-
* <code>fhost</code> selected
! device configuration !! host startup
|-
| <code>CONFIG_NETHUB_AT_USE_VCHAN=n</code> || <code>./output/bflbwifid</code> or <code>./output/bflbwifid -c tty -p /dev/ttyAT0</code>
|-
| <code>CONFIG_NETHUB_AT_USE_VCHAN=y</code> || <code>./output/bflbwifid -c vchan</code>
|}


The default configuration is:
If you want <code>wl80211</code>, enable this in <code>examples/wifi/nethub/defconfig</code>:


<syntaxhighlight lang="makefile">
<syntaxhighlight lang="makefile">
CONFIG_NETHUB_AT_USE_VCHAN=n
CONFIG_WL80211=y
</syntaxhighlight>
</syntaxhighlight>


That means the control channel uses <code>TTY</code> by default.
Notes:


Additional notes:
* <code>fhost</code> and <code>wl80211</code> are mutually exclusive
* current NetHub supports both device-side Wi-Fi backends


* The host side always builds both <code>tty + vchan</code>
== 4. Device Build and Flash ==
* The actual selection happens at <code>bflbwifid</code> runtime


== 2. Build and Flash the Device Firmware ==
Build:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
第89行: 第97行:
</syntaxhighlight>
</syntaxhighlight>


The most relevant bring-up configuration is located in:
== 5. Hardware Interface Pins ==
 
The pin tables below are the current default mappings used by the in-tree BSP board helpers.
 
Reference sources in the repository:


* <code>examples/wifi/nethub/defconfig</code>
* <code>bsp/board/bl616dk/board_gpio.c</code>
* <code>bsp/board/bl616cldk/board_gpio.c</code>
* <code>bsp/board/bl618dgdk/board_gpio.c</code>


Common options:
=== 5.1 Default SDIO Pins ===


* <code>CONFIG_NETHUB=y</code>
These are the current <code>board_sdh_gpio_init()</code> mappings used by the BSP.
* <code>CONFIG_MR_NETDEV=y</code>
* <code>CONFIG_MR_TTY=y</code>
* <code>CONFIG_MR_VIRTUALCHAN=y</code>
* <code>CONFIG_NETHUB_AT_USE_VCHAN=n</code>


== 3. Build and Start the Host Software ==
{| class="wikitable"
|-
! Pin Function !! BL616 / BL618 (<code>bl616dk</code>) !! BL618DG (<code>bl618dgdk</code>) !! BL616CL (<code>bl616cldk</code>)
|-
| <code>SDIO_DAT2</code> || <code>GPIO10</code> || <code>GPIO43</code> || <code>GPIO6</code>
|-
| <code>SDIO_DAT3</code> || <code>GPIO11</code> || <code>GPIO44</code> || <code>GPIO7</code>
|-
| <code>SDIO_CMD</code> || <code>GPIO12</code> || <code>GPIO45</code> || <code>GPIO8</code>
|-
| <code>SDIO_CLK</code> || <code>GPIO13</code> || <code>GPIO46</code> || <code>GPIO9</code>
|-
| <code>SDIO_DAT0</code> || <code>GPIO14</code> || <code>GPIO47</code> || <code>GPIO10</code>
|-
| <code>SDIO_DAT1</code> || <code>GPIO15</code> || <code>GPIO48</code> || <code>GPIO11</code>
|}


=== 3.1 Build ===
Notes:


<syntaxhighlight lang="bash">
* this table shows the current default 4-bit SDIO wiring used by the NetHub SDIO data-path
cd bsp/common/msg_router/linux_host/userspace/nethub
* 1-line mode is also supported; if you use 1-line mode, keep <code>CMD</code>, <code>CLK</code>, and <code>DAT0</code> first
./build.sh build
* the BSP configures these pins with <code>GPIO_FUNC_SDH | GPIO_ALTERNATE | GPIO_PULLUP | GPIO_SMT_EN | GPIO_DRV_1</code>
</syntaxhighlight>


Artifacts:
=== 5.2 Default USB Pins ===


* <code>output/mr_sdio.ko</code>
The current USB interface uses the board's default USB differential pair.
* <code>output/bflbwifid</code>
* <code>output/bflbwifictrl</code>
* <code>output/libnethub_vchan.a</code>
* <code>output/nethub_vchan_app</code>


=== 3.2 Load the Kernel Module ===
{| class="wikitable"
|-
! Chip / Board family !! Default USB pins in current BSP !! Current BSP behavior !! Notes
|-
| BL616 / BL618 (<code>bl616dk</code>) || board default USB port path || current BSP enables USB clock in <code>board.c</code>, but does not expose a dedicated <code>board_usb_gpio_init()</code> helper || treat this as the board's fixed default USB routing in the current example
|-
| BL616CL (<code>bl616cldk</code>) || <code>GPIO32</code>, <code>GPIO33</code> || <code>board_usb_gpio_init()</code> configures the pair as analog pins || current BSP documents the pair, not separate <code>DP</code> / <code>DM</code> labels
|-
| BL618DG (<code>bl618dgdk</code>) || <code>GPIO40</code>, <code>GPIO41</code> || <code>board_usb_gpio_init()</code> configures the pair as analog pins || current BSP documents the pair, not separate <code>DP</code> / <code>DM</code> labels
|}


<syntaxhighlight lang="bash">
Notes:
cd bsp/common/msg_router/linux_host/userspace/nethub
sudo ./build.sh load
</syntaxhighlight>


To unload:
* for <code>BL616CL</code> and <code>BL618DG</code>, the BSP helper only tells us the USB pair used by the board, not which pin is <code>D+</code> and which pin is <code>D-</code>
* if you are wiring a custom board and need explicit <code>DP</code> / <code>DM</code> polarity, confirm it from the board schematic or chip or package documentation


<syntaxhighlight lang="bash">
== 6. Host Bring-Up Guidance ==
sudo ./build.sh unload
</syntaxhighlight>


=== 3.3 Start the Host Daemon ===
For the current in-tree host Linux stack, use:


Default TTY mode:
* <code>bsp/common/msg_router/linux_host/userspace/nethub/README.md</code>


<syntaxhighlight lang="bash">
Today that host stack follows the default <code>SDIO</code> interface.
sudo ./output/bflbwifid
</syntaxhighlight>


Explicit TTY mode:
For USB projects, keep expectations aligned with current code status:


<syntaxhighlight lang="bash">
* device-side <code>ECM + ACM</code> backend exists
sudo ./output/bflbwifid -c tty -p /dev/ttyAT0
* host-side transport flattening into the same <code>nethub_vchan</code> behavior as SDIO is not fully documented or aligned in-tree yet
</syntaxhighlight>


VCHAN mode:
== 7. USER Virtual Channel ==


<syntaxhighlight lang="bash">
If you need private application messages between host and device, read:
sudo ./output/bflbwifid -c vchan
</syntaxhighlight>


== 4. Basic Verification Flow ==
* [[NetHubVirtualChannel|NetHubVirtualChannel.md]]


Recommended sequence:
Current implementation:


=== 4.1 Check the Current Status ===
* the current in-tree end-to-end USER virtual channel follows the default <code>SDIO</code> interface
* the public device API is transport-neutral by design
* the in-tree implementation behind it is still SDIO-backed today


<syntaxhighlight lang="bash">
== 8. Low-Power Note ==
sudo ./output/bflbwifictrl status
</syntaxhighlight>


=== 4.2 Scan APs ===
Low power is currently supported only on <code>BL618DG</code>.


<syntaxhighlight lang="bash">
For other chips, <code>examples/wifi/nethub/defconfig</code> automatically turns <code>CONFIG_NETHUB_LOWPOWER_ENABLE</code> off. In practice, you normally keep this option enabled only for <code>BL618DG</code> builds.
sudo ./output/bflbwifictrl scan
</syntaxhighlight>


=== 4.3 Connect to an AP ===
== 9. Common Questions ==


<syntaxhighlight lang="bash">
=== 9.1 <code>bflbwifid</code> Fails to Start ===
sudo ./output/bflbwifictrl connect_ap "<ssid>" "<password>"
</syntaxhighlight>


=== 4.4 Check Status Again ===
This question is relevant only when you use the optional host control stack.


<syntaxhighlight lang="bash">
Check first:
sudo ./output/bflbwifictrl status
</syntaxhighlight>


If the connection succeeds, you will usually see:
* whether the device and host control backends match
* whether <code>/dev/ttyAT0</code> exists
* whether <code>mr_sdio.ko</code> has been loaded successfully
* whether the SDIO hardware link is working properly


* the backend is connected
=== 9.2 <code>connect_ap</code> Succeeds but the Host Has No Network Access ===
* the Wi-Fi state is <code>CONNECTED</code> or <code>GOTIP</code>
* <code>IP / Gateway / Netmask / DNS</code> after an address is assigned


=== 4.5 Disconnect ===
Check first:


<syntaxhighlight lang="bash">
* whether <code>status</code> has reached <code>GOTIP</code>
sudo ./output/bflbwifictrl disconnect
* whether <code>mr_eth0</code> has an address
</syntaxhighlight>
* whether services such as <code>NetworkManager</code> or <code>dhcpcd</code> override the NetHub configuration


== 5. Common Commands ==
Notes:


The public CLI surface is fixed to 9 commands:
* <code>build.sh</code> builds userspace with <code>ENABLE_NETIF_AUTO_CONFIG=1</code> by default
* after the device reports <code>GOTIP</code>, the host automatically configures the IP, gateway, and DNS of <code>mr_eth0</code>


* <code>connect_ap</code>
=== 9.3 <code>build.sh unload</code> Reports That the Module Is Busy ===
* <code>disconnect</code>
* <code>scan</code>
* <code>status</code>
* <code>version</code>
* <code>reboot</code>
* <code>ota</code>
* <code>start_ap</code>
* <code>stop_ap</code>


Examples:
Check first:


<syntaxhighlight lang="bash">
* whether <code>bflbwifid</code> is still running
sudo ./output/bflbwifictrl version
* whether <code>nethub_vchan_app</code> is still running
sudo ./output/bflbwifictrl reboot
sudo ./output/bflbwifictrl start_ap "<ssid>" "<password>"
sudo ./output/bflbwifictrl stop_ap
</syntaxhighlight>


== 6. SDIO Hardware Information ==
=== 9.4 How Do I Change the Host-Side Virtual Interface Name <code>mr_eth0</code>? ===


For the current customer bring-up path, use <code>SDIO</code> directly. <code>USB / SPI</code> still keep architecture skeletons for now and are not the recommended bring-up path.
The default host-side virtual network interface name comes from:


=== 6.1 Chip Support Matrix ===
* <code>bsp/common/msg_router/linux_host/kernel/netdev/mr_netdev.c</code>


{| class="wikitable"
The macro is:
|-
! Interface !! BL616 / BL618 !! BL618DG !! BL616CL
|-
| SDIO || Supported || Supported || Supported
|-
| USB || Planned || Planned || Planned
|-
| SPI || Planned || Planned || Planned
|}


=== 6.2 SDIO Pins ===
<syntaxhighlight lang="c">
#define ETH_DRV_NAME "mr_eth%d"
</syntaxhighlight>


{| class="wikitable"
The first created interface therefore appears as <code>mr_eth0</code>.
|-
! Pin Function !! BL616 / BL618 !! BL618DG !! BL616CL
|-
| SDIO_DAT2 || GPIO10 || GPIO43 || GPIO6
|-
| SDIO_DAT3 || GPIO11 || GPIO44 || GPIO7
|-
| SDIO_CMD || GPIO12 || GPIO45 || GPIO8
|-
| SDIO_CLK || GPIO13 || GPIO46 || GPIO9
|-
| SDIO_DATA0 || GPIO14 || GPIO47 || GPIO10
|-
| SDIO_DATA1 || GPIO15 || GPIO48 || GPIO11
|}


== 7. USER Virtual Channel ==
To change the interface name, update <code>ETH_DRV_NAME</code> to the pattern you want. For example:


If you need to transfer private messages between the host and device, use the <code>USER virtual channel</code>.
<syntaxhighlight lang="c">
#define ETH_DRV_NAME "nethub%d"
</syntaxhighlight>


Notes:
Notes:


* The <code>USER</code> channel and the control channel are parallel logical channels
* keep <code>%d</code> if you want Linux to allocate names such as <code>nethub0</code>, <code>nethub1</code>, and so on
* It is not a separate physical interface; it is a logical channel carried on the current host link
* rebuild the host software after the change and reload the host-side kernel module
* if any local scripts or service configuration still refer to <code>mr_eth0</code>, update them accordingly


=== 7.1 device-side APIs ===
=== 9.5 Can the Host Expose <code>AP</code> and <code>STA</code> at the Same Time? ===


Header:
No. Due to the current software implementation, this is not supported yet.


* <code>components/net/nethub/include/nethub_vchan.h</code>
Current behavior:


Common APIs:
* the host side exposes only one virtual interface at a time
* the default active Wi-Fi channel is <code>STA</code>


<syntaxhighlight lang="c">
If you need to switch between <code>AP</code> and <code>STA</code>, call <code>nethub_set_active_wifi_channel()</code> directly:
int nethub_vchan_user_send(const void *data, uint16_t len);
 
int nethub_vchan_user_recv_register(nethub_vchan_recv_cb_t recv_cb, void *cb_arg);
* use <code>NETHUB_CHANNEL_WIFI_AP</code> to switch to <code>AP</code>
</syntaxhighlight>
* use <code>NETHUB_CHANNEL_WIFI_STA</code> to switch to <code>STA</code>
* the default value is <code>NETHUB_CHANNEL_WIFI_STA</code>
 
=== 9.6 What Should the Host Side Handle When <code>CONFIG_NETHUB_CTRLCHANNEL_USE_ATMODULE=n</code>? ===
 
When <code>CONFIG_NETHUB_CTRLCHANNEL_USE_ATMODULE=n</code>, the optional AT-based host control solution is not part of the build.


=== 7.2 host-side APIs ===
What you need to handle yourself:


Header:
* you need your own private control path to carry required messages between host and device
* this includes, but is not limited to, host netdev link-up handling
* this also includes host-side IP address and netmask configuration


* <code>bsp/common/msg_router/linux_host/userspace/nethub/virtualchan/nethub_vchan.h</code>
In short, NetHub still provides the data-path, but the host-side control workflow becomes your own responsibility.


Common APIs:
=== 9.7 Why Does <code>ifconfig</code> Not Show the Virtual Interface? ===


<syntaxhighlight lang="c">
Check first:
int nethub_vchan_init(void);
int nethub_vchan_deinit(void);


int nethub_vchan_user_send(const void *data, size_t len);
* use a command such as <code>ifconfig -a</code> to list interfaces that are currently down
int nethub_vchan_user_register_callback(nethub_vchan_recv_callback_t callback);
* find the virtual interface and bring it up manually, for example: <code>sudo ifconfig mr_eth0 up</code>


int nethub_vchan_get_state_snapshot(nethub_vchan_state_snapshot_t *snapshot);
Notes:
</syntaxhighlight>
 
* some Linux systems, including newer Raspberry Pi OS releases, run <code>NetworkManager</code> by default
* because of that, the exact behavior depends on your host environment and may need host-specific analysis


Typical host-side usage order:
=== 9.8 For Dual-Stack Traffic, Can Users Customize the Filter? Is There Any Difference Between USB and SDIO? ===


# <code>nethub_vchan_init()</code>
Yes. The default configuration already covers most scenarios, but users can still customize the Wi-Fi RX filter if needed.
# <code>nethub_vchan_user_register_callback()</code>
# <code>nethub_vchan_user_send()</code>
# Call <code>nethub_vchan_deinit()</code> when finished


If you need to check whether the link is ready, you can optionally query:
Important points:


* <code>link_state == NETHUB_VCHAN_LINK_UP</code>
* the filter is not bound to one interface type; there is no special filter split between <code>USB</code> and <code>SDIO</code>
** the link is ready for TX/RX
* the current built-in policy is shared by both <code>SDIO</code> and <code>USB</code>
* <code>host_state == NETHUB_VCHAN_HOST_STATE_DEVICE_RUN</code>
* you can refer to <code>components/net/nethub/profile/nh_profile_sdio.c</code> and <code>components/net/nethub/profile/nh_profile_usb.c</code>; both use the same built-in Wi-Fi RX policy
** the host has completed the handshake with the device


== 8. Common Issues ==
Default built-in policy reference:


=== 8.1 <code>bflbwifid</code> Fails to Start ===
* <code>components/net/nethub/profile/nh_profile_builtin.c</code>
* <code>NH_FILTER_MATCH_8021X</code>: handled locally and not delivered to the host
* <code>NH_FILTER_MATCH_ARP</code>: handled locally and also delivered to the host
* <code>NH_FILTER_MATCH_DHCP4</code>: handled locally
* <code>NH_FILTER_MATCH_ICMP4</code>: handled locally
* other packets: delivered to the host by default


Check first:
If the default policy does not match your requirement:


* whether the device and host control backends match
* you can call <code>nethub_set_wifi_rx_filter(nethub_wifi_rx_filter_cb_t filter_cb, void *user_ctx)</code> from <code>components/net/nethub/include/nethub_filter.h</code>
* whether <code>/dev/ttyAT0</code> exists
* for the callback behavior, refer to <code>nh_filter_apply_policy()</code> in <code>components/net/nethub/core/nh_filter.c</code>
* whether <code>mr_sdio.ko</code> has been loaded successfully
* if you need a more complex policy, it is also fine to contact us directly
* whether the SDIO hardware link is working properly


=== 8.2 <code>connect_ap</code> Succeeds but the Host Has No Network Access ===
=== 9.9 Why Can the Host Not Ping Other Devices on the Same LAN? ===


Check first:
This is expected with the current default policy.


* whether <code>status</code> has reached <code>GOTIP</code>
Reason:
* whether <code>mr_eth0</code> has an address
* whether services such as <code>NetworkManager</code> or <code>dhcpcd</code> override the NetHub configuration


Notes:
* <code>ICMP</code> packets are handled locally on the device side by default
* they are not delivered to the host by default


* <code>build.sh</code> builds userspace with <code>ENABLE_NETIF_AUTO_CONFIG=1</code> by default
So, by default:
* After the device reports <code>GOTIP</code>, the host automatically configures the IP, gateway, and DNS of <code>mr_eth0</code>


=== 8.3 <code>build.sh unload</code> Reports That the Module Is Busy ===
* other LAN devices pinging the device can work
* host-side ping visibility to other LAN devices is not part of the default behavior


Check first:
== 10. Where to Go Next ==


* whether <code>bflbwifid</code> is still running
* overall entry: [[NetHub|NetHub.md]]
* whether <code>nethub_vchan_app</code> is still running
* architecture: [[NetHubArchitecture|NetHubArchitecture.md]]
* USER virtual channel: [[NetHubVirtualChannel|NetHubVirtualChannel.md]]

2026年4月24日 (五) 15:11的最新版本

NetHub Quick Start

This document is for customers using NetHub for the first time. The goal is to get you to the current default interface as quickly as possible.

NetHub SDIO Quick Start Demo

1. Current Support Matrix

Item Current status
Default interface SDIO
USB interface device-side backend implemented with USB ECM + USB ACM
SPI interface not implemented
USER virtual channel default interface is SDIO
Optional AT control solution available, but not mandatory
Low power currently BL618DG only

Read this table literally:

  • if you want the shortest successful path today, choose SDIO
  • if you are evaluating the USB interface, focus on the device-side backend and USB descriptors first
  • do not plan on SPI bring-up yet

2. Main Configuration Switches

For most users, the main configuration changes are these:

CONFIG_NETHUB_CTRLCHANNEL_USE_ATMODULE =y
CONFIG_NETHUB_LOWPOWER_ENABLE          =y
CONFIG_NETHUB_PROFILE_USB              =n
CONFIG_NETHUB_PROFILE_SDIO             =y

Notes:

  • the config symbol names still use PROFILE, but they select the active host interface
  • set CONFIG_NETHUB_PROFILE_SDIO=y for the current default interface
  • set CONFIG_NETHUB_PROFILE_USB=y only when you want to evaluate the USB interface
  • CONFIG_NETHUB_CTRLCHANNEL_USE_ATMODULE=n means ATModule will not participate in the build
  • CONFIG_NETHUB_LOWPOWER_ENABLE=y is currently meaningful only on BL618DG

Additional current default facts in examples/wifi/nethub/defconfig:

  • CONFIG_MR_VIRTUALCHAN=y
  • CONFIG_NETHUB_AT_USE_VCHAN=n
  • CONFIG_MR_TTY=n

3. Wi-Fi Backend Selection

Default configuration:

  • CONFIG_WL80211 disabled
  • fhost selected

If you want wl80211, enable this in examples/wifi/nethub/defconfig:

CONFIG_WL80211=y

Notes:

  • fhost and wl80211 are mutually exclusive
  • current NetHub supports both device-side Wi-Fi backends

4. Device Build and Flash

Build:

cd examples/wifi/nethub

# BL616
make CHIP=bl616 BOARD=bl616dk

# BL616CL
make CHIP=bl616cl BOARD=bl616cldk

# BL618DG
make CHIP=bl618dg BOARD=bl618dgdk CPU_ID=ap

Flash example:

cd examples/wifi/nethub
make flash CHIP=bl618dg COMX=/dev/ttyUSB0

5. Hardware Interface Pins

The pin tables below are the current default mappings used by the in-tree BSP board helpers.

Reference sources in the repository:

  • bsp/board/bl616dk/board_gpio.c
  • bsp/board/bl616cldk/board_gpio.c
  • bsp/board/bl618dgdk/board_gpio.c

5.1 Default SDIO Pins

These are the current board_sdh_gpio_init() mappings used by the BSP.

Pin Function BL616 / BL618 (bl616dk) BL618DG (bl618dgdk) BL616CL (bl616cldk)
SDIO_DAT2 GPIO10 GPIO43 GPIO6
SDIO_DAT3 GPIO11 GPIO44 GPIO7
SDIO_CMD GPIO12 GPIO45 GPIO8
SDIO_CLK GPIO13 GPIO46 GPIO9
SDIO_DAT0 GPIO14 GPIO47 GPIO10
SDIO_DAT1 GPIO15 GPIO48 GPIO11

Notes:

  • this table shows the current default 4-bit SDIO wiring used by the NetHub SDIO data-path
  • 1-line mode is also supported; if you use 1-line mode, keep CMD, CLK, and DAT0 first
  • the BSP configures these pins with GPIO_FUNC_SDH | GPIO_ALTERNATE | GPIO_PULLUP | GPIO_SMT_EN | GPIO_DRV_1

5.2 Default USB Pins

The current USB interface uses the board's default USB differential pair.

Chip / Board family Default USB pins in current BSP Current BSP behavior Notes
BL616 / BL618 (bl616dk) board default USB port path current BSP enables USB clock in board.c, but does not expose a dedicated board_usb_gpio_init() helper treat this as the board's fixed default USB routing in the current example
BL616CL (bl616cldk) GPIO32, GPIO33 board_usb_gpio_init() configures the pair as analog pins current BSP documents the pair, not separate DP / DM labels
BL618DG (bl618dgdk) GPIO40, GPIO41 board_usb_gpio_init() configures the pair as analog pins current BSP documents the pair, not separate DP / DM labels

Notes:

  • for BL616CL and BL618DG, the BSP helper only tells us the USB pair used by the board, not which pin is D+ and which pin is D-
  • if you are wiring a custom board and need explicit DP / DM polarity, confirm it from the board schematic or chip or package documentation

6. Host Bring-Up Guidance

For the current in-tree host Linux stack, use:

  • bsp/common/msg_router/linux_host/userspace/nethub/README.md

Today that host stack follows the default SDIO interface.

For USB projects, keep expectations aligned with current code status:

  • device-side ECM + ACM backend exists
  • host-side transport flattening into the same nethub_vchan behavior as SDIO is not fully documented or aligned in-tree yet

7. USER Virtual Channel

If you need private application messages between host and device, read:

Current implementation:

  • the current in-tree end-to-end USER virtual channel follows the default SDIO interface
  • the public device API is transport-neutral by design
  • the in-tree implementation behind it is still SDIO-backed today

8. Low-Power Note

Low power is currently supported only on BL618DG.

For other chips, examples/wifi/nethub/defconfig automatically turns CONFIG_NETHUB_LOWPOWER_ENABLE off. In practice, you normally keep this option enabled only for BL618DG builds.

9. Common Questions

9.1 bflbwifid Fails to Start

This question is relevant only when you use the optional host control stack.

Check first:

  • whether the device and host control backends match
  • whether /dev/ttyAT0 exists
  • whether mr_sdio.ko has been loaded successfully
  • whether the SDIO hardware link is working properly

9.2 connect_ap Succeeds but the Host Has No Network Access

Check first:

  • whether status has reached GOTIP
  • whether mr_eth0 has an address
  • whether services such as NetworkManager or dhcpcd override the NetHub configuration

Notes:

  • build.sh builds userspace with ENABLE_NETIF_AUTO_CONFIG=1 by default
  • after the device reports GOTIP, the host automatically configures the IP, gateway, and DNS of mr_eth0

9.3 build.sh unload Reports That the Module Is Busy

Check first:

  • whether bflbwifid is still running
  • whether nethub_vchan_app is still running

9.4 How Do I Change the Host-Side Virtual Interface Name mr_eth0?

The default host-side virtual network interface name comes from:

  • bsp/common/msg_router/linux_host/kernel/netdev/mr_netdev.c

The macro is:

#define ETH_DRV_NAME "mr_eth%d"

The first created interface therefore appears as mr_eth0.

To change the interface name, update ETH_DRV_NAME to the pattern you want. For example:

#define ETH_DRV_NAME "nethub%d"

Notes:

  • keep %d if you want Linux to allocate names such as nethub0, nethub1, and so on
  • rebuild the host software after the change and reload the host-side kernel module
  • if any local scripts or service configuration still refer to mr_eth0, update them accordingly

9.5 Can the Host Expose AP and STA at the Same Time?

No. Due to the current software implementation, this is not supported yet.

Current behavior:

  • the host side exposes only one virtual interface at a time
  • the default active Wi-Fi channel is STA

If you need to switch between AP and STA, call nethub_set_active_wifi_channel() directly:

  • use NETHUB_CHANNEL_WIFI_AP to switch to AP
  • use NETHUB_CHANNEL_WIFI_STA to switch to STA
  • the default value is NETHUB_CHANNEL_WIFI_STA

9.6 What Should the Host Side Handle When CONFIG_NETHUB_CTRLCHANNEL_USE_ATMODULE=n?

When CONFIG_NETHUB_CTRLCHANNEL_USE_ATMODULE=n, the optional AT-based host control solution is not part of the build.

What you need to handle yourself:

  • you need your own private control path to carry required messages between host and device
  • this includes, but is not limited to, host netdev link-up handling
  • this also includes host-side IP address and netmask configuration

In short, NetHub still provides the data-path, but the host-side control workflow becomes your own responsibility.

9.7 Why Does ifconfig Not Show the Virtual Interface?

Check first:

  • use a command such as ifconfig -a to list interfaces that are currently down
  • find the virtual interface and bring it up manually, for example: sudo ifconfig mr_eth0 up

Notes:

  • some Linux systems, including newer Raspberry Pi OS releases, run NetworkManager by default
  • because of that, the exact behavior depends on your host environment and may need host-specific analysis

9.8 For Dual-Stack Traffic, Can Users Customize the Filter? Is There Any Difference Between USB and SDIO?

Yes. The default configuration already covers most scenarios, but users can still customize the Wi-Fi RX filter if needed.

Important points:

  • the filter is not bound to one interface type; there is no special filter split between USB and SDIO
  • the current built-in policy is shared by both SDIO and USB
  • you can refer to components/net/nethub/profile/nh_profile_sdio.c and components/net/nethub/profile/nh_profile_usb.c; both use the same built-in Wi-Fi RX policy

Default built-in policy reference:

  • components/net/nethub/profile/nh_profile_builtin.c
  • NH_FILTER_MATCH_8021X: handled locally and not delivered to the host
  • NH_FILTER_MATCH_ARP: handled locally and also delivered to the host
  • NH_FILTER_MATCH_DHCP4: handled locally
  • NH_FILTER_MATCH_ICMP4: handled locally
  • other packets: delivered to the host by default

If the default policy does not match your requirement:

  • you can call nethub_set_wifi_rx_filter(nethub_wifi_rx_filter_cb_t filter_cb, void *user_ctx) from components/net/nethub/include/nethub_filter.h
  • for the callback behavior, refer to nh_filter_apply_policy() in components/net/nethub/core/nh_filter.c
  • if you need a more complex policy, it is also fine to contact us directly

9.9 Why Can the Host Not Ping Other Devices on the Same LAN?

This is expected with the current default policy.

Reason:

  • ICMP packets are handled locally on the device side by default
  • they are not delivered to the host by default

So, by default:

  • other LAN devices pinging the device can work
  • host-side ping visibility to other LAN devices is not part of the default behavior

10. Where to Go Next