Gemalto is now part of the Thales Group, find out more.

You are here

Thales IoT Developer Community

Python script to load files into module's FFS over AT command interface

Tutorial, March 12, 2014 - 3:02pm, 5869 views

On EHSx module's family AT^SJDL command can be used to download files into the module's FFS via RS232 or USB interfaces. The advantage of this solution is that it is in general OS independent. Check attached module_downloader.py file. This example shows how to download files to the module over AT command interface with Python script.

module_downloader.py works on Windows (tested with Windows 7 64bit) and Linux (Ubuntu 12.04). It opens com interface, reads module's SW version, invokes AT^SJDL to download the file and calculates CRC code to verify if transfered file is complete. 

Prerequisites:

  • installed Python 2.7.x (tested with Python 2.7.5 on Windows and Python 2.7.3 on Ubuntu)
  • installed pySerial library (tested with 2.7 on Windows and 2.5 on Ubuntu)
  • rights to access serial devices

Usage examples:

  • print help: module_downloader.py -h for help
  • download on Windows: module_downloader.py -p COM1 -b 115200 LocalFile.txt RemoteFile.txt
  • download on Linux: module_downloader.py -p /dev/ttyACM0 -b 115200 LocalFile.txt RemoteFile.txt

Notes:

  • on Linux remember to set chmod +x before running the script
Hi, Great!!! that way is that I was looking for!!! Thaks Regards ALopez

Somewhere over the rainbow!!! Looking for the Oz Land!!!

Hi... I have an EGS5+X with revision 02.004, a-revision 03.000.20. Unfortunately I'm getting "Incorrect module response". I think my firmware might no support SJDL. What can I do here? I would really like to get this functionality working for me as MES has never worked for me on Windows 7
Hello Guys. Does this script work with the concept board?
Yes it does work with the concept board. Finding the USB connection more stable under Linux

There's a slight bug in this excellent code: if the CRC happens to have a leading 0, the CRC comparison fails. I've updated the matching code to account for this.

I've also added some code to support a default remote filename.

module_downloader.py_.txt

Very Great, works only under Python 2.7 ... but very fine...Danke

Author

Jędrzej Gemalto Moderator's picture
Jędrzej Gemalto Moderator