pycom / pycom-libraries

MicroPython libraries and examples that work out of the box on Pycom's IoT modules
333 stars 375 forks source link

Sqnsupgrade via UART fails on FiPy: object 'LTE' has no attribute 'modem_upgrade_mode' #72

Open pirate opened 6 years ago

pirate commented 6 years ago

I'm trying to get my FiPy to work with the Hologram SIM card in Canada. I've tested the SIM in my iPhone and it works fine, it hops around between networks for a few min but eventually successfully joins ROGERS and receives SMS and data over LTE. However, when I put the SIM in my FiPy and try connecting I just get the following on repeat, and it never manages to attach:

modem command: AT+CEREG?
response=['+CEREG: 2,0', 'OK']
tac=0
modem command: AT+CSQ
response=['+CSQ: 99,99', 'OK']
not attached: 5 secs

...many seconds later...

modem command: AT+CEREG?
response=['+CEREG: 2,4', 'OK']
tac=4
modem command: AT+CSQ
response=['+CSQ: 99,99', 'OK']
not attached: 465 secs

In the process of trying to get it to work I'm attempting an SQNS upgrade, but hit this error while following these instructions: https://docs.pycom.io/tutorials/lte/firmware (fyi there's also a broken link in those docs: https://github.com/pycom/pycom-libraries/lib/sqnsupgrade​ should be /tree/...)

Uploading project (main folder)...
Not safe booting, disabled in settings
Reading file status
[1/5] Writing file lib/sqnsbr.py
[2/5] Writing file lib/sqnscodec.py
[3/5] Writing file lib/sqnscrc.py
[4/5] Writing file lib/sqnstp.py
[5/5] Writing file lib/test_sd.py
Upload done, resetting board...
OKets Jun  8 2016 00:22:57

rst:0x7 (TG0WDT_SYS_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff8028,len:8
load:0x3fff8030,len:1728
load:0x4009fa00,len:0
load:0x4009fa00,len:14584
entry 0x400a059c
Pybytes library: v0.9.0
Preparing modem for upgrade...
Attempting AT wakeup...
Starting STP (DO NOT DISCONNECT POWER!!!)
Session opened: version 1, max transfer 8192 bytes
Sending 54854 bytes: [########################################] 100%
Bootrom updated successfully, switching to upgrade mode
Attempting AT auto-negotiation...
Going into MIRROR mode... please close this terminal to resume the upgrade via UART
Traceback (most recent call last):
  File "main.py", line 2, in <module>
  File "/flash/lib/sqnsupgrade.py", line 575, in uart
  File "/flash/lib/sqnsupgrade.py", line 503, in upgrade_uart
  File "/flash/lib/sqnsupgrade.py", line 309, in __run
  File "/flash/lib/sqnsupgrade.py", line 461, in uart_mirror
AttributeError: type object 'LTE' has no attribute 'modem_upgrade_mode'
Pycom MicroPython 1.18.0.r1 [v1.8.6-849-9569a73] on 2018-07-20; FiPy with ESP32
Type "help()" for more information.

After a power cycle it gets stuck here:

Your modem is in recovery mode. You will need to use updater.elf file to upgrade.
Preparing modem for upgrade...
Attempting AT auto-negotiation...

Attempting the computer side of the upgrade at this point fails as well:

>>> sqnsupgrade.run('/dev/tty.usbmodemPy1197bb', '/Users/squash/Downloads/CATM1-38638/CATM1-38638.dup', '/Users/squash/Downloads/CATM1-38638/updater.elf')
<<< Welcome to the SQN3330 firmware updater >>>
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/squash/Documents/Code/pycom/pycom-libraries/lib/sqnsupgrade/sqnsupgrade.py", line 585, in run
    sqnup.upgrade_ext(port, ffile, mfile, resume, debug, False)
  File "/Users/squash/Documents/Code/pycom/pycom-libraries/lib/sqnsupgrade/sqnsupgrade.py", line 515, in upgrade_ext
    success = self.__run(file_path=mfile, load_ffh=True, port=port, debug=debug, pkgdebug=pkgdebug)
  File "/Users/squash/Documents/Code/pycom/pycom-libraries/lib/sqnsupgrade/sqnsupgrade.py", line 271, in __run
    response = self.return_pretty_response(self.read_rsp(size=7))
  File "/Users/squash/Documents/Code/pycom/pycom-libraries/lib/sqnsupgrade/sqnsupgrade.py", line 81, in return_pretty_response
    lines = rsp.decode('ascii').split('\r\n')
UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position 0: ordinal not in range(128)
danspndl commented 6 years ago

Hi @pirate 👋

Thanks for reporting the link, I've fixed it. Have you tried both (SD card and UART) methods? Just to confirm, your modem is not bricked, right?

pirate commented 6 years ago

Thanks! I don't think it's bricked, haven't tried the SD card method as I don't have a spare SD card to do it with. I'll give uart another shot though and report back.

On Mon, Sep 3, 2018 at 6:44 AM Daniel Spindelbauer notifications@github.com wrote:

Hi @pirate https://github.com/pirate 👋

Thanks for reporting the link, I've fixed it. Have you tried both (SD card and UART) methods? Just to confirm, your modem is not bricked, right?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pycom/pycom-libraries/issues/72#issuecomment-418076660, or mute the thread https://github.com/notifications/unsubscribe-auth/AAfOC4DN-Rs0XjCnzLBbNpkObCNbobamks5uXQgpgaJpZM4WWrWZ .

-- --From Nick (Mobile)

GuilRies commented 6 years ago

Same problem here. Any luck?

danspndl commented 6 years ago

Hi @pirate and @GuilRies 👋

Could you make sure that you use the stable firmware? The latest version is 1.18.1.r1. Let me know if that fixes your issue

firew0rks commented 5 years ago

Using the latest firmware, as per @sdaniel55 suggestion worked. I upgraded my device using the Pycom Firmware Tool and upgraded the modem firmware using the UART method. I found that it only worked using the recovery method and referencing the updater.elf file on my computer instead of flashing it onto the device.

pirate commented 5 years ago

I wont have a chance to check this for another month or so (I'm traveling now), you're welcome to close it and I can reopen if I'm still having issues.