Pycom GPy & FiPy Cellular LTE Firmware Update

Updated 31 January 2019

There are three levels of firmware upgrades that are required on Pycom gear. First, performing an upgrade on the firmware of any of the Pycom microcontrollers is a simple affair. Download the Pycom Firmware Update application as linked in the documentation at 1.2.2 Updating Firmware, install it, then follow the wizard – it tells you all you need to know.

A firmware upgrade on any of the expansion boards, except Expansion Board 2.0 that has no microcontroller, is documented in 4.2.1 Updating Firmware under the chapter heading 4. Pysense and Pytrack. However these instructions are brief to the point of terse so I documented a more complete procedure in Pycom Pysense & Pytrack: How to Update Firmware. These instructions now also apply to the Pyscan and Expansion Board 3.0.

While documenting my first steps in using the GPy I've uncovered a firmware update that is required on the Sequans Monarch SQN3330, which provides the cellular data capabilities in both the GPy and the FiPy. This document deals only with firmware updating the Sequans Monarch SQN3330, as mentioned in 5.5.3 Modem Firmware Update in the Pycom documentation.

5.5.3 Modem Firmware Update contains a warning which, honestly, is ambiguous. Is a firmware update always required or is it only required if upgrading to NB-IoT? I figure the conservative approach is to upgrade the firmware and try Cat-M1 first. If that's successful, we could go further and try NB-IoT.

NOTE: While working to understand the firmware upgrade process I managed to put the cellular radio in one FiPy into a state where it's unresponsive. See Hello? Anyone?  below.

Procedure

To complete this procedure, you need to have a Windows PC, micro-SD card, micro USB cable and the following Pycom devices:

To successful flash the modem's firmware we need to prepare three things:

  • an SD card with the firmware file on it
  • an Atom project with which to upload some MicroPython code files to the Pycom device
  • some MicroPython code entered at the REPL prompt in Atom to kick it off

You should also have read the README.md file that accompanies the files for this project. We'll now go through the each of these steps.

Micro SD

I first tried with an SD card I retrieved from a Raspberry Pi. That didn't work, I think because the partition structure on the card was too complex. Here's how I prepared the SD card.
NOTE: This procedure will destroy all data on the card. Prepare accordingly!

  1. You need a micro SD card and a way to connect that to a Windows PC
  2. With the micro SD card connected to the computer, open Computer Management (click the START button and type comp).
  3. From the left menu in Computer Management, select Disk Management
    Windows Disk ManagementWindows Disk Management
  4. The list of disks will likely show Disk 0 as your hard drive and Disk 1 (or higher) as the SD card.
  5. If your SD card has a single partition formatted with FAT32 you're good to go. Skip to step 10.
  6. Be absolutely sure you know which Disk is the SD card! Right-click and remove each partition by clicking Delete Volume
    Windows Disk Management - deleting a volumeWindows Disk Management - deleting a volume
  7. When the drive is empty, right click on the Unallocated Space and select New Simple Volume …
    Windows Disk Management - creating a new simple volume Windows Disk Management - creating a simple volume
  8. Ensure you select FAT32 as the format.
  9. At this point your SD card has a single FAT32 partition.
    Windows Disk Management Windows Disk Management - SD card prepared
  10. Close Disk Manager
  11. Download the available Sequans firmware files into your Downloads folder. To get the password you will need to be a member of the Pycom Forum and have access to the thread: Announcements & News > Announcements only for members > Firmware Files for Sequans LTE modem now are secured.
  12. In your Downloads folder, locate the CATM1 firmware or NB1 firmware file you wish to use and copy that file to your SD card.
  13. Eject your SD card then remove it from the computer. It's ready.

Atom Project

I'll assume you have the Atom IDE installed with the pymakr plugin. If you need help with this I've already covered it in detail in Internet of Things with Pycom and Adafruit IO - From Zero to Hero.

  1. Open the Atom IDE
  2. From the File menu, click Open Folder
  3. Navigate to a folder where you can save an Atom project for updating the Sequans firmware. You might need to come back to this later!
  4. Click New folder to add a new folder then double-click it to open it. Click the Select Folder button. Now we have a blank Atom project.
  5. In the Project list on the left of Atom, right-click on the name of your project and select New folder. Name the folder lib.
  6. Download the Pycom libraries from Github into your Downloads folder
  7. In the Downloads folder, extract the pycom-libraries-master.zip file.
  8. Navigate to Downloads\pycom-libraries-master\pycom-libraries-master\lib\sqnsupgrade. Select all the files in that folder and drag them onto the lib folder in Atom.
  9. Opening the lib folder in Atom should reveal the following contents:
    Atom IDE project files
  10. Keep Atom open, we'll need it shortly.

Hardware

It's now time to hook up the GPy to the computer. If it's already plugged in, disconnect it first.

  1. Insert the micro-SD card into the expansion board.
  2. Attach the GPy (or FiPy) to the expansion board
  3. Ensure an antenna is attached to the LTE antenna connector
  4. Connect the micro USB cable

