-
Notifications
You must be signed in to change notification settings - Fork 165
GPY Modem - ESP32 Cannot Communicate, LTE() function error #445
Description
GPY Modem-ESP32 Communication Issue
This document describes this hardware/firmware issue that dramatically impacts reliability and potential applications.
Issue Description
The fundamental issue reloves around this function in main.py:
lte = LTE()
The ESP32 is unable to connect to the modem, resulting in the error below from pycom-micropython-sigfox/esp32/mods/modlte.c
OSError: Couldn't connect to Modem (modem_state=disconnected)
After resetting, the problem repeats itself.
machine.reset()
After hundreds of soft resets, the LTE() function occasionally returns successfully and we are able to proceed with full functionality from then on.
But after one (or more) soft resets or spontaneous disconnects, the problem returns. The same happens when resets occur via WDT.
Power cycling will usually cause the module to operate properly on the first try, but not always. And the issue always returns after a period of time.
Firmware Version Tests
This problem is present with many firmware versions, including the experimental Dev branch of pycom-mircopython-sigfox.
- v1.18.2
- v1.18.2.r7
- v1.20.1
- v1.20.1.r2
- v1.20.2.rc6
- Development
I have used both the pre-compiled firmware as well as built it with pycom-esp-idf and the toolchain. Nothing fixes the problem.
I am using the latest stable version, CATM1-41065.dup firmware for the modem. It is almost impossible to downgrade because, obviously, I cannot communicate with the modem.
Hardware Tests
This problem is present in two different GPY modules using the Expansion Board 3.1 and the provided cellular antenna.
One module with a firmware test: (sysname='GPy', nodename='GPy', release='1.20.1.r2', version='v1.20.1.r2-5-gdb7f895-dirty on 2020-03-25', machine='GPy with ESP32')
Fix Attempts
Trying lte = LTE() from the CLI does exactly the same thing
Adding pycom.lte_modem_en_on_boot(False) does nothing
Other Instances
I am clearly not the only one with this issue. See these forum threads from 2018:
https://forum.pycom.io/topic/3129/lte-lte-getting-stuck-after-reset-fw-1-17-3-b1-on-fipy
Relevant Code
import pycom
import time
import os
from machine import WDT
from machine import SD
import machine
pycom.wdt_on_boot(True)
pycom.wdt_on_boot_timeout(240000)
wdt = WDT(timeout=240000) # enable it with a timeout of 240 seconds
wdt.init(240000)
wdt.feed()
import ujson
pycom.wifi_on_boot(False)
pycom.heartbeat(False)
from machine import Pin
from network import WLAN
wlan = WLAN()
wlan.antenna(WLAN.EXT_ANT)
wlan.deinit()
import socket
import ssl
from network import LTE
from network import Bluetooth
from simple import MQTTClient
import ubinascii
import array
from machine import RTC
if pycom.lte_modem_en_on_boot():
print("LTE on boot was enabled. Disabling.")
pycom.lte_modem_en_on_boot(False)
print("LTE()")
try:
lte = LTE()
except:
time.sleep(6)
machine.reset()
#we rarely get here...
print("LTE() done")
#rest of program...
Proposed Resolution
There must be a way to reset the communication lines between the ESP32 and the Modem without first executing lte = LTE(). I am comfortable building my own updated firmware with a solution from Pycom. However, I need assistance due to the complexity of the the LTE-related firmware and processes.
Thank you thank you thank you for any help in solving this issue!