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

  • Yes, after looking at some forums it should be ok to just create the REPORTING-BUGS file. It does not appear to be used by the kernel so this is a Ok way to fix the issue. 

  • Thanks good to know!

    I am going through the 16 test steps of "pca10056 MQTT Client Publisher" 

    https://www.nordicsemi.com/DocLib/Content/SDK_Doc/nRF5_SDK/v15-2-0/iot_sdk_app_mqtt_publisher?1649#iot_sdk_app_mqtt_publisher_test

    And the client startup advertising, push button 1 and it connect to 6lowpan router, push button 2 result in error code 0000c943, instead of connecting to the MQTT Broker.

    What does the error code mean?

    Can you tell me how to insert the brokers IPv6 addr correctly, please!

    Is this correct inserted it in MQTT Client Publisher's main.c file. m_broker_addr

    when:

    linux mosquitto broker's IPv6 addr fe80::8292:9e6f:cc08:1520/64

    windows mosquitto broker's Link-local IPv6: fe80::bdeb:857e:f92b:730f%13  

    This is the only place I have setup the MQTT brokers addr, is that correct?

    In step 8 "Prepare the IPv6 global prefix for the btX interface" in the 6lowpan router.

    I followed the guide

    https://www.nordicsemi.com/DocLib/Content/SDK_Doc/nRF5_SDK/v15-2-0/iot_sdk_user_guides_radvd

    Enter root user 

    sudo su

    sudo apt-get install radvd

    I modified the /etc/radvd.conf file

    and ran

    # Set IPv6 forwarding (must be present).
    sudo echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
    # Run radvd daemon.
    sudo service radvd restart
    Commands had no errors, but not sure I could see this happen

    "Observe if new IPv6 prefix is disseminating over bt0 interface"

    ifconfig gave me this:  bt0: inet6 fe80::b827..... and it should be 2001:db8::...

    Please advise..

    Help is appreciated!

  • Hi Pih

    you need to call

     ifconfig bt0 add 2001:db8::1/64

    to add the prefix, the radvd service does not do this as it shold i thinnk. 

    Bjørn

  • "ifconfig bt0 add 2001:db8::1/64" didn't help

    How can I find the root cause of why it's not working?  Is it possible for you to run the example project on the same HW?

  • 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