🛠 Passerelle 6LoWPAN : wpan0, lowpan0 et BLE du CC1352P7
Objectives
Turn the BeaglePlay into an IP/6LoWPAN gateway: the native 802.15.4 plane is raw (short frames, mtu 123 on wpan0); the mac802154 modules and 6LoWPAN encapsulation create a lowpan0 interface that carries IPv6. We stack the modules (bcfserial or wpanusb depending on the CC1352P7 firmware, plus mac802154), bring up the lowpan interface, and announce the prefix to the LAN so that 802.15.4 nodes become full-fledged IPv6 hosts. The CC1352P7's BLE remains usable in parallel for pairing.
Hardware
- A BeaglePlay (wpanusb or bcfserial firmware on the CC1352P7)
- An 802.15.4 node (another BeaglePlay, TI board, or compatible node)
- Ethernet network on the LAN side
Complete code
# Charger la pile (bcfserial OU wpanusb selon le firmware flashé)
sudo modprobe mac802154
sudo modprobe wpanusb # ou : sudo modprobe bcfserial
ip link show wpan0 # mtu 123 = 802.15.4 natif
# Créer l'interface 6LoWPAN par-dessus wpan0
sudo ip link add link wpan0 lowpan0 type lowpan
sudo ip link set wpan0 up
sudo ip link set lowpan0 up
sudo ip -6 addr add fd12:3456:789a::1/64 dev lowpan0
# Rôle de routeur : annoncer le préfixe et forwarder vers eth0
sudo sysctl -w net.ipv6.conf.all.forwarding=1
sudo radvd -C /etc/radvd.conf # préfixe fd12:3456:789a::/64 sur lowpan0
# BLE du CC1352P7 pour l'appairage
bluetoothctl list
Expected verification
ip -d link show lowpan0 indicates the type lowpan with link/wpan0; the remote node, once joined, obtains an address in fd12:3456:789a::/64 and responds to ping6 from the LAN via the gateway (forwarding=1). bluetoothctl list shows the CC1352P7's BLE adapter, proving that the 15.4 radio and BLE coexist.
Common errors
- Pinging
wpan0directly with large packets: mtu 123, lowpan encapsulation is precisely there for IPv6; do not confuse the two interfaces. - Loading bcfserial and wpanusb at the same time: they compete for the same hardware, leaving the stack inactive.
- Different channel or PAN ID between gateway and node:
wpan-pingwill never work, check the channel and pan_id withiwpan. - Forgetting radvd or forwarding: the node keeps only a link-local address and remains unreachable from the LAN.
- 15.4 channel overlapping with WiFi: channel 26 overlaps with 802.11, prefer a clean low channel.
Other tutorials for this board
Code examples for this board
clignotante.pyPythonbouton-gpio.pyPythoncapteur-i2c.shBashsurveillance-temperature.shBashcapteur-dht11.pyPythonservo-pwm-sysfs.shBash