Python Serial to GPRS bridge – YMODEM problem

13 thoughts on “Python Serial to GPRS bridge – YMODEM problem

  1. Hi,


    I have a Serial to GPRS bridge operational via python on the GE865-QUAD modem.


    Its based on the telit script examples. I have attached to source code file. A customer whats to download files through the bridge via the YMODEM protocol. No packets seems to be going through the bridge and the download fails. Normal ASCII works fine.

    Is there any reason the YMODEM packets are not getting through?

    <p class=

    1. I suppose this is the bridge relevant part of code:


      while MDM.getDCD() == 1:
          TRANSFER = 1
          b =
          res = MDM.send(b, 10)
          s =
          res = SER.send(s)

      Did you proceed with some debugging, which end of the pipe appears to be stuck?

      1.  Yes, that would be the most relevant part of the code.  I have tryed both ways (transmit and receive)? And both Failed.  Not sure how to go about debugging this  – any pointers?


        I am assume it the TCP/IP side of the connection as initial acknowledge request fails to be received and it just times out. 

  2. The TCP/IP connection shouldn’t have nothing to do with the actual bridging loop and type of transferred data, and is easy to check you have network, GPRS attach is done, IP is obtained, then socket is connected. Entering the loop simply print what are you getting from both pipes and see where is the problem.


    I see you have a listening socket set up, but can’t see the accepting connection part? Is this job transferred to the SER end?

    1. Oddly enough  Xmodem, 1K Xmodem and Zmodem all work.  But Ymodem does not work and Ymodem seems to be very close to the 1K Xmodem standard.  The Ymodem crashes out after a number of tries – with the max number of error exceeded.

      1. It operates the same outside of the python script:

        I gave the following command directly to the modem from my PC.  


        AT+CGDCONT=1, "IP", "apn_name","",0,0
        AT#SCFGEXT = 2,0,0,0,1,0
        AT#SL = 2, 1, 2000 


        I dial in remotely to the modem to socket 2000 and its connects fine.  The file transfer with the Zmodem and Xmodem protocols works fine, while the Ymodem fails with check value errors.   

        I am using Hyper-terminal at both ends now.  


        What other settings might affect this operation?

          1. In the Sender window  the ‘last error’ is ‘Unrequested Response’ and while the ‘Error checking’ is ‘CRC’ 


            In the Receiver window the ‘Last error’ is ‘Bad Check Value’  while the  ‘Error checking’ is also ‘CRC’


            I have tried all three flow control options in Hyperterminal(no flow/Hardware/XonXoff). But all have the same result: Ymodem failing while Xmodem works.  



            The test file I am sending is a tiny text file, where the contents are only one single character.




          2. I meant to say hardware flow control in module as well, with AT&K3.

            Is it ymodem or ymodem-g that fails, or both? What about 1k xmodem?

            Another idea, set packet size to 1024 maybe will help the protocol to better catch and handle full packets.

          3. I have tried the AT&K3 and Hardware mode selected in Hyperterminal –  same result again.


            Ymodem fails and Ymodem-G fails.   1K Xmodem works fine.


            I have tried change the packet size in the TCP stackup to 1024 and Ymodem still has not worked. 

          4. Ymodem-g has little chances to work because it requires direct hardware flow control between modems. I wonder if ymodem is so time/size sensitive that a virtual pipe won’t work? In this case the only chance would be to have ymodem implemented in Python application to deal with the transmitting software, then send the file to the other network end with whatever method is desired.


  3. Our customer  requires this Ymodem with telit products we already have sold them.   They have this working with their Sierra Wireless GPRS modem.  I just don’t understand why its not working with the telit modem.  


  4. have you investigated with a serial sniffer in bad case and in good case to understand which kind of data you can see on good and bad case?

    then you should put also some print instructions on your  Python code for debugging