--- title: "LTE Modem Firmware Update" aliases: - tutorials/lte/firmware.html - tutorials/lte/firmware.md - chapter/tutorials/lte/firmware --- **This article is only related to GPy, FiPy, and G01 boards** >Note: The LTE modem updater is integrated in the latest stable **pybytes-firmware** release, make sure you update your device firmware first [here](/updatefirmware/device/) Before updating the modem firmware, check the current modem firmware version using: ```python >>> import sqnsupgrade >>> sqnsupgrade.info() ``` The bottom two lines explain the LTE firmware edition: * LR5.xx is for CAT-M1 * LR6.xx is for NB-IoT The firmwares for CAT-M1 and NB-IoT are fundamentally different and cannot be used interchangable. For security reasons, the modem firmware files are password protected. In order to download them, * register in our [forum](https://forum.pycom.io) (if you aren't already) and then * go [to this forum post](https://forum.pycom.io/topic/4020/firmware-files-for-sequans-lte-modem-now-are-secured) for the credentials. (On the forum: Announcements & News → Announcements for members only → the Firmware Files) and then * you can [download the firmwares](https://software.pycom.io/downloads/sequans2.html). >If you currently have CAT-M1 firmware **33080**, then make sure to update to 41065, before you go to any other version such as 48829! Our newest products ship with the modem firmware version CAT-M1 5.4.1.0-50523. At the moment it is not possible to update the modem to that version. There are several different ways to update the firmware of the LTE modem: 1. [Flash](#flash) (slow) 1. [SD card](#sd-card) (fastest) 1. [USB](#usb) (medium) 1. [Wireless](#wireless) (slowest) >In case of any failure or interruption to the process of LTE modem upgrade you can repeat the same steps after **power cycling to the board (i.e disconnecting and reconnecting power)**. Just pressing the reset button is not enough. ## Note on Updating to CAT-M1 5.2-48829 This update has to be done in two steps and is a full upgrade, meaning you can only use the steps for 'SD Card' or 'USB'. 1. update with `CATM1-5.2-48829-1.dup` For the first update you have to also specify `load_fff=False`. Using the SD card method, it would be like this: ``` sqnsupgrade.run('/sd/CATM1-5.2-48829-1.dup', load_fff=False) ``` wait until the LTE modem resets and prints out something similar to this: ``` Resetting............ Your modem has been successfully updated. Here is the current firmware version: UE5.0.0.0d LR5.1.1.0-39529 IMEI: xyz ``` 2. update with `CATM1-5.2-48829-2.dup` ``` sqnsupgrade.run('/sd/CATM1-5.2-48829-2.dup') ``` At the end reset the board. ## Flash >Note: For Flash updates, we currently only support the use of upgdiff- files. If there is no upgdiff- file for your version available, try to use another method. 1. Copy the firmware update file you want to use in your project folder and click `upload to device` in the Pymakr plugin. Make sure the first 5 numbers match the current version of your modem firmware. Uploading might take a while because of the large filesize. > Note: If the firmware does not sync to your device, open the Pymakr settings → project settings and add `"dup"` to the entry `"sync_file_types"`. This will create a `pymakr.conf` file in your project and allow you to sync `.dup` files to the device using pymakr. 2. After uploading the file, you can run the following commands ```python import sqnsupgrade sqnsupgrade.run('upgdiff_old-to-new.dup') ``` 3. The update takes about 5 minutes. Note that the update may seem to 'stall' around 7-10% and again at 99%. This is completely normal. >Note: **Do not disconnect power to the module during the updating process** 4. The updater will show the new `SYSTEM VERSION` when it is done, and return control to REPL. ## SD Card 1. Format the SD card using your computer, or the following commands: ```python from machine import SD import os sd = SD() os.mount(sd, '/sd') # mount it os.fsformat('/sd') # format SD card fs = os.mkfat(sd) print(os.listdir('/sd')) # list its content ``` The last command should return an empty list. 2. Copy all the files from the `.zip` archive to the SD card. You can either use the [FTP server](gettingstarted/programming/ftp/) or insert the SD card in your computer and copy the files through there. >Note: Do not forget to mount the SD card when re-inserting it. 3. Once the files are on the SD card, you can flash the LTE modem using one of the following commands: ```python import sqnsupgrade sqnsupgrade.run('/sd/upgdiff_old-to-new.dup') # if no upgdiff is available, run the following instead # sqnsupgrade.run('/sd/name.dup') # WARNING! If you are updating from version 33080, use the updater.elf file as well, this is not needed for the upgdiff file. # sqnsupgrade.run('/sd/name.dup', '/sd/updater.elf') ``` >Note: Replace `name.dup` or `upgdiff_old-to-new.dup` with the actual filename. There are different versions for `CAT-M1` and `NB-IoT` 4. The command will now make sure the firmware is updated. This takes about 5 minutes. Note that the update may seem to 'stall' around 7-10% and again at 99%. This is completely normal. >Note: **Do not disconnect power to the module during the updating process** 5. The updater will show the new `SYSTEM VERSION` when it is done, and return control to REPL. ## USB If you do not have an SD card available, you can update the firmware over USB. For this you will need to install * [Python 3](https://www.python.org/downloads) * [PySerial](https://pythonhosted.org/pyserial/pyserial.html#installation) * [sqnsupgrade python script](https://github.com/pycom/pycom-libraries/tree/master/lib/sqnsupgrade) 1. On the Pycom module run the following command to allow direct UART communication to the LTE modem: ```python import sqnsupgrade sqnsupgrade.uart(True) ``` 1. You will see a response similar to this: ```python <<< Welcome to the SQN3330 firmware updater [1.2.6] >>> >>> GPy with firmware version 1.20.3.b2 Preparing modem for upgrade... FFH mode is not necessary... ignoring! Do not specify updater.elf when updating! Attempting AT wakeup... Going into MIRROR mode... please close this terminal to resume the upgrade via UART ``` 1. Take note of the Serial port used and close the REPL. 1. On the computer go to the directory where you saved the `sqnsupgrade` script and run the following commands in the command line / terminal. Replace the paths and `name.dup` with the actual files. ```python $ python3 >>> import sqnsupgrade >>> sqnsupgrade.run('Serial_Port', '/path/to/upgdiff_old-to-new.dup') # If no upgdiff file is available, use the following # >>> sqnsupgrade.run('Serial_Port', '/path/to/name.dup') # WARNING! If you are updating from version 33080, use the updater.elf file as well, this is not needed for the upgdiff file # >>> sqnsupgrade.run('Serial_Port', '/path/to/name.dup', '/path/to/updater.elf') ``` If the updater script is stuck at `Attempting AT wakeup... [921600]`, try again after setting `import pycom; pycom.lte_modem_en_on_boot(True)`, and reboot after setting the flag. 1. The update is now running. Note that the update may seem to 'stall' around 7-10% and again at 99%. This is completely normal. >Note: **Do not disconnect power to the module during the updating process** 1. The updater will show `SYSTEM VERSION` when it is done, and return control to REPL. ## Wireless To update the modem firmware wirelessly, you can follow the [Flash](/updatefirmware/ltemodem/#flash) guide. Upload the files through the [FTP Server and communicate throught Telnet](/gettingstarted/programming/ftp/), or use [Pybytes Pymakr](https://pybytes.pycom.io/pymakr)