nRF9160: AWS IoT - what am I doing wrong

Hi

 

I am going through the AWS IoT example using an nRF9160 DK, but having some problems with it.

 

My setup

nRF9160 DK + LTE-M SIM card

I used this same board and SIM card yesterday with the Asset Tracker applciatin, and successfully connected to the nRF Cloud, and could see the DKboard send data every 2 minutes to the cloud.

Setting this up also included downloading and provisioning the nRF Cloud certificate fo rhtis board.

So now, with proven hardware etc., I want to connect to Amazon AWS IoT.

 

Steps

I followed this example:

https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/nrf9160/aws_iot/README.html

In AWS IoT, I created a thing, the certificates (and downloaded them), the policy, linked the policy to the certificate

For the nRF9160 DK, I again grabbed the latest app/modem firmware, and used the nRF Connect Programmer to re-flash the latest modem firmware

https://www.nordicsemi.com/Products/Development-hardware/nrf9160-dk/download

I then used the the nRF Connect Programmer to flash the AT Client hex file that came woth the app/firmware download, but I could not communicate with the modem after that (AT commands timed out etc.)

So in VS Code I created an application form the AT Client example, and built it for nrf9160dk_nrf9160_ns, and that worked, so I could use AT commands.

I turned the modem off (AT+CFUN=4), and then copied in the downloaded certifiates, and changed the security tag.

I then created an application from the AWS IOT example

https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.1.0/nrf/samples/nrf9160/aws_iot/README.html

 

and again, built it for nrf9160dk_nrf9160_ns

I modified the prj.conf file to update the following:

CONFIG_AWS_IOT_CLIENT_ID_STATIC

CONFIG_AWS_IOT_BROKER_HOST_NAME

CONFIG_AWS_IOT_SEC_TAG

Rebuilt, and flashed this

I then disconnected the board, inserted the SIM card, and powered the board back up.

Result: nothing

LEDs 1..4 – nothing

Connect LTE Monitor – I can’t to the modem (AT commands timeout)

 

So, my question:

How can I debug this from here?

Shouldn’t I be getting some kind of feedback from the LEDs? Even if I run the app with the SIM card removed?

 

Should I be able to get modem feedback?

 

I have gone through this process about six times now

A few times, I deleted the thing, certificate and policy from AWS and started again

I rebuilt the AWS IoT project

I re-flashed the modem, reprogrammed the certificates

 

One of the times, after provisioning the certificates, I typed in AT+CFUN=1, to see if that would changes – it didn’t

When flashing the modem firmware, I have tried with and without MCU Enabled

 

At this stage I really do not know what I am doing wrong

