nRF9160 thingy91 - AWS IOT (sample): Connect errors -11 and -10

Hello All,

This is from an app I had working 1 1/2 months ago - when I've tried recently to get it connected again, I haven't been successful.

The latest asset tracker appears to work find and posts data to the nRF Cloud.

I've seen previous posts - DNS is working - or appears to be ok.

I'm getting the following:

===

+CSCON: 0


RRC mode: Idle


Next connection retry in 30 seconds


AWS_IOT_EVT_CONNECTING


+CSCON: 1


RRC mode: Connected


E: getaddrinfo, error -11


E: client_broker_init, error: -10


AWS_IOT_EVT_CONNECTING


+CSCON: 0


RRC mode: Idle


Next connection retry in 30 seconds


AWS_IOT_EVT_CONNECTING


+CSCON: 1


RRC mode: Connected


E: getaddrinfo, error -11


E: client_broker_init, error: -10


AWS_IOT_EVT_CONNECTING


+CSCON: 0


RRC mode: Idle

====

I can reload the asset tracker and it'll work fine.  I'm running the AWS_IOT sample code.

Thanks in advance as to what -11 and -10 mean - it would appear getting the address fails - I tried to find error codes that make sense but not sure and wanted to ask in case something has changed in the last 1 1/2 months.  This app used to run without issue.

