• After coming across Espruino and really liking what it had to offer, I was able to convince my team that a port to our hardware could be a really beneficial endeavor. I started work on doing the port, and roped in a team member who helped me get some of the more nuanced things working, such as the SDIO FS usage.

    Bit of a primer
    Janus RC is an M2M company that I work for, we offer fully certified devices for usage on various networks, through the use of Telit brand modems. While not always in the expense range of the maker type of project, we take care of the massive front end costs that accompany network certification, such as PTCRB. Our plug in devices are more akin to what users here would look for. This particular port is for our T2 Terminus, which is an STM32F4 powered device.

    @Gordon - If you have any issues with my documentation/naming schemes of things, just let me know.

    On to the fun stuff
    Enough with the wordy preamble. You want code/examples, and you shall have them!

    We've written some modules that can be used as building blocks for an M2M/cellular application, leaning on the modem's stack to handle basically everything you'd want. Although they are geared for Telit modems, you could simply tool the flow to fit your modem of choice... many basic AT commands overlap as standard (+CREG, for example). The primary goal is autonomous applications since that's what M2M is really all about.

    This is my first Javascript based project, so I'm sure that I've done many things that many not be well executed, or take full advantage of what's available. Criticisms are of course welcome.

    Our current repository for this fork:
    https://github.com/JanusRC/T2-Terminus/t­ree/master/espruinoT2/Janus_JS

    I won't re-write everything here, as I tried to document usage well in our github with a downloadable user guide. For those who don't want to use that .doc version, I tried to mirror it all in our forum, located here.

    Our current modules and code include:

    -Modem

    1. AT Handling to interface to any modem that uses the standard Hayes format (\r\n terminated).
    2. Network registration and checks
    3. SMS sending and reception
    4. Socket control
      4a. Socket Dial to remote host
      4b. Socket Listen for a remote client
      4c. Socket Listen for remote client, with remote control of the console.

    -Other

    1. BMA222 Accelerometer
    2. Some LED PWM fun

    A note about the AT handler:
    AT Command handler, uses an iterative approach to commands since Espruino currently cannot do something like "send AT command, wait for response" in a single loop. It must return to idle state for backend processing of the received data. This will likely improve later with a more streamlined approach. For now, you simply send the command twice to fetch the response.

    Example AT send/receive:

    atc = require("ATC").ATC(Serial6);
    > atc.sendAT('AT',"OK")
    > -1
    > atc.sendAT('AT',"OK")
    > OK
    

    Example registration demo:

    >RunApp(TestProgram)
    =undefined
    Running T2 Test Program
     
    **Running T2 Modem Wakeup App**
    -->Modem On, checking for AT
    -->AT Found, Modem Is Ready
     
    **Running T2 Network Status App**
    -->Modem Type: HE910
    -->SIM Ready
    -->SIM Phone Number: "1815xxxxxxx"
    -->Modem Registered
    -->Signal Quality: +CSQ: 16,3
    -->Modem Ready for Data
    -->Registered to: "Family Mobile"
    -->Modem Firmware: 12.00.006
    -->Network Status Check Complete.
    Test Program Finished.
    >
    
  • Just to add, I know I'm not generally supportive of Espruino on other platforms - but that's because it's often approached in a very one-sided way. Requests of the form "I'm going to sell a board with Espruino on. Can you port Espruino to it for free?" are not unusual, and don't really help to change my point of view.

    @CKnight and Janus RC couldn't have been further from that though. They're doing development work, are supporting their customers and are contributing their changes back, which all makes a huge difference.

    ARMinARM are another good example of using Espruino in a mutually benficial way too.


    About GSM - I'll be trying to produce a more flexible library for Espruino soon that'll allow efficient callback-based handling of AT commands, as well as JavaScript-based network drivers. Hopefully when that happens we'll be able to integrate this socket support with the HTTP server, as well as tweak the SMS/Network library to make it callback-based and add it to the list of modules.

  • @CKnight this is great work thanks
    I use Telit modems and used JS to talk to them...

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Cellular/M2M Applications & Porting to Janus Hardware

Posted by Avatar for CKnight @CKnight

Actions