Parents
  • OK, I have more info on this – it llooks like the app just isn’t running:

    The start of the code in main() is:

    void main(void)
    {
    int err;
    printk("The AWS IoT sample started, version: %s\n", CONFIG_APP_VERSION);
    cJSON_Init();

    When I look at the COM port output, I do NOT get this printk()) message – I just get this:

    *** Booting Zephyr OS build v3.1.99-ncs1 ***
    I: Starting bootloader
    I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Swap type: none
    I: Bootloader chainload address offset: 0x10000
    I: Jumping to the first image slot

  • Hello, 

    Shouldn’t I be getting some kind of feedback from the LEDs? Even if I run the app with the SIM card removed?

    This sample does not use any LEDs. All communication is visbile in e.g. LTE Link Monitor. Here is my output when running the AWS_IOT sample following the AWS IOT documentation

    2022-11-25T08:31:07.621Z DEBUG modem << *** Booting Zephyr OS build v3.1.99-ncs1-1  ***
    2022-11-25T08:31:07.638Z DEBUG modem << I: Starting bootloader
    2022-11-25T08:31:07.640Z DEBUG modem << I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    2022-11-25T08:31:07.641Z DEBUG modem << I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    2022-11-25T08:31:07.643Z DEBUG modem << I: Boot source: none
    2022-11-25T08:31:07.644Z DEBUG modem << I: Swap type: none
    2022-11-25T08:31:07.705Z DEBUG modem << I: Bootloader chainload address offset: 0x10000
    2022-11-25T08:31:07.708Z DEBUG modem << I: Jumping to the first image slot
    2022-11-25T08:31:08.426Z DEBUG modem << *** Booting Zephyr OS build v3.1.99-ncs1-1  ***
    2022-11-25T08:31:08.443Z DEBUG modem << The AWS IoT sample started, version: v1.0.0
    2022-11-25T08:31:09.521Z DEBUG modem << +CEREG: 2,"7AA9","01172803",7
    2022-11-25T08:31:09.551Z DEBUG modem << LTE cell changed: Cell ID: 18294787, Tracking area: 31401
    2022-11-25T08:31:09.569Z DEBUG modem << +CSCON: 1
    2022-11-25T08:31:09.571Z DEBUG modem << RRC mode: Connected
    2022-11-25T08:31:10.413Z DEBUG modem << +CEREG: 1,"7AA9","01172803",7,,,"00001010","11000001"
    2022-11-25T08:31:10.433Z DEBUG modem >> AT+COPS=3,2
    2022-11-25T08:31:10.449Z DEBUG modem << Network registration status: Connected - home network
    2022-11-25T08:31:10.467Z DEBUG modem << PSM parameter update: TAU: 1152000, Active time: 20
    2022-11-25T08:31:10.470Z DEBUG modem << %XTIME: "40","22115280130140","00"
    2022-11-25T08:31:10.472Z DEBUG modem << Date time obtained
    2022-11-25T08:31:10.473Z DEBUG modem << Next connection retry in 30 seconds
    2022-11-25T08:31:10.474Z DEBUG modem << AWS_IOT_EVT_CONNECTING
    2022-11-25T08:31:10.475Z DEBUG modem << OK
    2022-11-25T08:31:10.478Z DEBUG modem >> AT+COPS?
    2022-11-25T08:31:10.496Z DEBUG modem << +COPS: 0,2,"24201",7
    2022-11-25T08:31:10.499Z DEBUG modem << OK
    2022-11-25T08:31:10.519Z DEBUG modem >> AT%XCBAND
    2022-11-25T08:31:10.536Z DEBUG modem << %XCBAND: 20
    2022-11-25T08:31:10.538Z DEBUG modem << OK
    2022-11-25T08:31:10.544Z DEBUG modem >> AT+CGDCONT?
    2022-11-25T08:31:10.563Z DEBUG modem << +CGDCONT: 0,"IPV4V6","telenor.iot","10.112.143.189 2A02:2121:0080:3660:0000:006B:1DCE:4201",0,0
    2022-11-25T08:31:10.565Z DEBUG modem << OK
    2022-11-25T08:31:10.584Z DEBUG modem >> AT+CGACT?
    2022-11-25T08:31:10.683Z DEBUG modem << +CGACT: 0,1
    2022-11-25T08:31:10.728Z DEBUG modem << OK
    2022-11-25T08:31:13.318Z DEBUG modem << AWS_IOT_EVT_CONNECTED
    2022-11-25T08:31:13.335Z DEBUG modem << Publishing: {
    2022-11-25T08:31:13.337Z DEBUG modem << "state":{
    2022-11-25T08:31:13.338Z DEBUG modem << "reported":{
    2022-11-25T08:31:13.339Z DEBUG modem << "app_version":"v1.0.0",
    2022-11-25T08:31:13.341Z DEBUG modem << "batv":5074,
    2022-11-25T08:31:13.342Z DEBUG modem << "ts":1669365072799
    2022-11-25T08:31:13.343Z DEBUG modem << }
    2022-11-25T08:31:13.344Z DEBUG modem << }
    2022-11-25T08:31:13.345Z DEBUG modem << } to AWS IoT broker
    2022-11-25T08:31:13.456Z DEBUG modem << +CEREG: 1,"7AA9","01172803",7,,,"00100001","00000011"
    2022-11-25T08:31:13.475Z DEBUG modem >> AT+COPS=3,2
    2022-11-25T08:31:13.492Z DEBUG modem << PSM parameter update: TAU: 1800, Active time: 60
    2022-11-25T08:31:13.509Z DEBUG modem << OK
    2022-11-25T08:31:13.512Z DEBUG modem << AWS_IOT_EVT_READY
    2022-11-25T08:31:13.513Z DEBUG modem >> AT+COPS?
    2022-11-25T08:31:13.532Z DEBUG modem << +COPS: 0,2,"24201",7
    2022-11-25T08:31:13.534Z DEBUG modem << OK
    2022-11-25T08:31:13.554Z DEBUG modem >> AT%XCBAND
    2022-11-25T08:31:13.570Z DEBUG modem << AWS_IOT_EVT_PUBACK, message ID: 48867
    2022-11-25T08:31:13.587Z DEBUG modem << %XCBAND: 20
    2022-11-25T08:31:13.589Z DEBUG modem << OK
    2022-11-25T08:31:13.593Z DEBUG modem >> AT+CGDCONT?
    2022-11-25T08:31:13.616Z DEBUG modem << +CGDCONT: 0,"IPV4V6","telenor.iot","10.112.143.189 2A02:2121:0080:3660:0000:006B:1DCE:4201",0,0
    2022-11-25T08:31:13.618Z DEBUG modem << OK
    2022-11-25T08:31:13.635Z DEBUG modem >> AT+CGACT?
    2022-11-25T08:31:13.653Z DEBUG modem << +CGACT: 0,1
    2022-11-25T08:31:13.655Z DEBUG modem << OK
    2022-11-25T08:31:13.737Z DEBUG modem << AWS_IOT_EVT_DATA_RECEIVED
    2022-11-25T08:31:13.787Z DEBUG modem << Data received from AWS IoT console:
    2022-11-25T08:31:13.790Z DEBUG modem << Topic: $aws/things/thing_299079/shadow/get/accepted
    2022-11-25T08:31:13.792Z DEBUG modem << Message: {
    2022-11-25T08:31:13.793Z DEBUG modem << "state":{
    2022-11-25T08:31:13.794Z DEBUG modem << "reported":{
    2022-11-25T08:31:13.796Z DEBUG modem << "app_version":"v1.0.0",
    2022-11-25T08:31:13.796Z DEBUG modem << "batv":5074,
    2022-11-25T08:31:13.797Z DEBUG modem << "ts":1669365072799
    2022-11-25T08:31:13.798Z DEBUG modem << }
    2022-11-25T08:31:13.798Z DEBUG modem << },
    2022-11-25T08:31:13.799Z DEBUG modem << "metadata":{
    2022-11-25T08:31:13.802Z DEBUG modem << "reported":{
    2022-11-25T08:31:13.803Z DEBUG modem << "app_version":{
    2022-11-25T08:31:13.805Z DEBUG modem << "timestamp":1669365073
    2022-11-25T08:31:13.806Z DEBUG modem << },
    2022-11-25T08:31:13.807Z DEBUG modem << "batv":{
    2022-11-25T08:31:13.808Z DEBUG modem << "timestamp":1669365073
    2022-11-25T08:31:13.809Z DEBUG modem << },
    2022-11-25T08:31:13.810Z DEBUG modem << "ts":{
    2022-11-25T08:31:13.811Z DEBUG modem << "timestamp":1669365073
    2022-11-25T08:31:13.811Z DEBUG modem << }
    2022-11-25T08:31:13.812Z DEBUG modem << }
    2022-11-25T08:31:13.813Z DEBUG modem << },
    2022-11-25T08:31:13.813Z DEBUG modem << "version":1,
    2022-11-25T08:31:13.814Z DEBUG modem << "timestamp":1669365073
    2022-11-25T08:31:13.815Z DEBUG modem << }
    2022-11-25T08:31:23.920Z DEBUG modem << +CSCON: 0
    2022-11-25T08:31:23.938Z DEBUG modem << RRC mode: Idle

    What IDE are you using? Have you ensured that the sample built correctly?

    When flashing the modem firmware, I have tried with and without MCU Enabled

    What do you mean with this?

    Shouldn’t I be getting some kind of feedback from the LEDs? Even if I run the app with the SIM card removed?

    If you remove the SIM card and restart the device you should get the following output:

    2022-11-25T08:36:39.187Z DEBUG modem << *** Booting Zephyr OS build v3.1.99-ncs1-1  ***
    2022-11-25T08:36:39.189Z DEBUG modem << I: Starting bootloader
    2022-11-25T08:36:39.209Z DEBUG modem << I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    2022-11-25T08:36:39.211Z DEBUG modem << I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    2022-11-25T08:36:39.212Z DEBUG modem << I: Boot source: none
    2022-11-25T08:36:39.213Z DEBUG modem << I: Swap type: none
    2022-11-25T08:36:39.271Z DEBUG modem << I: Bootloader chainload address offset: 0x10000
    2022-11-25T08:36:39.274Z DEBUG modem << I: Jumping to the first image slot
    2022-11-25T08:36:39.992Z DEBUG modem << *** Booting Zephyr OS build v3.1.99-ncs1-1  ***
    2022-11-25T08:36:40.009Z DEBUG modem << The AWS IoT sample started, version: v1.0.0
    2022-11-25T08:36:40.290Z DEBUG modem << +CEREG: 90
    2022-11-25T08:36:40.317Z DEBUG modem << LTE cell changed: Cell ID: -1, Tracking area: -1

    Kind regards,
    Øyvind

