This document explains how to enable and test Bluetooth 6LoWPAN (IPv6 over Low-power Wireless Personal Area Networks) in the i.MX Linux BSP.
An Embedded Artists 2EL M.2 module with the Murata LBES5PL2EL module (containing NXP IW612) is inserted into the i.MX 93 EVK's M.2 slot and connected to the onboard Wi-Fi/BT antenna.
One i.MX 93 EVK will serve as the Peripheral device, while the other will act as the Central device.
It should also work with i.MX 8 and 9 series evaluation kit equipped with Bluetooth LE modules.
Although the Linux kernel includes a Bluetooth 6LoWPAN driver, it is disabled in the i.MX Linux BSP. Therefore, we will modify the kernel configuration to enable it.
Add 2 settings below in kernel configuration file (imx_v8_defconfig) to build the required drivers as modules:
CONFIG_6LOWPAN=m
CONFIG_BT_6LOWPAN=m
These settings can be found in the following section of the Linux kernel menuconfig.
CONFIG_6LOWPAN:
Depends on: NET [=y] && IPV6 [=y]
Location:
-> Networking support (NET [=y])
-> Networking options
-> 6LoWPAN Support (6LOWPAN [=m])
CONFIG_6LOWPAN
CONFIG_BT_6LOWPAN:
Depends on: NET [=y] && BT_LE [=y] && 6LOWPAN [=y]
Location:
-> Networking support (NET [=y])
-> Bluetooth subsystem support (BT [=y])
-> Bluetooth Low Energy (LE) features (BT_LE [=y])
-> Bluetooth 6LoWPAN support (BT_6LOWPAN [=m])
Rebuild the image containing the Linux kernel and make sure that the required drivers are present in the following paths.
/lib/modules/6.6.52-ge0f9e2afd4cf-dirty/kernel/net/6lowpan/6lowpan.ko
/lib/modules/6.6.52-ge0f9e2afd4cf-dirty/kernel/net/bluetooth/bluetooth_6lowpan.ko
Boot the Peripheral device EVK and log in as the root user.
NXP i.MX Release Distro 6.6-scarthgap imx93-11x11-lpddr4x-evk ttyLP0
imx93-11x11-lpddr4x-evk login: root
Load the NXP Bluetooth UART driver to enable Bluetooth.
# modprobe btnxpuart
Start the Bluetooth hci0 interface with the hciconfig command.
# hciconfig hci0 up
Type hciconfig command to check the BD Address of the Bluetooth hci0 interface and confirm that its status is "UP RUNNING".
# hciconfig -a
hci0: Type: Primary Bus: UART
BD Address: D0:17:69:12:34:56 ACL MTU: 1021:7 SCO MTU: 120:6
UP RUNNING
RX bytes:862 acl:0 sco:0 events:59 errors:0
TX bytes:1085 acl:0 sco:0 commands:58 errors:0
Features: 0xbf 0xfe 0x8f 0xfe 0xdb 0xff 0x7b 0x87
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH SNIFF
Link mode: PERIPHERAL ACCEPT
Name: 'imx93-11x11-lpddr4x-evk'
Class: 0x200000
Service Classes: Audio
Device Class: Miscellaneous,
HCI Version: 5.4 (0xd) Revision: 0x8300
LMP Version: 5.4 (0xd) Subversion: 0x1015
Manufacturer: NXP Semiconductors (formerly Philips Semiconductors) (37)
Load the Bluetooth 6LoWPAN driver.
# modprobe bluetooth_6lowpan
Enable Bluetooth 6LoWPAN.
# echo 1 > /sys/kernel/debug/bluetooth/6lowpan_enable
Start Bluetooth advertising and waits for a connection request from the Central device.
# bluetoothctl advertise on
Boot the Central device EVK and log in as the root user.
NXP i.MX Release Distro 6.6-scarthgap imx93-11x11-lpddr4x-evk ttyLP0
imx93-11x11-lpddr4x-evk login: root
Load the NXP Bluetooth UART driver to enable Bluetooth.
# modprobe btnxpuart
Start the Bluetooth hci0 interface with the hciconfig command.
# hciconfig hci0 up
Type hciconfig command to check the BD Address of the Bluetooth hci0 interface and confirm that its status is "UP RUNNING".
# hciconfig -a
hci0: Type: Primary Bus: UART
BD Address: D0:17:69:AB:CD:EF ACL MTU: 1021:7 SCO MTU: 120:6
UP RUNNING
RX bytes:862 acl:0 sco:0 events:59 errors:0
TX bytes:1085 acl:0 sco:0 commands:58 errors:0
Features: 0xbf 0xfe 0x8f 0xfe 0xdb 0xff 0x7b 0x87
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH SNIFF
Link mode: PERIPHERAL ACCEPT
Name: 'imx93-11x11-lpddr4x-evk'
Class: 0x200000
Service Classes: Audio
Device Class: Miscellaneous,
HCI Version: 5.4 (0xd) Revision: 0x8300
LMP Version: 5.4 (0xd) Subversion: 0x1015
Manufacturer: NXP Semiconductors (formerly Philips Semiconductors) (37)
Load the Bluetooth 6LoWPAN driver.
# modprobe bluetooth_6lowpan
Enable Bluetooth 6LoWPAN.
# echo 1 > /sys/kernel/debug/bluetooth/6lowpan_enable
Send a connection request to the Peripheral device. (In this example, the BD address of the Peripheral device is D0:17:69:12:34:56.)
# echo "connect D0:17:69:12:34:56 1" > /sys/kernel/debug/bluetooth/6lowpan_control
After waiting for a few tens of seconds, the bt0 network interface will appear. (At the same time, the bt0 network interface will appear on the Peripheral device that accepted the connection.)
# ifconfig bt0
bt0: flags=4161<UP,RUNNING,MULTICAST> mtu 1280
inet6 fe80::d017:69ff:feab:cdef prefixlen 64 scopeid 0x20<link>
unspec D0-17-69-AB-CD-EF-00-00-00-00-00-00-00-00-00-00 txqueuelen 1000 (UNSPEC)
RX packets 9 bytes 884 (884.0 B)
RX errors 0 dropped 4 overruns 0 frame 0
TX packets 13 bytes 1069 (1.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
The Central device and Peripheral device are now connected via Bluetooth 6LoWPAN.
Send a ping from the Central device to the Peripheral device. (In this example, the IPV6 address of the Peripheral device is fe80::d017:69ff:fe12:3456.)
# ping6 fe80::d017:69ff:fe12:3456%bt0
PING fe80::d017:69ff:fe12:3456%bt0 (fe80::d017:69ff:fe12:3456%bt0) 56 data bytes
64 bytes from fe80::d017:69ff:fe12:3456%bt0: icmp_seq=1 ttl=64 time=181 ms
64 bytes from fe80::d017:69ff:fe12:3456%bt0: icmp_seq=2 ttl=64 time=125 ms
64 bytes from fe80::d017:69ff:fe12:3456%bt0: icmp_seq=3 ttl=64 time=67.7 ms
64 bytes from fe80::d017:69ff:fe12:3456%bt0: icmp_seq=4 ttl=64 time=56.1 ms
...
Run the iperf3 server on the Peripheral device.
# iperf3 -s
Run the iperf3 benchmark on the Central device. For example, check the TCP connections.
# iperf3 -V -c fe80::d017:69ff:fe12:3456%bt0
You can also check UDP connections. For example, the following example sends UDP 200Kbps bandwidth.
# iperf3 -V -c fe80::d017:69ff:fe12:3456%bt0 -u -b 200K