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

Problem with MQTT_Simple

I am having a problem running MQTT_Simple on my nRF9160 DK.

The COM Port shows the following:

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

I have recently updated SES, but the code still produces the bus fault.

Case ID: 226428 seems to be similar, but the discussion involves several "experiments" only some of which were productive.

So, could someone explicitly lists the steps needed to get this example working.  I wish to use it as the basis for a new product that sends data to the cloud.

Thank you,

-Craig Goldman

Parents
  • Have you tried updating to the latest firmware for the nrf9160 DK? Did you try "west update" to get the latest release?

    Also when, using the latest versions, you have to use build solution, connect target and then program the merged.hex file like mentioned here:

    https://devzone.nordicsemi.com/f/nordic-q-a/47032/mqtt_simple-programmed-to-wrong-address-range-00008000----00020abb

  • Thank you for your response (and sorry for the delay in responding).  I was not aware that I had to do something special to program the merged file.

    I am preparing to do a complete new download of the NCS directory and will try all these suggestions in the next few days.  I will report my results.

  • Good News.  I've gotten quite a bit further along.  Again, thank you for your help.

    I've installed the new SES as directed.  It does look a bit different.  Funny that it has the same revision number.

    The project loaded as an nRF Connect SDK Project without error and built without error.

    After fumbling for a bit, I remembered that I had to manually load the "merged" hex file (and I did).

    Connecting the board opened three serial ports.  One is for the nRF52840, one does nothing and the third seems to be the MQTT application.

    (By the way, I could find no mention of baud rate, 115.2K was not my first choice.  You may want to mention this somewhere.)

    I got the following output...
    vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

     

    ***** Booting Zephyr OS v1.14.99-ncs1-587-g5c5ba77d0170 *****
    Flash region            Domain          Permissions
    00 0x00000 0x08000      Secure          rwxl
    01 0x08000 0x10000      Non-Secure      rwxl
    02 0x10000 0x18000      Non-Secure      rwxl
    03 0x18000 0x20000      Non-Secure      rwxl
    04 0x20000 0x28000      Non-Secure      rwxl
    05 0x28000 0x30000      Non-Secure      rwxl
    06 0x30000 0x38000      Non-Secure      rwxl
    07 0x38000 0x40000      Non-Secure      rwxl
    08 0x40000 0x48000      Non-Secure      rwxl
    09 0x48000 0x50000      Non-Secure      rwxl
    10 0x50000 0x58000      Non-Secure      rwxl
    11 0x58000 0x60000      Non-Secure      rwxl
    12 0x60000 0x68000      Non-Secure      rwxl
    13 0x68000 0x70000      Non-Secure      rwxl
    14 0x70000 0x78000      Non-Secure      rwxl
    15 0x78000 0x80000      Non-Secure      rwxl
    16 0x80000 0x88000      Non-Secure      rwxl
    17 0x88000 0x90000      Non-Secure      rwxl
    18 0x90000 0x98000      Non-Secure      rwxl
    19 0x98000 0xa0000      Non-Secure      rwxl
    20 0xa0000 0xa8000      Non-Secure      rwxl
    21 0xa8000 0xb0000      Non-Secure      rwxl
    22 0xb0000 0xb8000      Non-Secure      rwxl
    23 0xb8000 0xc0000      Non-Secure      rwxl
    24 0xc0000 0xc8000      Non-Secure      rwxl
    25 0xc8000 0xd0000      Non-Secure      rwxl
    26 0xd0000 0xd8000      Non-Secure      rwxl
    27 0xd8000 0xe0000      Non-Secure      rwxl
    28 0xe0000 0xe8000      Non-Secure      rwxl
    29 0xe8000 0xf0000      Non-Secure      rwxl
    30 0xf0000 0xf8000      Non-Secure      rwxl
    31 0xf8000 0x100000     Non-Secure      rwxl
    SRAM region             Domain          Permissions
    00 0x00000 0x02000      Secure          rwxl
    01 0x02000 0x04000      Secure          rwxl
    02 0x04000 0x06000      Secure          rwxl
    03 0x06000 0x08000      Secure          rwxl
    04 0x08000 0x0a000      Secure          rwxl
    05 0x0a000 0x0c000      Secure          rwxl
    06 0x0c000 0x0e000      Secure          rwxl
    07 0x0e000 0x10000      Secure          rwxl
    08 0x10000 0x12000      Non-Secure      rwxl
    09 0x12000 0x14000      Non-Secure      rwxl
    10 0x14000 0x16000      Non-Secure      rwxl
    11 0x16000 0x18000      Non-Secure      rwxl
    12 0x18000 0x1a000      Non-Secure      rwxl
    13 0x1a000 0x1c000      Non-Secure      rwxl
    14 0x1c000 0x1e000      Non-Secure      rwxl
    15 0x1e000 0x20000      Non-Secure      rwxl
    16 0x20000 0x22000      Non-Secure      rwxl
    17 0x22000 0x24000      Non-Secure      rwxl
    18 0x24000 0x26000      Non-Secure      rwxl
    19 0x26000 0x28000      Non-Secure      rwxl
    20 0x28000 0x2a000      Non-Secure      rwxl
    21 0x2a000 0x2c000      Non-Secure      rwxl
    22 0x2c000 0x2e000      Non-Secure      rwxl
    23 0x2e000 0x30000      Non-Secure      rwxl
    24 0x30000 0x32000      Non-Secure      rwxl
    25 0x32000 0x34000      Non-Secure      rwxl
    26 0x34000 0x36000      Non-Secure      rwxl
    27 0x36000 0x38000      Non-Secure      rwxl
    28 0x38000 0x3a000      Non-Secure      rwxl
    29 0x3a000 0x3c000      Non-Secure      rwxl
    30 0x3c000 0x3e000      Non-Secure      rwxl
    31 0x3e000 0x40000      Non-Secure      rwxl
    Peripheral              Domain          Status
    00 NRF_P0               Non-Secure      OK
    01 NRF_CLOCK            Non-Secure      OK
    02 NRF_RTC1             Non-Secure      OK
    03 NRF_NVMC             Non-Secure      OK
    04 NRF_UARTE1           Non-Secure      OK
    05 NRF_UARTE2           Secure          SKIP
    06 NRF_IPC              Non-Secure      OK
    07 NRF_VMC              Non-Secure      OK
    08 NRF_FPU              Non-Secure      OK
    09 NRF_EGU1             Non-Secure      OK
    10 NRF_EGU2             Non-Secure      OK
    11 NRF_TWIM2            Non-Secure      OK
    12 NRF_SPIM3            Non-Secure      OK
    13 NRF_TIMER0           Non-Secure      OK
    14 NRF_TIMER1           Non-Secure      OK
    15 NRF_TIMER2           Non-Secure      OK
    16 NRF_SAADC            Non-Secure      OK
    17 NRF_GPIOTE1          Non-Secure      OK
    SPM: NS image at 0x8000
    SPM: NS MSP at 0x200237b8
    SPM: NS reset vector at 0xa271
    SPM: prepare to jump to Non-Secure image.
    ***** Booting Zephyr OS v1.14.99-ncs1-587-g5c5ba77d0170 *****
    The MQTT simple sample stabsdlib recoverable error: 3
    rted
    LTE Link Connecting ...

    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    No further characters after "LTE Link Connecting..."

    I'm not in the best location for a Cellular Link.  I'll try it elsewhere, if I can, later tonight or tomorrow.

    Is the above message (including the "recoverable error") good news, bad news or maybe a bit of both?
    Is my only problem needing a better cell connection or is there something else?
    What kind of message will print on the serial port when it is working?

    -Craig

  • OK.  I'm in a much better cellular location.  This is what I get...
    vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

    ***** Booting Zephyr OS v1.14.99-ncs1-587-g5c5ba77d0170 *****
    The MQTT simple sample started
    LTE Link Connecting ...
    LTE Link Connected!
    ERROR: getaddrinfo failed 22
    ERROR: mqtt_connect -47
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    So even more progress.  I think I'm getting close.
    What should I do next?

    -Craig

  • This is great news, Craig. Good progress!
     

    craig.goldman said:
    I've installed the new SES as directed.  It does look a bit different.  Funny that it has the same revision number.

    Yes, I agree, I was expecting a different version number and more details that would give us an answer regarding the Nordic Edition.  Some feedback to the SES team. 

    craig.goldman said:
    Connecting the board opened three serial ports.  One is for the nRF52840, one does nothing and the third seems to be the MQTT application.

     Yes, this is correct. The three ports are explained here, while the baud rate is covered in the NCS v0.4.0 documentation in the chapter "Testing a Sample Application"
     

    craig.goldman said:
    No further characters after "LTE Link Connecting..."

     Can you please issue the command AT+CFUN? one or two times? This should give more output from the modem regarding connection status. If this does not work, please load the AT_client (samples/nrf9160/at_client). Documentation on AT commands are found in the AT Command Reference Guide.

    craig.goldman said:
    recoverable error: 3

     This seams to be an ERRATA, more information here. If you do keep meeting this message, please follow the workaround in the link.

    craig.goldman said:
    ERROR: getaddrinfo failed 22
    ERROR: mqtt_connect -47

    getaddrinfo is a function to resolve the host name into IPv4 and/or IPv6 addresses, and part of the nrfxlib repository. 22 means Invalid argument.  mqtt_connect is part of the Zephyr Project, and is the API to request new MQTT client connection. The error code translates to "Level 3 reset". Both error codes, 22 and 47, can be found in "errno.h". I do not know the reason for these errors and will discuss the issue with my team, to find a root cause.

    craig.goldman said:
    What should I do next?

     While I discuss the issue with my team, please try the AT_client example and issue the AT+CFUN? command, then provide me the output. 

    Thanks!

    Kind regards,
    Øyvind

  • Sorry for the delay in responding; it was a busy week.

    AT+CFUN? returns.... 
    +CFUN: 4

    Were you expecting a longer response?

    I've re-built the at_client example.  I had successfully built and ran this in March.

    It doesn't seem to be working, now.  I built this example with board nrf9160_pca10090.  Should it be built with nrf9160_pca10090ns?  Do I need to manually download a merged hex file?

    NRF_Connect asked me to download an update and I did.

    The LTE_Monitor is reporting an error  -- JLINK_ARM_DLL_TOO_OLD.

    How do I fix that?

  • NRF_Connect asked me to download an update and I did.

    The LTE_Monitor is reporting an error  -- JLINK_ARM_DLL_TOO_OLD.

    First of all, if you have update nRF Connect to v2.7, there are known bugs with this version. Please ensure latest version of LTE Link Monitor (update in nRC Connect) and please download latest JLink drivers from Segger.com. If this does not help, we strongly advise downgrading to v2.6.2. 

    craig.goldman said:
    AT+CFUN? returns.... 
    +CFUN: 4

     Ok, this means that your modem is set to Offline or Flight Mode Please see AT Command CFUN documentation. You need to issue the command "AT+CFUN=1"

     

    craig.goldman said:
    I built this example with board nrf9160_pca10090.  Should it be built with nrf9160_pca10090ns?

    Yes, it still needs to be nrf9160_pca10090ns. This is due to the complexity of the nRF9160, more information here.

    craig.goldman said:
    Do I need to manually download a merged hex file?

    Yes, in Segger Embedded Studio (SES) v4.16 you need to manually program the device.  See this post on how the process is. We are working with a fix for newer version SES.

    Let me know how this works for you!

    Kind regards,
    Øyvind