Thanks!
jwest

  • Hi,

    Thanks in advance as to what -11

    The -11 comes from getaddrinfo, which has it's own error codes. You can find them here: https://github.com/nrfconnect/sdk-zephyr/blob/main/include/net/dns_resolve.h#L122

    and -10 mean

    This is a normal errno error number, you can find them here: https://github.com/zephyrproject-rtos/zephyr/blob/main/lib/libc/minimal/include/errno.h#L49

    Remember to look at the right version of the file, as the numbers has changed over time.

    This is from an app I had working 1 1/2 months ago
    I'm running the AWS_IOT sample code.

    Are you running an old build of the aws_iot sample, that used to work?

    If so, what version is the build based on, and did you make any changes?

    Or are you running a new build, of an old version of the sample?

    Then, again, I would need to know what version of the sample you are using, and if you have made any changes to it, in addition, I would  like to know which toolchain version you used when building the sample.

    Or, are you using a new version of the aws_iot sample which doesn't work, but earlier you used an older version which did work?

    Then again, I have similar questions. Which SDK versions are involved, and have you made any modifications to either of the versions?

    And, regardless of the above, which modem FW version are you using, and what SIM card are you using?

    Is it possible that hte SIM card is out of data?

    Best regards,

    Didrik

  • Hello Didrik,

    I found this:

    https://github.com/nrfconnect/sdk-nrf/blob/v1.7.1/lib/nrf_modem_lib/nrf91_sockets.c#L502

    Appears to be the default return - return DNS_EAI_SYSTEM;

    According to the AT commands I've checked - DNS is supposed to be OK here.

    I've looked at the addresses AWS assigns - they're pingable but obviously assigned from a pool -
    and you can't count on them being assigning the same address on consecutive attempts (like what a WiFi router does when it
    sees the same MAC address).

    I found this thread, which is helpful:

    https://devzone.nordicsemi.com/f/nordic-q-a/77231/nrf9160-getaddrinfo-return-dns_eai_system-and-errno-0/319300

    When I did my 'original' search - I didn't find that for some reason, but I did find a thread that mentioned something could be up with DNS.

    I did add this to my code:

    #include <nrf_socket.h>

    struct nrf_in_addr dns;

    ...

    in main()

    dns.s_addr = 134744072; // Google DNS, 8.8.8.8

    const int error1 = nrf_setdnsaddr(2, &dns);
    printk("DNS set result %d\n", error1);

    before modem_configure();

    after I saw the first -11 error.

    Regards,
    johnwest

  • Didrik,

    I'm seeing this when I boot:

    ** Booting Zephyr OS build v2.6.99-ncs1-1  ***
    
    
    
    
    Flash regions
    	
    	
    Domain
    	
    	
    Permissions
    
    
    
    
    00 02 0x00000 0x18000 
    	
    Secure
    	
    	
    rwxl
    
    
    
    
    03 31 0x18000 0x100000 
    	
    Non-Secure
    	
    rwxl
    
    
    
    
    
    
    
    
    Non-secure callable region 0 placed in flash region 2 with size 32.
    
    
    
    
    
    
    
    
    SRAM region
    	
    	
    Domain
    	
    	
    Permissions
    
    
    
    
    00 07 0x00000 0x10000 
    	
    Secure
    	
    	
    rwxl
    
    
    
    
    08 31 0x10000 0x40000 
    	
    Non-Secure
    	
    rwxl
    
    
    
    
    
    
    
    
    Peripheral
    	
    	
    Domain
    	
    	
    Status
    
    
    
    
    00 NRF_P0               Non-Secure
    	
    OK
    
    
    
    
    01 NRF_CLOCK            Non-Secure
    	
    OK
    
    
    
    
    02 NRF_RTC0             Non-Secure
    	
    OK
    
    
    
    
    03 NRF_RTC1             Non-Secure
    	
    OK
    
    
    
    
    04 NRF_NVMC             Non-Secure
    	
    OK
    
    
    
    
    05 NRF_UARTE1           Non-Secure
    	
    OK
    
    
    
    
    06 NRF_UARTE2           Secure
    	
    	
    SKIP
    
    
    
    
    07 NRF_TWIM2            Non-Secure
    	
    OK
    
    
    
    
    08 NRF_SPIM3            Non-Secure
    	
    OK
    
    
    
    
    09 NRF_TIMER0           Non-Secure
    	
    OK
    
    
    
    
    10 NRF_TIMER1           Non-Secure
    	
    OK
    
    
    
    
    11 NRF_TIMER2           Non-Secure
    	
    OK
    
    
    
    
    12 NRF_SAADC            Non-Secure
    	
    OK
    
    
    
    
    13 NRF_PWM0             Non-Secure
    	
    OK
    
    
    
    
    14 NRF_PWM1             Non-Secure
    	
    OK
    
    
    
    
    15 NRF_PWM2             Non-Secure
    	
    OK
    
    
    
    
    16 NRF_PWM3             Non-Secure
    	
    OK
    
    
    
    
    17 NRF_WDT              Non-Secure
    	
    OK
    
    
    
    
    18 NRF_IPC              Non-Secure
    	
    OK
    
    
    
    
    19 NRF_VMC              Non-Secure
    	
    OK
    
    
    
    
    20 NRF_FPU              Non-Secure
    	
    OK
    
    
    
    
    21 NRF_EGU1             Non-Secure
    	
    OK
    
    
    
    
    22 NRF_EGU2             Non-Secure
    	
    OK
    
    
    
    
    23 NRF_DPPIC            Non-Secure
    	
    OK
    
    
    
    
    24 NRF_REGULATORS       Non-Secure
    	
    OK
    
    
    
    
    25 NRF_PDM              Non-Secure
    	
    OK
    
    
    
    
    26 NRF_I2S              Non-Secure
    	
    OK
    
    
    
    
    27 NRF_GPIOTE1          Non-Secure
    	
    OK
    
    
    
    
    
    
    
    
    SPM: NS image at 0x18200
    
    
    
    
    SPM: NS MSP at 0x2001f800
    
    
    
    
    SPM: NS reset vector at 0x1e2bd
    
    
    
    
    SPM: prepare to jump to Non-Secure image.
    
    
    
    
    *** Booting Zephyr OS build v2.6.99-ncs1-1  ***
    
    
    
    
    The AWS IoT sample started, version: v1.0.0 
    
    
    
    
    W: Already initialized. Nothing to do
    
    
    
    
    +CEREG: 2,"8B53","0A301B3F",7
    
    
    
    
    LTE cell changed: Cell ID: 170924863, Tracking area: 35667
    
    
    
    
    +CSCON: 1
    
    
    
    
    RRC mode: Connected
    
    
    
    
    +CEREG: 1,"8B53","0A301B3F",7,,,"11100000","11100000"
    
    
    
    
    Network registration status: Connected - home network
    
    
    
    
    Next connection retry in 30 seconds
    
    
    
    
    PSM parameter update: TAU: -1, Active time: -1
    
    
    
    
    AWS_IOT_EVT_CONNECTING
    
    
    
    
    AT+COPS=3,2
    
    
    
    
    OK
    
    
    
    
    AT+COPS?
    
    
    
    
    +COPS: 0,2,"310410",7
    
    
    
    
    OK
    
    
    
    
    AT%XCBAND
    
    
    
    
    %XCBAND: 2
    
    
    
    
    OK
    
    
    
    
    AT+CGDCONT?
    
    
    
    
    +CGDCONT: 0,"IP","m2m.com.attz","10.33.176.184",0,0
    
    
    
    
    OK
    
    
    
    
    AT+CGACT?
    
    
    
    
    +CGACT: 0,1
    
    
    
    
    OK
    
    
    
    
    E: getaddrinfo, error -11
    
    
    
    
    E: client_broker_init, error: -10
    
    
    
    
    AWS_IOT_EVT_CONNECTING
    
    
    
    
    DATE_TIME_OBTAINED_NTP
    
    
    
    
    +CSCON: 0
    
    
    
    
    RRC mode: Idle
    
    
    
    
    Next connection retry in 30 seconds
    
    
    
    
    AWS_IOT_EVT_CONNECTING
    
    
    
    
    +CSCON: 1
    
    
    
    
    RRC mode: Connected
    
    
    
    
    E: getaddrinfo, error -11
    
    
    
    
    E: client_broker_init, error: -10
    
    
    
    
    AWS_IOT_EVT_CONNECTING

    Regards,
    johnwest

  • Didrik,

    Just saw one of these again - 

    W: connection_poll_start failed, error: -119
    
    
    Regards,
    johnwest
  • Hi,

    Thanks in advance as to what -11

    The -11 comes from getaddrinfo, which has it's own error codes. You can find them here: https://github.com/nrfconnect/sdk-zephyr/blob/main/include/net/dns_resolve.h#L122

    and -10 mean

    This is a normal errno error number, you can find them here: https://github.com/zephyrproject-rtos/zephyr/blob/main/lib/libc/minimal/include/errno.h#L49

    Remember to look at the right version of the file, as the numbers has changed over time.

    This is from an app I had working 1 1/2 months ago
    I'm running the AWS_IOT sample code.

    Are you running an old build of the aws_iot sample, that used to work?

    If so, what version is the build based on, and did you make any changes?

    Or are you running a new build, of an old version of the sample?

    Then, again, I would need to know what version of the sample you are using, and if you have made any changes to it, in addition, I would  like to know which toolchain version you used when building the sample.

    Or, are you using a new version of the aws_iot sample which doesn't work, but earlier you used an older version which did work?

    Then again, I have similar questions. Which SDK versions are involved, and have you made any modifications to either of the versions?

    And, regardless of the above, which modem FW version are you using, and what SIM card are you using?

    Is it possible that hte SIM card is out of data?

    Best regards,

    Didrik

    Didrik,

    Running what's in v1.7.1 - with latest firmware - 1.3.1.

    Using 5.64 of toolchain.

    AT&T Sim card.  I can switch back and forth to/from current assetTracker in v1.3.1 FW (10/20) - assetTracker posts fine to nrfCloud - after updating nRF Cloud certificate.

    Does this answer all of your questions?

    I guess a newbie mistake I made was to say "yes" to the Segger embedded studio where I had version 1.6 based AWS_IOT app running and 1.3.0 of modem firmware - I may have that hex file saved off.  That build failed and I moved to 5.64, 1.3.1. and 1.7.1.  The successful build made 1 1/2 months ago was 5.60 tools based.

    Thanks,
    johnwest

Related