This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to change the NRF9160 Simple MQTT to send UART - the old example by Simon mqtt_w_uart does not compile

Hi there

We are trying to modify the MQTT_Simple example to be able to send more info than the status of pressing a button and having a button pressed notification go back up to the cloud.  There was an attempt by Simon from 2 years ago to help someone and called mqtt_w_uart, however there are a number of odd things about the code (zephyr deprecated type u8_t which I changed to uint8_t for example - but there were more serious problems like trying to compile and having problems with other dependencies.  Now using the 1.7.0 environment.)  Trying to pull the special additional mqtt_w_uart code into the current version of MQTT_simple (which uses LOG_INF and LOG_ERR instead of printf or whatever, and also you need to #import <drivers/uart.h> instead of just <uart.h> and a few other fun changes that arent obvious) is fine until the main function in main.c has the line  uart_irq_callback_set(uart_gb, uart_cb)  or the line  uart_irq_rx_enable(uart_gb)  plunked into it.  Once this is tried, it DOES compile, however the program keeps resetting and this is what the log shows over and over:

[0m<inf> mqtt_simple: The MQTT simple sample started

[1;31m<err> os: Exception occurred in Secure State

[1;31m<err> os: ***** HARD FAULT *****

[1;31m<err> os:   Fault escalation (see below)

[1;31m<err> os: ***** BUS FAULT *****

[1;31m<err> os:   Precise data bus error

[1;31m<err> os:   BFAR Address: 0x50008158

[1;31m<err> os: r0/a1:  0x00000000  r1/a2:  0x000249a4  r2/a3:  0x00000055

[1;31m<err> os: r3/a4:  0x00000047 r12/ip:  0x2001455c r14/lr:  0x0001c9f5

[1;31m<err> os:  xpsr:  0x61000000

[1;31m<err> os: Faulting instruction address (r15/pc): 0x0001179c

[1;31m<err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0

[1;31m<err> os: Current thread: 0x20014e30 (unknown)

[1;31m<err> fatal_error: Resetting system
  • What's the hardware version of your nRF9160 DK board? Have you updated your modem firmware to the latest compatible version?

  • This is using the circuit dojo feather board.  I did recently update the modem firmware to 1.3.0 but I still have the same problem

  • Hi Gerry,

    Unfortunately, I do not have a circuit dojo feather board on hand. The example I shared is made and verified based on nRF9160DK, you need to adapt it for the specific board due to hardware differences. Can you change the name of  "nrf9160dk_nrf9160_ns.overlay" to"circuitdojo_feather_nrf9160_ns.overlay" to try?

    Best regards,


  • Hi Charlie - I changed the overlay file and ........ I think that worked !  I dont understand why - there is just a tiny line in there about the UARt - maybe in the code compilation it was passing a null string when it didnt find the right overlay file and then when it was in run mode it couldnt handle a zero-length string.  Anyhow - I think it works - the errors are at least gone.  Thanks !