Reply
  • NRF_Connect asked me to download an update and I did.

    The LTE_Monitor is reporting an error  -- JLINK_ARM_DLL_TOO_OLD.

    First of all, if you have update nRF Connect to v2.7, there are known bugs with this version. Please ensure latest version of LTE Link Monitor (update in nRC Connect) and please download latest JLink drivers from Segger.com. If this does not help, we strongly advise downgrading to v2.6.2. 

    craig.goldman said:
    AT+CFUN? returns.... 
    +CFUN: 4

     Ok, this means that your modem is set to Offline or Flight Mode Please see AT Command CFUN documentation. You need to issue the command "AT+CFUN=1"

     

    craig.goldman said:
    I built this example with board nrf9160_pca10090.  Should it be built with nrf9160_pca10090ns?

    Yes, it still needs to be nrf9160_pca10090ns. This is due to the complexity of the nRF9160, more information here.

    craig.goldman said:
    Do I need to manually download a merged hex file?

    Yes, in Segger Embedded Studio (SES) v4.16 you need to manually program the device.  See this post on how the process is. We are working with a fix for newer version SES.

    Let me know how this works for you!

    Kind regards,
    Øyvind

Children
  • I have upgraded my JLINK DLL drivers.  "at_client" has been built with nrf9160_pca10090ns. The merged.hex was manually downloaded.

    nRF Connect is v2.7.0.  LTE Link Monitor is v0.9.2

    When I open the device it reports....
    Opening COM6: File not found

    LTE commands time-out.

    UART, Modem, etc. all marked as gray boxes.

    The code says it is running, but I'm not sure that it is working.

    How do I downgrade nRF Connect to v.2.6.2?

    Do you have any other suggestions?

  • craig.goldman said:
    When I open the device it reports....
    Opening COM6: File not found

     Can you please provide a screenshot of the LTE Link Monitor?

    craig.goldman said:
    How do I downgrade nRF Connect to v.2.6.2?

     The issues that were first seen in version 2.7 should be fixed now, so there should be no need to downgrade after all. 

  • The monitor is acting different this morning.

    Also, I'm not sure this is a good location for cellular connection.  I'll try everything again at a better location this weekend.

    Here is Monitor snap shot

  • More interesting (promising?) information regarding mqtt_simple.

    I decided to re-build and re-download mqtt_simple on the board in a very strong cellular area.

    I also decided to activate the LTE_Monitor instead of the terminal emulator.

    When I reset the board, I got the same boot-up and the same error messages....
    ***** Booting Zephyr OS v1.14.99-ncs1-587-g5c5ba77d0170 *****
    The MQTT simple sample started
    LTE Link Connecting ...
    LTE Link Connected!
    ERROR: getaddrinfo failed 22
    ERROR: mqtt_connect -47

    Per earlier instructions, I send the command AT+CFUN?.  On the third try, the board sprung to life - the modem activated and the terminal every 10 seconds or so would send "AT+CESQ" and the device would respond with +CESQ: 99,99,255,255,255,76

    Eventually the "LTE" indicated it was searching.  It did this for awhile until I sent another AT+CFUN? command (using the push button this time).

    Everything now seems to be connected.

    Here are a couple of screen shots.

    I'm not sure how to attach the log file, if you are interested.

    This looks very good to me.  (Please tell me if I am being overly optimistic.)

    Still have issues with asset_tracker, but I'll play with it some more now that I know that you have to poke the application to get it to run.

    Is there anything more I can do with mqtt_simple?  Otherwise, I'll look into modifying this code to communicate with the 64Seconds mqtt_server.

    I appreciate all the help in getting me this far.

    If you can point me to any documents which discuss modifying mqtt_simple to be used in other applications or have any suggestions to get me started, I welcome all help.

    Thank you again.
    -Craig Goldman

  • Hi Craig,

     

    From the logs that you posted, it seems that your modem firmware is quite old.

    Could you please download the latest one from here:

    https://www.nordicsemi.com/Products/Low-power-cellular-IoT/nRF9160/Download#infotabs

    And try the mqtt_simple example again?

     

    Kind regards,

    Håkon

Related