GL865-DUAL using it to transport MODBUS

10 thoughts on “GL865-DUAL using it to transport MODBUS

  1. I have several years coding for this modules, but are some step that I can never perform.


    How I can detect silence at the serial/s ports? I need to detects when the serial don’t hace more information (silence) and dispatch the serial’s buffer content.


    Modbus don’t have EOF character or stream to detect, so what is the way to perform silence detect and dispatch or send the data. All this issues is done using the module running python script, in transparent mode the modem have his own internal timmer, but how I can use that if I’m running python code?


    Best Regards


    1. I suppose you will use Modbus over RS485 and in this case you’ll need a converter which will do the switching ways as well.

      I had a project with HE910, AD485 RS232/RS485 converter, a Schneider energy meter  and minimalmodbus Py library. Worked great without any problem.


      1. That library implement other serial library that is not SER&SER2. they call it pyserial.

         I will test it I don’t know if it run in a GL865 py machine.


        Best regards


        1. Of course, but only a few functions are used from pyserial, you can make small replacement I (uninspirationally) called it ser_serial and import it in minimalmodbus like this:


          import ser_serial as serial


          and presto!


  2. No Frank, as I said I used HE910 which has Py 2.7.2 with floating point, threading and other goodies. I suppose you can make minimalmodbus work with 1.5.2 with heavy cuts and work.


    1. Hi Cosmin!


      I don’t need to decode the MODBUS data, only fordward it the my server.

      The problem with MODBUS and with all binary protocols are they don’t have EOF char.


      So we must detect then the streams ends. The only way is using a timeout.


      For this, at py manual from telit:



      This command receives a string from the serial port TXD/RXD waiting for it until the timeout is expired. The return value will be the first string received no matter of how long the timeout is. The input parameter timeout is a Python integer, which is measured in 1/10s, and represents the max time to wait for the string from the serial port ASC0. The timeout range is (0 ÷ 32767).

      The return value is a Python string which is an empty string if timeout expired without any data received, otherwise it is the string consisting in the data received.



      a = SER.receive(15) 




      while (1):

      read= SER.receive(15)

      if (read != ”):”data: ‘) 




      For example I send "HELOOOOOOOOOOOOO". At this stream we don’t have any inter-char delay is a complete TX.


      It give me back:

      data: HELOO



      So, I don’t know any way to implement this function, for me my conclusion is that SER.receive don’t work properly. I test this in GM862-GPS, GM862-PY and GL865.


      I’m thinking that the internal UART control is wrong.


      Best Regards



      1. Not necessarily wrong, remember Python task runs with a low priority; maybe you will have better success trying byte reading operations with a generous inter-character timeout.


        Re-read SER.receive explanation and you’ll understand is normal to get the returns like that.

  3. I understand the phyton low priority. But for this reason is used an UART controller. This is the controller that must store the data and let you know when you can use it.
    This hardware part it runs with minimal control from the main CPU, and you can operate it in any moment in a unattended way (a hw-serial). If you want to implement this in a CPU that don’t have UART you can do it well if you setup correctly the cpu’s hardware interrupts (a software-serial).
    I always have the same response from telit partners about priorities, but the py is operating via the UART, I mean we read and write the UART not the directly the serial ports so the priority will be not an issue.
    My conclusion is that the UART control is wrong implemented, some staus register is not used or implemented in a wrong way.
    This is easy to test. send data to the SER2 and then runs a py script, it will read the stored data and print it.
    Best Regards
    1. Frank, please try to read and understand all my statements above, not only the one regarding the priority.