Skip to main content

Nordic Serial Modem Quickstart (nRF91 Series)

This quickstart guide shows how to verify an nRF Cloud integration on a Nordic nRF91 series SiP running the Serial Modem application. The Serial Modem application exposes the nRF91 modem to a host device over a UART using AT commands.

info

The Serial Modem App v2.0.0 is still being finalized. Commands are subject to change.

Create your nRF Cloud account​

Register for an nRF Cloud account to get started. Once registered, select your Nordic chip variant and a Project will be automatically created for you.

tip

Already have an nRF Cloud account without Memfault access? Create a new account or contact us for support.

Next, to perform a modem firmware update later in the quickstart, we will create a second project to deliver the FOTA. In the upper left in nRF Cloud, open the Project selection drop down, and select "Create Project". Select "Other MCU" and name the project "Modem Project".

Setup your environment​

Initialize a new west workspace, with the Serial Modem Application as your manifest repository:

mkdir ncs-serial-modem-workspace && cd ncs-serial-modem-workspace
west init -m https://github.com/nrfconnect/ncs-serial-modem
west update

Build and Flash​

Perform a full rebuild of the project and flash the board. This example builds the Serial Modem application targeting the nRF9151 DK.

Copy the modem Project Key, and paste into the command below:

west build --pristine=always --board nrf9151dk/nrf9151/ns ncs-serial-modem/app -- \
-DCONFIG_MEMFAULT_FOTA_MODEM_PROJECT_KEY=\"YOUR_MODEM_PROJECT_KEY\" && \
-DCONFIG_SM_NRF_CLOUD_OBSERVABILITY_DEBUG=y

Then, flash your DK:

west flash --erase

If you encounter configuration or other build errors, please contact us!

Hello, nRF Cloud​

  1. Upload the build/app/zephyr/zephyr.elf file to nRF Cloud by navigating to Software → Symbol Files, and clicking the "Upload Symbol File" button.

    tip

    If there are code changes, make sure to always upload the Symbol file before sending data to nRF Cloud.

  2. Open a serial terminal app where you can send commands, such as the Serial Terminal bundled with nRF Connect for Desktop.

  3. Confirm the modem is registered on the LTE network. Send AT+CFUN=1 and then check registration status with AT+CEREG? over the serial port and check for a registered status. For example:

    > AT+CEREG?
    +CEREG: 0,5 # registered, roaming

    OK

    > AT+CEREG?

    +CEREG: 0,1 # registered, home

    OK
    tip

    If you're not able to register with the network, reset the modem status with: AT+CFUN=0 followed by AT+CFUN=1. Then, recheck network registration status with AT+CEREG?.

  4. Once the modem is connected, print the attestation token:

    > AT%ATTESTTOKEN

    %ATTESTTOKEN: "<token>"

    OK

    Claim the device in nRF Cloud by going to Devices > Add devices and entering the token. See Device Onboarding for more details.

    Add attestation token
  5. Next, establish a connection with nRF Cloud:

    > AT#XNRFCLOUD=1

    OK

    #XNRFCLOUD: 1,0 # unsolicited response confirming connection

    You can request a connection status with:

    > AT#XNRFCLOUD?

    #XNRFCLOUD: 1,0,16842753,"50344654-3037-4f89-809b-1810f870fb69" # connected

    OK
    tip

    If you're not able to register with nRF Cloud, your network registration might need to be rest. Reset the modem status with: AT+CFUN=0 followed by AT+CFUN=1. Then, recheck network registration status with AT+CEREG?, and reinitiate a connect to nRF Cloud with AT#XNRFCLOUD=1.

  6. Once connected, send the available data:

    > AT#XNRFCLOUDOBSUPLOAD

    OK

    #XNRFCLOUDOBSUPLOAD: 0,2326 # upload successful
  7. In nRF Cloud, navigate to Processing Log and look for the reboot event that was just uploaded.

Congrats, you've just uploaded your first piece of data to nRF Cloud! 🎉

Application FOTA​

  1. Perform a check on the device, demonstrating an application release is not yet available:

    > AT#XNRFCLOUDFOTA=4

    OK

    #XNRFCLOUDFOTA: 0,0,0 # no release available
  2. Rebuild the application with a newer version by updating the VERSION file at app/VERSION and re-running the previous west build command

  3. Then, create a Full Release on the OTA Releases page with Software Type app, Hardware Version nrf9151dk, and the exact Software Version produced by the updated VERSION file.

  4. Upload build/app/zephyr/zephyr.signed.bin as the release payload

  5. Then, create an Activation for the default cohort.

  6. On the device, check that update is available:

    AT#XNRFCLOUDFOTA=4

    OK

    #XNRFCLOUDFOTA: 0,0,1 # release is available
  7. Now, perform another check, which will now trigger the download:

    AT#XNRFCLOUDFOTA=1
    ...
    #XNRFCLOUDFOTA: 1,0,100 # download complete
  8. Wait for an unsolicited response of #XNRFCLOUDFOTA: 4,0, indicating the FOTA has been staged, then reset the device to apply the update:

    AT#XRESET
    // device reboots
  9. Finally, confirm that the new application version applied:

    > AT#XNRFCLOUDOBSDEVINFO

    #XNRFCLOUDOBSDEVINFO: "50344654-3037-4f89-809b-1810f870fb69","app","<new-version>","nrf9151dk"

Modem FOTA​

Next, we will trigger a modem firmware update.

  1. Perform a check on the device, demonstrating a modem firmware release is not yet available:

    AT#XNRFCLOUDFOTA=6

    OK

    #XNRFCLOUDFOTA: 0,0,0 # modem firmware is up-to-date
  2. Before upgrading, we will need to downgrade the modem firmware version. Download the v2.0.3 modem firmware bundle from nRF9151 Downloads. Then, using nRF Util, downgrade the firmware:

    # get your device serial number
    ❯ nrfutil device list
    1051297113 <-- device serial to copy
    ...
    # install the "91" nrfutil command if not already installed
    ❯ nrfutil install 91
    # perform the modem downgrade
    ❯ nrfutil 91 modem-firmware-upgrade --firmware ~/Downloads/mfw_nrf91x1_2.0.3.zip --verify --serial-number YOUR_DK_SERIAL_NUMBER
  3. Create a Release as we did before, but this time, create a Delta Release to enforce delivery of a payload from exactly the current modem firmware to exactly the newer one (mfw_nrf91x1_2.0.3 to mfw_nrf91x1_2.0.4).

  4. Next, download the v2.0.4 bundle at nRF9151 Downloads. Upload the delta release binary in the modem firmware .zip file for the version you are upgrading to, e.g. mfw_nrf91x1_update_from_2.0.3_to_2.0.4.bin will be in the 2.0.4 .zip file.

  5. Finally, activate the release like before on your chosen Cohort.

  6. On the device, check that an update is available:

    AT#XNRFCLOUDFOTA=6

    OK

    #XNRFCLOUDFOTA: 0,0,1 # release is available
  7. Now, perform another check, which will now trigger the download:

    AT#XNRFCLOUDFOTA=2
    ...
    #XNRFCLOUDFOTA: 1,0,100 # download complete

Celebrate, you've completed an application and modem update over-the-air with nRF Cloud! 🎉

Next Steps​

Now that the Memfault SDK is integrated on your device, there are many other features and options to explore. Check out these sections of our docs for more information: