Help with debugging modem example problem
# help
r
Hello, I'm trying out this example
cellular/examples/monarch.toit
. I removed the
soracom.io
because my previous experience says it will find the correct one anyway. I've also entered the correct pins, which I can confirm works when talking to the modem with a separate uart testcode, to ask simple AT commands. However when I run the example, I can not create a cellular network. I'm using the same setup as last time, the only difference is the alpha version 44 -> alpha 69 and I'm using a different sim card.
Copy code
[toit] INFO: starting <v2.0.0-alpha.69>
[monarch] INFO: opening network

******************************************************************************
Decoding by `jag`, device has version <2.0.0-alpha.69>
******************************************************************************
EXCEPTION error. 
cellular unavailable
  0: open                      <sdk>/net/cellular.toit:47:19
  1: main                      ../src/sequans_modem/modem2/monarch.toit:37:14
******************************************************************************
When I use my other uart testcode, I can talk with modem:
Copy code
[toit] INFO: starting <v2.0.0-alpha.69>
[toit] DEBUG: clearing RTC memory: invalid checksum
+CEREG: 1,"36xx","027B6xx0",7
+SYSSTART
Got systart, starting modem
OK
OK
+CEREG: 2
+CEREG: 1,"36xx","02A54xx0",7
The testcode looks like this
Copy code
task::
      r := ?  
      while true:
          sleep --ms=1 
          r = ModemUart.readData
          if r and not r[0] == 255:
              e := catch:
                try:
                  y := r.to_string
                  print "$y"
                  if (y.contains "+SYSSTART"):
                    task::
                      print "Got systart, starting modem"
                      ModemUart.writeData "AT\n\r".to_byte_array 
                      sleep --ms=4_000  
                      ModemUart.writeData "AT+CFUN=1\n\r".to_byte_array 
                      //sleep --ms=6_000
                      //ModemUart.writeData "AT+PING=\"www.google.com\"\n\r".to_byte_array 
                finally:
                  //print r
              if e:
                print "EXC: $e"

          else:
            //print r
