This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How do I test example project iot mqtt publish and subscribe projects?

The example projects I am referring to is located here:

nRF5_SDK_15.2.0\examples\iot\mqtt\lwip\subscriber\pca10056\s140\ses\iot_lwip_mqtt_subscriber_pca10056_s140

nRF5_SDK_15.2.0\examples\iot\mqtt\lwip\publisher\pca10056\s140\ses\iot_lwip_mqtt_publisher_pca10056_s140

Using a window10 pc:

I have build and downloaded pub program to one nRF52840DK and sub to another nRF52840DK successfully. On my smart phone I can see both of them as Bluetooth devices.

As new to Nordics products and IDE it would be nice with guides/documentation as how to verify that this MQTT pub/sub projects works ( as well as all the other example projects ). 

Do I need another Linux board to work as the MQTT broker? Or does the subscriber board also works as a broker?

Appreciate a link to documentation/guides that explain the many example projects.

Thanks

Parents Reply Children
  • Hi Pih, 

    I apologize for the late reply. 

    Are you running the command as sudo? i.e.

    sudo ifconfig bt0 add 2001:db8::1/64

    I beleive things must be done in the following order

    # Log in as a root user.
    sudo su
    # Mount debugfs file system.
    mount -t debugfs none /sys/kernel/debug
    # Load 6LoWPAN module.
    modprobe bluetooth_6lowpan
    # Enable the bluetooth 6lowpan module.
    echo 1 > /sys/kernel/debug/bluetooth/6lowpan_enable
    # Look for available HCI devices.
    hciconfig
    # Reset HCI device - for example hci0 device.
    hciconfig hci0 reset
    # Read 00:AA:BB:XX:YY:ZZ address of the nRF5x device.
    hcitool lescan
    # Connect to the device.
    echo "connect 00:AA:BB:XX:YY:ZZ 1" > /sys/kernel/debug/bluetooth/6lowpan_control
    # Check if you have established a connection.
    ifconfig
    # Set IPv6 forwarding (must be present).
    sudo echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
    # Run radvd daemon.
    sudo service radvd restart
    #Assign prefix
    ifconfig bt0 add 2001:db8::1/64
    # Observe if new IPv6 prefix is disseminating over bt0 interface.
    ifconfig
    # Try to ping the device using its link-local address, for example, on bt0 interface.
    ping6 -I bt0 fe80::2AA:BBFF:FEXX:YYZZ
    # Disconnect from the device.
    echo "disconnect 00:AA:BB:XX:YY:ZZ" > /sys/kernel/debug/bluetooth/6lowpan_control
    # Check if there are active connections left.
    ifconfig
Related