SER performance and buffering

8 thoughts on “SER performance and buffering

  1. Hello,

    I’m using a GL865-DUAL-V3 (according to at+gmm) revision 16.00.152 (at+gmr) – on the sticker on the back of the device it reads “GT864 E” but I suppose that is incorrect.

    I’m trying to interface a serial device via SER at 9600/8E1 from my Python script on the Telit. I continously send small request packets (3 byte) to SER and expect small response sequences of around 9 bytes from the device connected to SER.

    I’ve taken some care with the request/response functions, and when I run isolated tests of it inside the Telit (not using the SER port), it easily makes 40 request/respones cycles per second.

    When I make a blocking loop and calculate an average afterwards, I can read more than 100 times per second from the SER port.

    So I’ve measured my functions and the SER performance, and from these two I would expect to saturate the 9600/8E1 constantly with requests and responses.

    The structure of my application is quite simple, it’s a main loop that iterates nonstop and continuously reads from SER with SER.readbyte(), writing a new request to SER as soon as a response was successfully decoded, it also calls MOD.time.

    And indeed, the first 5 seconds (approximately) after AT#REBOOT the Telit saturates the serial port (I have a logger), but then performance breaks in and from there on performance becomes very instable, rarely comming back to full speed (saturation) again, it averages around 3 request/response cycles per second.

    I’ve set AT#CPUMODE to 3, disabled SER flow control with AT&K0, it seems to have helped a little but I’m still puzzled by what I see.

    I’ve made a test where I toggle the status LED whenever the loop has run, the LED flickers so fast that I cannot tell ON from OFF. So my script is not blocked anywhere. What it looks like is that data gets stuck shortly in either the SER input buffer or the SER output buffer (I cannot tell the difference). I’m not sure what I’m observing here, can anybody shed some light for me on the internals of the SER buffer in Python? Is there some kind of threshold that needs to be met before data is flushed from the internal SER buffers in the Telit?

    Is there anything left I can do to stabilize performance, or is this normal and I just have to live with it?


    1. Is known that Python runs with low priority that’s why, when network becomes active, the speed decreases. Data traffic with small chunks doesn’t help for speed, byte operations even less.

      Maybe you can test SER limits continuously streaming large volumes at once.

      1. Thanks for your quick response, and also thanks for pointing me to the low priority, I had forgotten to mention that I’ve read a forum thread which described that.

        What I seem to observe is that my script is running idle, not blocked. Once performance breaks in (you’re right, approximately 1 sec after “+CIEV: service,1”), it runs idle through its loop waiting for the serial device, it makes mostly readbyte() calls which yield -1. That is not the case before the network becomes active. It’s a pity because Telit has enough power to run my script, but it starves out at the serial port.

        By the way, can I prevent my Telit from connecting to the GSM network? I once made a test with AT+CFUN=4, but the observed behaviour of the Telit seemed unchanged.

        To add to the last question, in my final application in the Telit I will need only SMS services, no voice, no GPRS etc., only sending and receiving SMS. Can I switch off any of these unused activities inside the Telit to gain some more power?

        At 9600/8E1 max. throughput is 960 bytes per second. The serial device I’m interfacing is sending in sequences of 2 byte pairs, and after each pair it makes a pause of 10ms. So bytes are trickling into Telit in 2-byte pairs. I believe that is the reason why I measuerd to perform 30% worse than SER.readbyte() in this specific case.

        Anyways thanks so much for any help!

        1. You can de-register the module from the newtork with AT+COPS=2 and register when you need with AT+COPS=0.

          To keep off GPRS AT+CGATT=0 and/or AT#AUTOATT=0.


          If you really need more Python speed you should evalute xE910 modules, they are way faster and have a newer Python 2.7 with other goodies included.



  2. Turned out I made a programming error in a core function. My Python application is running at sufficient speed now meaning that it happily saturates the SER interface, and it does so very steadily. I do observe slight fluctuations here and there, processing time of a full cycle of receiving a response, parsing it and sending the next request now varies +-100ms (max) which exceeds my early expactations. So: thanks for this great product! 🙂


    I plan to add code to turn a pair of two Telits into a serial-over-gsm bridge. Are there any application notes or examples on this? Basically I wonder, will I have to shuffle bytes forth and back between SER and MDM myself when in transparent mode or can I use built-in functions for that? Maybe someone with experiences with this has some experiences to share?


    Thanks ahead,


    1. I did such a SER-MDM bridge for AT and custom commands, is a simple loop passing data and parsing for commands. This must be completed with client TCP or server socket connection, shouldn’t be difficult at all. Ah also has FTP connection to stream/upload an image directly from serial – also working well and reliable, to encourage you. Not public code though.



      1. So it should be a straight-forward thing, great. I was going to simply place a data call from one Telit to the other with AT+CBST=71,0,1 and then ATD… (by the way, the handbook recommends “AT+CBST=71,0,1” for mobile-to-mobile calls on Page 92, Rev. 18, why not “AT+CBST=75,0,1”?). I seem to have at least one other option of establishing a mobile-to-mobile data connection: a GPRS socket (please correct me if I have a misunderstanding here). Which is the recommended technique that I should use for a moibile-to-mobile data connection between two GL865-DUAL-V3?

        1. Indeed CSD is quicker to establish but I don’t know if is still supported by network operators, and is expensive. TCP sockets over GPRS are faster, cheaper, but for mobile to mobile you’ll need  VPN setup or public IPs for devices.