Copy code
+SYSSTART
Got systart, starting modem
OK
OK
+CEREG: 2
+CEREG: 1,"36xx","02A54xx0",7
+PING: 1,142.250.74.68,60,56
+PING: 2,142.250.74.68,130,56
+PING: 3,142.250.74.68,120,56
+PING: 4,142.250.74.68,110,56
OK
Pinging works too
k
Did you start the Monarch service? It looks like we can't find it at runtime.
(maybe it is as simple as installing the right container)
(maybe the example used to do it)
r
Oh I think i forgot that, I dont use jaguar for it. I should able to install the monarch in my envelope.
k
Indeed!
We've had to solve this for Artemis and we ended up putting the description of what goes into the firmware image in a file (fully declarative).
Copy code
"containers": {
  "cellular": {
    "entrypoint": "src/modules/sequans/monarch.toit",
    "git": "https://github.com/toitware/cellular.git",
    "branch": "v2.0.2",
    "background": true,
    "critical": true
  }
}
r
Yeah I will try that 😉 Stupid mistake from my side
how different is
network = wifi.open
from a
network = cellular.open config
. Both is of type
network/net.Client?
, but when I use a cellular network where i normally use a wifi network nothing works. I can ping with http, but not connect to mqtt etc
k
Maybe increase the amount of logging through the cellular config by lowering the cellular.log.level value to try to see what is going on?
r
Log level is already info, but I see nothing
Copy code
[monarch] INFO: Opening cellular network
[cellular] INFO: configuring apn {apn: }
[cellular] INFO: enabling radio
[cellular] INFO: connecting
[cellular] INFO: connected
thats all the log messages i see
k
Set it to debug?
You should get lots of AT output.
r
No more debug messages after the last info connected 😦
Copy code
[monarch] INFO: Opening cellular network
[cellular] DEBUG: -> AT
[cellular] DEBUG: <- OK
[cellular] DEBUG: -> ATE0
[cellular] DEBUG: <- OK
[cellular] DEBUG: -> AT+CMEE=2
[cellular] DEBUG: <- OK
[cellular] INFO: configuring apn {apn: }
[cellular] DEBUG: -> AT+CFUN=4
[cellular] DEBUG: <- OK
[cellular] DEBUG: <- +CEREG: 0
[cellular] DEBUG: <- *ignored* [URC] +CEREG [0]
[cellular] DEBUG: -> AT+CPIN?
[cellular] DEBUG: <- +CPIN: READY
[cellular] DEBUG: <- OK
[cellular] DEBUG: -> AT+CEREG=2
[cellular] DEBUG: <- OK
[cellular] DEBUG: -> AT+CPSMS=0
[cellular] DEBUG: <- OK
[cellular] DEBUG: -> AT+CEDRXS=0
[cellular] DEBUG: <- OK
[cellular] DEBUG: -> AT+SQNIBRCFG=0
[cellular] DEBUG: <- OK
Copy code
[cellular] DEBUG: -> AT+SQNIPSCFG=1,100
[cellular] DEBUG: <- OK
[cellular] DEBUG: -> AT+SQNBANDSEL=0,"standard","20,8"
[cellular] DEBUG: <- +SQNBANDSEL: <custom>
[cellular] DEBUG: <- OK
[cellular] DEBUG: -> AT+SQNBANDSEL=1,"standard","20,8"
[cellular] DEBUG: <- +CME ERROR: operation not supported
[cellular] DEBUG: -> AT+CGDCONT?
[cellular] DEBUG: <- +CGDCONT: 1,"IP","",,,,0,0,0,0,0,0,0,,0
[cellular] DEBUG: <- OK
[cellular] INFO: enabling radio
[cellular] DEBUG: -> AT+CFUN=1
[cellular] DEBUG: <- OK
[cellular] DEBUG: <- +CEREG: 2
[cellular] DEBUG: <- [URC] +CEREG [2]
[cellular] INFO: connecting
[cellular] DEBUG: -> AT+COPS=0,2
[cellular] DEBUG: <- OK
[cellular] DEBUG: -> AT+CEREG=2
[cellular] DEBUG: <- OK
[cellular] DEBUG: -> AT+CEREG?
[cellular] DEBUG: <- +CEREG: 2,2
[cellular] DEBUG: <- OK
[cellular] DEBUG: -> AT
[cellular] DEBUG: <- OK
[cellular] DEBUG: -> AT
[cellular] DEBUG: <- +CEREG: 1,"36D9","02A54E0C",7
[cellular] DEBUG: <- [URC] +CEREG [1, 36D9, 02A54E0C, 7]
[cellular] DEBUG: <- OK
[cellular] INFO: connected
[monarch] INFO: After Opening cellular network
I will look in the sequans docs
i removed the bands from config [20,8] but with no luck. I will keep looking
Okay the exc from ntp says
wifi ssid not provided
. So something funky is going on
Seems like I have to pass the network otherwise it expects wifi
result ::= ntp.synchronize --network=network
. I got debug messages from modem now:
Copy code
[cellular] DEBUG: -> AT+SQNDNSLKUP="pool.ntp.org"
[cellular] DEBUG: <- +SQNDNSLKUP: <custom>
[cellular] DEBUG: <- OK
[cellular] DEBUG: -> AT+SQNSD=1,1,123,"194.58.204.20",0,16384,1,0
[cellular] DEBUG: <- OK
[cellular] DEBUG: -> AT+SQNSSENDEXT=1,48
[cellular] DEBUG: <- >
[cellular] DEBUG: -> <48 bytes>
[cellular] DEBUG: <-  
[cellular] DEBUG: <- OK
[cellular] DEBUG: <- +SQNSRING: 1
[cellular] DEBUG: <- [URC] +SQNSRING [1]
[cellular] DEBUG: -> AT+SQNSI=1
[cellular] DEBUG: <- +SQNSI: 1,48,48,48,0
[cellular] DEBUG: <- OK
[cellular] DEBUG: -> AT+SQNSRECV=1,1500
[cellular] DEBUG: <- +SQNSRECV: <custom>
[cellular] DEBUG: <- OK
[cellular] DEBUG: -> AT+SQNSH=1
[cellular] DEBUG: <- OK