Reply
  • Hello, 

    Shouldn’t I be getting some kind of feedback from the LEDs? Even if I run the app with the SIM card removed?

    This sample does not use any LEDs. All communication is visbile in e.g. LTE Link Monitor. Here is my output when running the AWS_IOT sample following the AWS IOT documentation

    2022-11-25T08:31:07.621Z DEBUG modem << *** Booting Zephyr OS build v3.1.99-ncs1-1  ***
    2022-11-25T08:31:07.638Z DEBUG modem << I: Starting bootloader
    2022-11-25T08:31:07.640Z DEBUG modem << I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    2022-11-25T08:31:07.641Z DEBUG modem << I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    2022-11-25T08:31:07.643Z DEBUG modem << I: Boot source: none
    2022-11-25T08:31:07.644Z DEBUG modem << I: Swap type: none
    2022-11-25T08:31:07.705Z DEBUG modem << I: Bootloader chainload address offset: 0x10000
    2022-11-25T08:31:07.708Z DEBUG modem << I: Jumping to the first image slot
    2022-11-25T08:31:08.426Z DEBUG modem << *** Booting Zephyr OS build v3.1.99-ncs1-1  ***
    2022-11-25T08:31:08.443Z DEBUG modem << The AWS IoT sample started, version: v1.0.0
    2022-11-25T08:31:09.521Z DEBUG modem << +CEREG: 2,"7AA9","01172803",7
    2022-11-25T08:31:09.551Z DEBUG modem << LTE cell changed: Cell ID: 18294787, Tracking area: 31401
    2022-11-25T08:31:09.569Z DEBUG modem << +CSCON: 1
    2022-11-25T08:31:09.571Z DEBUG modem << RRC mode: Connected
    2022-11-25T08:31:10.413Z DEBUG modem << +CEREG: 1,"7AA9","01172803",7,,,"00001010","11000001"
    2022-11-25T08:31:10.433Z DEBUG modem >> AT+COPS=3,2
    2022-11-25T08:31:10.449Z DEBUG modem << Network registration status: Connected - home network
    2022-11-25T08:31:10.467Z DEBUG modem << PSM parameter update: TAU: 1152000, Active time: 20
    2022-11-25T08:31:10.470Z DEBUG modem << %XTIME: "40","22115280130140","00"
    2022-11-25T08:31:10.472Z DEBUG modem << Date time obtained
    2022-11-25T08:31:10.473Z DEBUG modem << Next connection retry in 30 seconds
    2022-11-25T08:31:10.474Z DEBUG modem << AWS_IOT_EVT_CONNECTING
    2022-11-25T08:31:10.475Z DEBUG modem << OK
    2022-11-25T08:31:10.478Z DEBUG modem >> AT+COPS?
    2022-11-25T08:31:10.496Z DEBUG modem << +COPS: 0,2,"24201",7
    2022-11-25T08:31:10.499Z DEBUG modem << OK
    2022-11-25T08:31:10.519Z DEBUG modem >> AT%XCBAND
    2022-11-25T08:31:10.536Z DEBUG modem << %XCBAND: 20
    2022-11-25T08:31:10.538Z DEBUG modem << OK
    2022-11-25T08:31:10.544Z DEBUG modem >> AT+CGDCONT?
    2022-11-25T08:31:10.563Z DEBUG modem << +CGDCONT: 0,"IPV4V6","telenor.iot","10.112.143.189 2A02:2121:0080:3660:0000:006B:1DCE:4201",0,0
    2022-11-25T08:31:10.565Z DEBUG modem << OK
    2022-11-25T08:31:10.584Z DEBUG modem >> AT+CGACT?
    2022-11-25T08:31:10.683Z DEBUG modem << +CGACT: 0,1
    2022-11-25T08:31:10.728Z DEBUG modem << OK
    2022-11-25T08:31:13.318Z DEBUG modem << AWS_IOT_EVT_CONNECTED
    2022-11-25T08:31:13.335Z DEBUG modem << Publishing: {
    2022-11-25T08:31:13.337Z DEBUG modem << "state":{
    2022-11-25T08:31:13.338Z DEBUG modem << "reported":{
    2022-11-25T08:31:13.339Z DEBUG modem << "app_version":"v1.0.0",
    2022-11-25T08:31:13.341Z DEBUG modem << "batv":5074,
    2022-11-25T08:31:13.342Z DEBUG modem << "ts":1669365072799
    2022-11-25T08:31:13.343Z DEBUG modem << }
    2022-11-25T08:31:13.344Z DEBUG modem << }
    2022-11-25T08:31:13.345Z DEBUG modem << } to AWS IoT broker
    2022-11-25T08:31:13.456Z DEBUG modem << +CEREG: 1,"7AA9","01172803",7,,,"00100001","00000011"
    2022-11-25T08:31:13.475Z DEBUG modem >> AT+COPS=3,2
    2022-11-25T08:31:13.492Z DEBUG modem << PSM parameter update: TAU: 1800, Active time: 60
    2022-11-25T08:31:13.509Z DEBUG modem << OK
    2022-11-25T08:31:13.512Z DEBUG modem << AWS_IOT_EVT_READY
    2022-11-25T08:31:13.513Z DEBUG modem >> AT+COPS?
    2022-11-25T08:31:13.532Z DEBUG modem << +COPS: 0,2,"24201",7
    2022-11-25T08:31:13.534Z DEBUG modem << OK
    2022-11-25T08:31:13.554Z DEBUG modem >> AT%XCBAND
    2022-11-25T08:31:13.570Z DEBUG modem << AWS_IOT_EVT_PUBACK, message ID: 48867
    2022-11-25T08:31:13.587Z DEBUG modem << %XCBAND: 20
    2022-11-25T08:31:13.589Z DEBUG modem << OK
    2022-11-25T08:31:13.593Z DEBUG modem >> AT+CGDCONT?
    2022-11-25T08:31:13.616Z DEBUG modem << +CGDCONT: 0,"IPV4V6","telenor.iot","10.112.143.189 2A02:2121:0080:3660:0000:006B:1DCE:4201",0,0
    2022-11-25T08:31:13.618Z DEBUG modem << OK
    2022-11-25T08:31:13.635Z DEBUG modem >> AT+CGACT?
    2022-11-25T08:31:13.653Z DEBUG modem << +CGACT: 0,1
    2022-11-25T08:31:13.655Z DEBUG modem << OK
    2022-11-25T08:31:13.737Z DEBUG modem << AWS_IOT_EVT_DATA_RECEIVED
    2022-11-25T08:31:13.787Z DEBUG modem << Data received from AWS IoT console:
    2022-11-25T08:31:13.790Z DEBUG modem << Topic: $aws/things/thing_299079/shadow/get/accepted
    2022-11-25T08:31:13.792Z DEBUG modem << Message: {
    2022-11-25T08:31:13.793Z DEBUG modem << "state":{
    2022-11-25T08:31:13.794Z DEBUG modem << "reported":{
    2022-11-25T08:31:13.796Z DEBUG modem << "app_version":"v1.0.0",
    2022-11-25T08:31:13.796Z DEBUG modem << "batv":5074,
    2022-11-25T08:31:13.797Z DEBUG modem << "ts":1669365072799
    2022-11-25T08:31:13.798Z DEBUG modem << }
    2022-11-25T08:31:13.798Z DEBUG modem << },
    2022-11-25T08:31:13.799Z DEBUG modem << "metadata":{
    2022-11-25T08:31:13.802Z DEBUG modem << "reported":{
    2022-11-25T08:31:13.803Z DEBUG modem << "app_version":{
    2022-11-25T08:31:13.805Z DEBUG modem << "timestamp":1669365073
    2022-11-25T08:31:13.806Z DEBUG modem << },
    2022-11-25T08:31:13.807Z DEBUG modem << "batv":{
    2022-11-25T08:31:13.808Z DEBUG modem << "timestamp":1669365073
    2022-11-25T08:31:13.809Z DEBUG modem << },
    2022-11-25T08:31:13.810Z DEBUG modem << "ts":{
    2022-11-25T08:31:13.811Z DEBUG modem << "timestamp":1669365073
    2022-11-25T08:31:13.811Z DEBUG modem << }
    2022-11-25T08:31:13.812Z DEBUG modem << }
    2022-11-25T08:31:13.813Z DEBUG modem << },
    2022-11-25T08:31:13.813Z DEBUG modem << "version":1,
    2022-11-25T08:31:13.814Z DEBUG modem << "timestamp":1669365073
    2022-11-25T08:31:13.815Z DEBUG modem << }
    2022-11-25T08:31:23.920Z DEBUG modem << +CSCON: 0
    2022-11-25T08:31:23.938Z DEBUG modem << RRC mode: Idle

    What IDE are you using? Have you ensured that the sample built correctly?

    When flashing the modem firmware, I have tried with and without MCU Enabled

    What do you mean with this?

    Shouldn’t I be getting some kind of feedback from the LEDs? Even if I run the app with the SIM card removed?

    If you remove the SIM card and restart the device you should get the following output:

    2022-11-25T08:36:39.187Z DEBUG modem << *** Booting Zephyr OS build v3.1.99-ncs1-1  ***
    2022-11-25T08:36:39.189Z DEBUG modem << I: Starting bootloader
    2022-11-25T08:36:39.209Z DEBUG modem << I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    2022-11-25T08:36:39.211Z DEBUG modem << I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    2022-11-25T08:36:39.212Z DEBUG modem << I: Boot source: none
    2022-11-25T08:36:39.213Z DEBUG modem << I: Swap type: none
    2022-11-25T08:36:39.271Z DEBUG modem << I: Bootloader chainload address offset: 0x10000
    2022-11-25T08:36:39.274Z DEBUG modem << I: Jumping to the first image slot
    2022-11-25T08:36:39.992Z DEBUG modem << *** Booting Zephyr OS build v3.1.99-ncs1-1  ***
    2022-11-25T08:36:40.009Z DEBUG modem << The AWS IoT sample started, version: v1.0.0
    2022-11-25T08:36:40.290Z DEBUG modem << +CEREG: 90
    2022-11-25T08:36:40.317Z DEBUG modem << LTE cell changed: Cell ID: -1, Tracking area: -1

    Kind regards,
    Øyvind

Children
No Data
Related