I'm having issues with NBSSLClient dying right in the middle of a write and going into an infinite loop in synchronous mode.
I'm sending HTTPS POST messages which can work fine for for several minutes or hours, however, eventually the write() dies right in the middle of a 'client.println()' statement. Because the system is in synchronous mode it goes into an infinite loop polling the serial port in NBClient.ready() waiting on MODEM.ready(). The loop is caused by the line 'while (ready() == 0);' in NBClient.cpp.
I've tried the library in asynchronous mode but it seems that a lot of changes will be necessary from top to bottom to properly support asynch.
What are the causes of this loop? Is my connection being dropped by either the modem or the receiver? I'm not sure how to debug this one.
Here is the output of one of my POSTs:
Attempting cellular modem connection
Attempting to transmit device state to cloud services
AT
OK
AT+CMEE=0
OK
AT+CFUN=0
OK
AT+CPIN?
+CPIN: READY
OK
AT+CMGF=1
OK
AT+UDCONF=1,1
OK
AT+CTZU=1
OK
AT+CGDCONT=1,"IP","hologram"
OK
AT+UAUTHREQ=1,0
OK
AT+CFUN=1
OK
AT+CEREG?
+CEREG: 0,0
OK
AT+CEREG?
+CEREG: 0,0
OK
AT+CEREG?
+CEREG: 0,2
OK
AT+CEREG?
+CEREG: 0,2
OK
AT+CEREG?
+CEREG: 0,2
OK
AT+CEREG?
+CEREG: 0,2
OK
AT+CEREG?
+CEREG: 0,5
OK
Connected to tower
AT+CGATT=1
OK
AT+CGACT?
+CGACT: 1,1
OK
Connected to internet
AT+USOCR=6
+USOCR: 0
OK
AT+USOSEC=0,1,0
OK
AT+USECPRF=0,0,0
OK
AT+USOCO=0,"api.xxxxxxxxxxx.com",443
OK
Connected
Sending device state
AT+USOWR=0,5,"504F535420"
+USOWR: 0,5
OK
AT+USOWR=0,47,"2F6170706C69636174696F6E732F3564643832653231393238353638303030376561393733382F646576696365732F"
+USOWR: 0,47
OK
AT+USOWR=0,24,"356535353837646239326631356630303037353230313461"
+USOWR: 0,24
OK
AT+USOWR=0,6,"2F7374617465"
+USOWR: 0,6
OK
AT+USOWR=0,9,"20485454502F312E31"
+USOWR: 0,9
OK
AT+USOWR=0,2,"0D0A"
+USOWR: 0,2
OK
AT+USOWR=0,30,"436F6E74656E742D547970653A206170706C69636174696F6E2F6A736F6E"
+USOWR: 0,30
OK
AT+USOWR=0,2,"0D0A"
+USOWR: 0,2
OK
AT+USOWR=0,17,"436F6E6E656374696F6E3A20636C6F7365"
+USOWR: 0,17
OK
AT+USOWR=0,2,"0D0A"
+USOWR: 0,2
OK
AT+USOWR=0,22,"417574686F72697A6174696F6E3A2042656172657220"
+USOWR: 0,22
OK
AT+USOWR=0,256,"65794A68624763694F694A49557A49314E694973496E523563434936496B705856434A392E65794A7A645749694F6949315A544D355A44686C4D6D45304F54426B4D4441774D445A695A6A41325A5751694C434A7A64574A306558426C496A6F6959584270564739725A5734694C434A7A593239775A53493657794A6B5A585A705932557559323974625746755A464E30636D566862534973496D526C646D6C6A5A53356B5A574A315A794973496D526C646D6C6A5A53356B5A57786C644755694C434A6B5A585A70593255755A58687762334A30496977695A47563261574E6C4C6D646C64434973496D526C646D6C6A5A53356E5A58524462323174595735"
+USOWR: 0,256
OK
AT+USOWR=0,256,"6B496977695A47563261574E6C4C6D646C64454E766258427663326C305A564E305958526C496977695A47563261574E6C4C6D646C644578765A30567564484A705A584D694C434A6B5A585A70593255755A32563055335268644755694C434A6B5A585A705932557563474630593267694C434A6B5A585A7059325575636D567462335A6C5247463059534973496D526C646D6C6A5A53357A5A57356B51323974625746755A434973496D526C646D6C6A5A53357A5A57356B55335268644755694C434A6B5A585A70593255756332563051323975626D566A64476C76626C4E305958523163794973496D526C646D6C6A5A53357A644746305A564E30636D56"
+USOWR: 0,256
OK
AT+USOWR=0,111,"6862534A644C434A70595851694F6A45314F4441344E446B7A4E7A6773496D6C7A63794936496D46776153356E5A58527A64484A31593352
And there it hangs forever.
Thanks for any ideas.