Firmware Upgrade Process

  1. In Atom, from the ^ More menu, select Get serial ports. Note the name of the serial port (COMx)
  2. From the Settings menu, select Project settings.
  3. Edit the "address" line so that it refers to the correct COM port. Eg: "address": "COM13",
  4. Close and save the settings file pymakr.conf
  5. Click Connect to connect to the GPy. When you get a "triple chevron" you are connected.
    Atom IDE connected to Pycom device
  6. Click Upload to copy all files under the lib folder to the GPy
  7. At the REPL prompt (>>> in the lower pane) enter:
    >>> import sqnsupgrade
    The triple chevron will appear after the line when it's ready.
  8. At the REPL prompt enter the following line. This will be different if the firmware file you have on your SD card is different to the name used below. It will always be prefixed with /sd/:
    >>> sqnsupgrade.run('/sd/FIPY_GPY_CATM1_33988.dup', 921600)
  9. If the process succeeds the output will begin like this:
    <<< Welcome to the SQN3330 firmware updater >>>
    Entering recovery mode
    Resetting.

    Starting STP (DO NOT DISCONNECT POWER!!!)
    STP started
    Session opened: version 1, max transfer 8192 bytes
    Sending 5665583 bytes: [###                                     ]   7%
  10. At this point the firmware update is underway. As per the printed warnings DO NOT DISCONNECT POWER! The process took over four minutes for me. The output from the device for the whole process looks like this:
    Connecting on COM13...

    >>> import sqnsupgrade
    >>> sqnsupgrade.run('/sd/FIPY_GPY_CATM1_33988.dup', 921600)
    <<< Welcome to the SQN3330 firmware updater >>>
    Entering recovery mode
    Resetting..
    .
    Starting STP (DO NOT DISCONNECT POWER!!!)
    STP started
    Session opened: version 1, max transfer 8192 bytes
    Sending 5665583 bytes: [########################################] 100%
    Code download done, returning to user mode
    Resetting (DO NOT DISCONNECT POWER!!!)..
    .............
    Deploying the upgrade (DO NOT DISCONNECT POWER!!!)...
    Resetting (DO NOT DISCONNECT POWER!!!)..
    ...
    Upgrade completed!
    Here's the current firmware version:
    UE5.0.0.0c
    LR5.1.1.0-33988
    OK
    >>>
  11. Now the triple chevron has returned the process is complete. It is safe to reset or unplug the device.

Errors and Failures

Here are a few things that can go wrong in the process and their solutions.

  • If the Atom project has not been uploaded, this happens:
    >>> import sqnsupgrade
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ImportError: no module named 'sqnsupgrade'
    >>>
  • If the file on the SD card doesn’t exactly match the name used in the sqnsupgrad.run command, this happens:
    >>> sqnsupgrade.run('/sd/NOT_THE_RIGHT_FILE_NAME.dup', 921600)
    <<< Welcome to the SQN3330 firmware updater >>>
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/flash/lib/sqnsupgrade.py", line 106, in run
    OSError: [Errno 2] ENOENT
    >>>
  • If the modem needs to be reset (using the reset button) before starting an upgrade, you will see this:
    >>> import sqnsupgrade
    >>> sqnsupgrade.run('/sd/FIPY_GPY_CATM1_33988.dup', 921600)
    <<< Welcome to the SQN3330 firmware updater >>>
    Entering recovery mode
    Response: b'\r\nERROR\r\n'
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/flash/lib/sqnsupgrade.py", line 100, in run
    OSError: AT+SMSWBOOT=3,0 failed!
    >>>

Hello? Anyone?

During my first firmware update on a FiPy I managed to get it into a state where it can't be used and can't be updated. Whether I was impatient or some glitch occurred at a critial moment I don't know. I've recorded what happened here so you can see what it looks like when the firmware update process goes wrong. I'm looking forward to updating this article with how this was resolved. For now, I've posted the issue on the Pycom Forum: FiPy LTE bricked by firmware update (Sequans Monarch SQN3330)

UDPATE: While I have not yet been able to recover my original FiPy to the point I can again use the LTE feature, it's become a very useful part of my LoRa and Sigfox projects. An additional FiPy was carefully updated to the current firmware using the procedure documented here and was successful on the first attempt.

Have a question? Ask the Author of this guide today!

Please enter minimum 20 characters

Your comment will be posted (automatically) on our Support Forum which is publicly accessible. Don't enter private information, such as your phone number.

Expect a quick reply during business hours, many of us check-in over the weekend as well.

Comments


Loading...
Feedback

Please continue if you would like to leave feedback for any of these topics:

  • Website features/issues
  • Content errors/improvements
  • Missing products/categories
  • Product assignments to categories
  • Search results relevance

For all other inquiries (orders status, stock levels, etc), please contact our support team for quick assistance.

Note: click continue and a draft email will be opened to edit. If you don't have an email client on your device, then send a message via the chat icon on the bottom left of our website.

Makers love reviews as much as you do, please follow this link to review the products you have purchased.