http_client network error on thingy91

Hello,

I am trying to use http requests on Thingy91 and therefore I tried with the sample from zephyr/samples/net/sockets/http_client.

I can build the project without any problem but when I try to run it, I get the following error when I open a putty terminal:

I did not change anything in the code, and I was supposing it was not a network problem since I activated my SIM card and I can run the asset_tracker and see the data in nrFcloud without any issue.

I am using the nrfConnectSDK 2.0.0, and the SIM is from twilio.

Best regards,

C

  • Hi again,

    I downloaded again the https_client sample that connects to example.com with the given certificate (to be sure the error was not coming from the trials of connecting to google.com) and the error is there again.

    I also tried with a new Thingy and a new SIM, but it did not change much, the "getAddrInfo() failed" appears half of the time again.

    Do you have any ideas what I could try ?

  • Hello Carole,

    rupcar said:

    I also tried with a new Thingy and a new SIM, but it did not change much, the "getAddrInfo() failed" appears half of the time again.

    Do you have any ideas what I could try ?

    Which SIM card(s) are you using and who is the provider?  

    The first thing I would check is that there are no issues with the network connection. A good approach to do that with is by running the AT Client again with the commands I have provided. 

    Regards, 

    Markus 

  • Hi,

    Thank you for the quick answer.

    I am using Super SIM cards from Twilio.

    Here is the log I get when running the AT Commands:

    2022-07-27T12:12:14.652Z INFO Modem port is opened
    2022-07-27T12:12:14.662Z DEBUG modem >> AT+CFUN?
    2022-07-27T12:12:14.701Z DEBUG modem << +CFUN: 0
    2022-07-27T12:12:14.703Z DEBUG modem << OK
    2022-07-27T12:12:21.835Z DEBUG modem >> AT+CGMR
    2022-07-27T12:12:21.848Z DEBUG modem << mfw_nrf9160_1.3.2
    2022-07-27T12:12:21.850Z DEBUG modem << OK
    2022-07-27T12:12:34.840Z DEBUG modem >> AT%MDMEV=1
    2022-07-27T12:12:34.853Z DEBUG modem << OK
    2022-07-27T12:12:58.399Z DEBUG modem >> AT%XMODEMSLEEP=1,1000,60000
    2022-07-27T12:12:58.414Z DEBUG modem << %XMODEMSLEEP: 4
    2022-07-27T12:12:58.415Z DEBUG modem << OK
    2022-07-27T12:13:09.308Z DEBUG modem >> AT+CEREG=5
    2022-07-27T12:13:09.324Z DEBUG modem << OK
    2022-07-27T12:13:20.401Z DEBUG modem >> AT%CESQ=1
    2022-07-27T12:13:20.413Z DEBUG modem << OK
    2022-07-27T12:13:27.342Z DEBUG modem >> AT%XSYSTEMMODE?
    2022-07-27T12:13:27.357Z DEBUG modem << %XSYSTEMMODE: 1,0,0,0
    2022-07-27T12:13:27.360Z DEBUG modem << OK
    2022-07-27T12:13:34.503Z DEBUG modem >> AT+CFUN=1
    2022-07-27T12:13:34.545Z DEBUG modem << %XMODEMSLEEP: 4,0
    2022-07-27T12:13:34.547Z DEBUG modem << OK
    2022-07-27T12:13:36.209Z DEBUG modem << %CESQ: 53,2,19,2
    2022-07-27T12:13:36.221Z DEBUG modem << +CEREG: 2,"0065","01052508",7
    2022-07-27T12:13:36.312Z DEBUG modem << %CESQ: 48,2,20,2
    2022-07-27T12:13:40.116Z DEBUG modem << %CESQ: 50,2,25,3
    2022-07-27T12:13:43.102Z DEBUG modem << %MDMEV: SEARCH STATUS 2
    2022-07-27T12:13:43.107Z DEBUG modem << +CEREG: 5,"0065","01052508",7,,,"11100000","11100000"
    2022-07-27T12:13:43.115Z DEBUG modem >> AT+COPS=3,2
    2022-07-27T12:13:43.120Z DEBUG modem << OK
    2022-07-27T12:13:43.124Z DEBUG modem >> AT+COPS?
    2022-07-27T12:13:43.130Z DEBUG modem << +COPS: 0,2,"22801",7
    2022-07-27T12:13:43.132Z DEBUG modem << OK
    2022-07-27T12:13:43.143Z DEBUG modem >> AT%XCBAND
    2022-07-27T12:13:43.148Z DEBUG modem << %XCBAND: 20
    2022-07-27T12:13:43.153Z DEBUG modem << OK
    2022-07-27T12:13:43.159Z DEBUG modem >> AT+CGDCONT?
    2022-07-27T12:13:43.169Z DEBUG modem << +CGDCONT: 0,"IP","super","100.66.24.129",0,0
    2022-07-27T12:13:43.172Z DEBUG modem << OK
    2022-07-27T12:13:43.178Z DEBUG modem >> AT+CGACT?
    2022-07-27T12:13:43.188Z DEBUG modem << +CGACT: 0,1
    2022-07-27T12:13:43.190Z DEBUG modem << OK
    2022-07-27T12:13:43.936Z DEBUG modem << +CEREG: 0
    2022-07-27T12:13:44.762Z DEBUG modem << +CEREG: 2,"0065","01052508",7
    2022-07-27T12:13:45.236Z DEBUG modem << %CESQ: 255,0,255,0
    2022-07-27T12:13:48.621Z DEBUG modem << %CESQ: 49,2,17,2
    2022-07-27T12:13:48.722Z DEBUG modem << %CESQ: 47,2,22,3
    2022-07-27T12:13:52.386Z DEBUG modem << +CEREG: 5,"0065","01052508",7,,,"11100000","11100000"
    2022-07-27T12:13:52.393Z DEBUG modem >> AT+COPS=3,2
    2022-07-27T12:13:52.397Z DEBUG modem << OK
    2022-07-27T12:13:52.401Z DEBUG modem >> AT+COPS?
    2022-07-27T12:13:52.407Z DEBUG modem << +COPS: 0,2,"22801",7
    2022-07-27T12:13:52.409Z DEBUG modem << OK
    2022-07-27T12:13:52.415Z DEBUG modem >> AT%XCBAND
    2022-07-27T12:13:52.423Z DEBUG modem << %XCBAND: 20
    2022-07-27T12:13:52.424Z DEBUG modem << OK
    2022-07-27T12:13:52.430Z DEBUG modem >> AT+CGDCONT?
    2022-07-27T12:13:52.440Z DEBUG modem << +CGDCONT: 0,"IP","super","100.66.38.61",0,0
    2022-07-27T12:13:52.443Z DEBUG modem << OK
    2022-07-27T12:13:52.452Z DEBUG modem >> AT+CGACT?
    2022-07-27T12:13:52.457Z DEBUG modem << +CGACT: 0,1
    2022-07-27T12:13:52.459Z DEBUG modem << 
    2022-07-27T12:13:52.460Z DEBUG modem << OK
    2022-07-27T12:13:52.463Z DEBUG modem << +CEREG: 2,"0065","01052508",7
    2022-07-27T12:13:53.901Z DEBUG modem << %CESQ: 255,0,255,0
    2022-07-27T12:13:53.906Z DEBUG modem << +CEREG: 2
    2022-07-27T12:13:56.141Z DEBUG modem << %CESQ: 51,2,19,2
    2022-07-27T12:14:00.958Z DEBUG modem << %CESQ: 51,2,24,3
    

    I am not sure I understand what to deduce from there ?
    Thank you again!

  • rupcar said:

    I am using Super SIM cards from Twilio.

    Here is the log I get when running the AT Commands:

    Ok thanks, Carole! :-)

    rupcar said:

    I am not sure I understand what to deduce from there ?

    Looking at the provided log, I can see that the modem loses connection to the network quite immediately after it got attached to it.

    2022-07-27T12:13:44.762Z DEBUG modem << +CEREG: 2,"0065","01052508",7 
    
    2022-07-27T12:13:52.386Z DEBUG modem << +CEREG: 5,"0065","01052508",7,,,"11100000","11100000" 
    
    ... 
    
    2022-07-27T12:13:52.463Z DEBUG modem << +CEREG: 2,"0065","01052508",7 
    
    2022-07-27T12:13:53.901Z DEBUG modem << %CESQ: 255,0,255,0 
    
    2022-07-27T12:13:53.906Z DEBUG modem << +CEREG: 2 

    rupcar said:
    the "getAddrInfo() failed" appears half of the time again.

    That could explain the error you are facing. 

    Did you start your Thingy:91 for the first time after a longer shut-down period or has the device been reset/restarted a couple of times before the log was recorded? I ask because this might make a significant difference if the modem performs a cold start or not. 

    Cheers, 

    Markus 

  • Hi again,


    Actually, after a second check, it seems like when I turn it on for the first time, I have the error. If I turn it off and back on again pretty quickly, I still have the error. Though, if after getting the error, I wait a few minutes (it still takes 5-10mn), this is what I get on the log after the error:

    2022-07-28T08:52:22.593Z DEBUG modem << getaddrinfo() failed, err 115
    2022-07-28T08:55:18.391Z DEBUG modem << [00:03:20.319,458] [0m<dbg> lte_lc: at_handler_cereg: +CEREG notification: +CEREG: 0
    2022-07-28T08:55:18.401Z DEBUG modem << [0m
    2022-07-28T08:55:18.408Z DEBUG modem << [00:03:20.319,610] [0m<dbg> lte_lc_helpers: parse_cereg: Network registration status: 0[0m
    2022-07-28T08:55:18.410Z DEBUG modem << [00:03:20.319,641] [0m<dbg> lte_lc_helpers: parse_cereg: LTE mode not found, error code: -22[0m
    2022-07-28T08:55:27.122Z DEBUG modem << [00:03:29.049,224] [0m<dbg> lte_lc: at_handler_cereg: +CEREG notification: +CEREG: 2,"0065","01052508",7
    2022-07-28T08:55:27.126Z DEBUG modem << [0m
    2022-07-28T08:55:27.130Z DEBUG modem << [00:03:29.049,438] [0m<dbg> lte_lc_helpers: parse_cereg: Network registration status: 2[0m
    2022-07-28T08:55:27.141Z DEBUG modem << [00:03:29.049,468] [0m<dbg> lte_lc_helpers: parse_cereg: LTE mode: 7[0m
    2022-07-28T08:55:27.145Z DEBUG modem << [00:03:29.145,599] [0m<dbg> lte_lc: at_handler_cscon: +CSCON notification[0m
    2022-07-28T08:55:35.364Z DEBUG modem << [00:03:37.289,794] [0m<dbg> lte_lc: at_handler_cereg: +CEREG notification: +CEREG: 5,"0065","01052508",7,,,"11100000","11100000"
    2022-07-28T08:55:35.368Z DEBUG modem << [0m
    2022-07-28T08:55:35.373Z DEBUG modem << [00:03:37.290,069] [0m<dbg> lte_lc_helpers: parse_cereg: Network registration status: 5[0m
    2022-07-28T08:55:35.380Z DEBUG modem << [00:03:37.290,100] [0m<dbg> lte_lc_helpers: parse_cereg: LTE mode: 7[0m
    2022-07-28T08:55:39.007Z DEBUG modem << [00:03:40.936,004] [0m<dbg> lte_lc: at_handler_cscon: +CSCON notification[0m
    2022-07-28T08:56:33.788Z DEBUG modem << [00:04:35.726,623] [0m<dbg> lte_lc: at_handler_cscon: +CSCON notification[0m
    2022-07-28T08:56:40.455Z DEBUG modem << [00:04:42.393,218] [0m<dbg> lte_lc: at_handler_cscon: +CSCON notification[0m
    2022-07-28T08:56:41.979Z DEBUG modem << [00:04:43.917,755] [0m<dbg> lte_lc: at_handler_cscon: +CSCON notification[0m
    2022-07-28T08:56:47.976Z DEBUG modem << [00:04:49.913,055] [0m<dbg> lte_lc: at_handler_cscon: +CSCON notification[0m
    

    and then, if I turn it off and back on, it works.

    It seems like the connection takes too long to get stable . It also happens when I used the asset_tracker, it takes a bit of time before it connects and I can see the data on nrfCloud. Do you have any suggestions on where is it coming from and how to manage it ?
    thank you!

    Carole

Related