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

nrf9160 MQTT example

Hi!

I just saw the MQTT example that has been merged in the master branch and tried to run it on my DK (NB-IoT). Without changing anything in the code or configuration the execution leads to the following output in the console appears:

***** BUS FAULT *****
Precise data bus error
BFAR Address: 0x4002a514
***** Hardware exception *****
Current thread ID = 0x2000031c
Faulting instruction address = 0x6604
Fatal fault in essential thread! Spinning...

I used the latest tags of the releases of zephyr, etc. and only copied mqtt_simple from master branch. Are there any hints or tips how I can make the example work?

Parents Reply Children
  • Hi! Thanks for the answer. There is something very strange going on.

    So I am able to compile and flash secure_boot, at_client, asset_tracker, and the NTP example. Everything seems to work. Serial output looks ok.

    (...)

    Secure Boot: SPU: set SRAM region 30 as Non-Secure
    Secure Boot: SPU: set SRAM region 31 as Non-Secure
    Secure Boot: configure peripherals
    Secure Boot: MSP_NS 200265f0
    Secure Boot: prepare to jump to Non-Secure image
    ***** Booting Zephyr OS v1.13.99-ncs2 *****
    The AT host sample started

    (...)

    Now opening and compiling the mqtt_simple example from the master branch.

    After build and run the output in segger studio is:

    (...)

    Preparing target for download
    Executing script TargetInterface.resetAndStop()
    Reset: Halt core after reset via DEMCR.VC_CORERESET.
    Reset: Reset device via AIRCR.SYSRESETREQ.
    Downloading ‘zephyr.elf’ to J-Link
    Programming 83.3 KB of addresses 00000000 — 00014d37
    Programming 0.4 KB of addresses 00014d38 — 00014edb
    J-Link: Flash download: Bank 0 @ 0x00000000: 1 range affected (16384 bytes)
    J-Link: Flash download: Total time needed: 0.570s (Prepare: 0.042s, Compare: 0.041s, Erase: 0.357s, Program: 0.120s, Verify: 0.000s, Restore: 0.007s)
    Download successful

    Console output:

    Secure Boot: SPU: set SRAM region 30 as Non-Secure
    Secure Boot: SPU: set SRAM region 31 as Non-Secure
    Secure Boot: configure peripherals
    Secure Boot: MSP_NS 200265f0
    Secure Boot: prepare to jump to Non-Secure image
    ***** Booting Zephyr OS v1.13.99-ncs2 *****
    The AT host sample started
    ***** BUS FAULT *****
    Precise data bus error
    BFAR Address: 0x4002a514
    ***** Hardware exception *****
    Current thread ID = 0x2000031c
    Faulting instruction address = 0x6f74
    Fatal fault in essential thread! Spinning...

    Reset and power cycle leads to the same result. Immediate output is always "Bus Fault".

    Now I tried to reprogram the at_client. But it seems like flashing another application is not possible. The output is the following:

    (...)
    Preparing target for download
    Executing script TargetInterface.resetAndStop()
    Reset: Halt core after reset via DEMCR.VC_CORERESET.
    Reset: Reset device via AIRCR.SYSRESETREQ.
    Downloading ‘zephyr.elf’ to J-Link
    Programming 78.3 KB of addresses 00040000 — 0005397b
    Programming 0.4 KB of addresses 0005397c — 00053b23
    J-Link: Flash download: Bank 0 @ 0x00000000: Skipped. Contents already match
    Download successful

    The only thing I can do is re-flashing the secure_boot sample. After that, the device starts to run the at_client

    It seems like there is a problem when flashing the mqtt_client sample.

    Is anybody experiencing similar problems?

  • Hi Dominik,

    If you are going to use the latest updates in the master branch to nrf, you should also make sure that you are in the master branches to the other repos and update them to the latest:

    cd <sourcecode_root>\ncs\zephyr ; git checkout master ; git pull
    cd <sourcecode_root>\ncs\mcuboot ; git checkout master ; git pull
    cd <sourcecode_root>\ncs\nrf ; git checkout master ; git pull
    cd <sourcecode_root>\ncs\nrfxlib ; git checkout master ; git pull

    Unfortunately, there is an issue with building using SES with the latest master branch (I can assure you that we are working on fixing this). 


    Workaround:
    In the meantime you can build the application via the terminal, where the board name for a non-secure project has changed to “nrf9160_pca10090ns”.

    Here’s the way to generate/compile a project from terminal:

    export ZEPHYR_TOOLCHAIN_VARIANT=gnuarmemb
    export GNUARMEMB_TOOLCHAIN_PATH="/path/to/gcc-arm-none-eabi-Qx-2018/"
    source /path/to/ncs/zephyr/zephyr-env.sh
    cd /path/to/ncs/nrf/samples/nrf9160/mqtt_simple/
    mkdir build && cd build
    cmake .. -DBOARD=nrf9160_pca10090ns -GNinja
    ninja flash
    

    - If your build folder exists, you might need to clear it (delete the content) first.

    (use ninja to compile and/or ninja flash to compile and flash to the kit)

    Note that you also need to build/flash the secure_boot sample again to be sure that everything is on the right memory area.

    Please note that when building for secure_boot you need to use this command instead: 

    cmake .. -DBOARD=nrf9160_pca10090 -GNinja

    (note that it does not have the ns at the end ["non-secure"])

    It should look something like this:


    I must apologize for the inconvenience this may have caused.

    Best Regards,

    Martin L.

  • Hi Martin,

    I followed the 7 steps above but cannot flash because of this error:

    FileNotFoundError: [Errno 2] No such file or directory: 'nrfjprog': 'nrfjprog'

    I ran pip3 install --user pynrfjprog and retried but it made no difference.  Any suggestions?

    -rob

  • Hi Rob,

    You are missing the nRF command Line Tools.

    Please download it and it should work.

  • Same result after untar of that archive into my /opt/SEGGER/JLink directory.  Is there a variable that I can 'export' so that ninja can find nrfjprog?

Related