A
Hi,
( @cschloss , @panda )
I think the furthest we can get with the available documentation is using the '+CNMI' command. Unfortunately, it enables an unsolicited result code that we cannot truly listen with the current LTE implementation. Also, a 'hack' using raw UART is not very useful, as the UART interrupt is not implemented... We end up in a pooling loop, just like we would do with lte.send_at_cmd('AT+CMGL="ALL"').
If you would like to see the '+CNMI' feature working, here's a small poc:
import machine
import utime
from machine import UART
from network import LTE
lte = LTE() # instantiate the LTE object
lte.send_at_cmd('AT+CGDCONT=1,"IP","hologram"') # change this to something that works for you
lte.attach() # attach the cellular modem to a base station
while not lte.isattached():
print('Attaching...')
utime.sleep(0.25)
print('LTE attached')
# configure SMS New Message Indication
# Full message (+CMT):
lte.send_at_cmd('AT+CNMI=2,2,0,0,0')
# OR just notification with memory location (+CMTI):
# lte.send_at_cmd('AT+CNMI=2,1,0,0,0')
# 'Force' text mode
lte.send_at_cmd('AT+CMGF=1')
# 'hijack' the modem UART.
# The following pins are for FiPy. On GPy you should change to ('P5', 'P98', 'P7', 'P99')
uart = UART(1, baudrate=921600, pins=('P20', 'P18', 'P19', 'P17'))
print('Waiting for unsolicited result codes...')
# Now just send some SMSs and check the output
while True:
# Ugly, but UART interrupt handler is not an option...
if uart.any():
print(uart.read())
utime.sleep(1)
Unfortunately, we cannot go very far without access to the modem datasheet and learn how the interrupt behaves under different configurations and usage scenarios. Probably it's something that can only be enabled in the modem's firmware.
Sincerely I'm a bit disappointed with Pycom's LTE software stack that is lacking behind its highly capable hardware.