Couldn't connect to Modem (modem_state=disconnected)
lte modem on a fipy ((1.20.2.rc9 with LR220.127.116.11-48829)) has gone AWOL. sqnsupgrade_info says "Cannot determine modem state!" Tried pycom.lte_modem_en_on_boot(1) as an act of desperation, didn't work.
I googled the problem but no obvious solution. Can someone please suggest a method to get the modem back? I presume the problem is the internal uart interface between the fipy & the modem?
That is quite a hunch you got there :). To be honest I'd have to check that in more detail (In my quick test here using this example code, I was not able to spot a noticeable difference over time between a Lopy4, Fipy or Gpy sitting right next to each other):
from network import WLAN import time import machine wlan = WLAN(mode=WLAN.STA) while True: nets = wlan.scan() for net in nets: if(net.ssid == 'ssid'): print(net.ssid, net.rssi) time.sleep(10)
Do you perhaps have different devices to test your hunch with?
For the original issue, Im currently having some reception issues from within the office, but It's still on my list!
@Gijs I'm perusing a hunch that maybe the fipy is deafer to wifi than our gpys because of the inability to switch off the lora radio, maybe caused by some local oscillator leakage? The fipy definitely reports lower wifi signal strengths than the gpys in the same location.
Thanks for sending that through, I'll be testing your example, thanks a lot!
You can re-enable the heartbeat (4s. flash) by using
import pycom; pycom.heartbeat_on_boot(True).
Im not familiar with the wifi issues you mention, we do sometimes have issues with our router though, where it stops broadcasting the 2.4GHz WiFi network, but other than that Im not aware of issues with devices and connecting. Perhaps you could elaborate? Though I have no clue where the issue would be, if there is one.
import os, network, machine, time; begin=time.ticks_ms() def _t(): t=(time.ticks_ms()-begin)//1000; now='0'+str(t) if t<10 else str(t); return now def _end(reason): print(_t(), reason); machine.reset() print(_t(), os.uname(), os.uname()) print(_t(), 'lte'); lte=network.LTE() print(_t(), 'attach', end=' '); lte.attach() for i in range(9): time.sleep(1); print(i, end=' ') if lte.isattached(): print(); break else: print(); _end('attachment timeout') print(_t(), 'connect', end=' '); lte.connect() for i in range(2): time.sleep(1); print(i, end=' ') if lte.isconnected(): print(); break else: print(); _end('connect timeout') print(_t(), 'switch off radio'); lte.pppsuspend(); lte.send_at_cmd('at+cfun=0') _end('finish')
reliably sends the fipy modem awol here after the first run
00 FiPy 1.20.2.rc9 00 lte 03 attach 0 1 10 connect 0 12 switch off radio 17 finish >>> >>> 00 FiPy 1.20.2.rc9 00 lte Traceback (most recent call last): File "<stdin>", line 9, in <module> OSError: Couldn't connect to Modem (modem_state=disconnected)
There also seems to be some wifi issues this firmware as well in that the lopy is very reluctant to connect to the office router here, a problem we didn't have before we upgraded to 1.20.2.rc9
This firmware doesn't flash the rgb led blue every 4s either (like earlier firmwares do when not running user code) so it's difficult to know what state the device is in too .
@kjm Could you send an example code or some steps that we can take to reproduce this? Its not something that should happen I think, but I have no clear reproduction on what causes it
I finally got to the bottom of this. On this device with these firmwares the at+cfun=0 cmd (supposedly for switching the lte radio off) actually disconnects the lte modem uart. The only fix is to either stop using that particular cmd or recycle the power.
To clarify, this did not happen during the update process right?
Im assuming you already tried to disconnect power and reconnect it again, and that
lte.factory_reset()is also not working for you. Could you try
sqnsupgrade.info(debug=True)and let me know of the output