Python Debug Over USB

11 thoughts on “Python Debug Over USB

  1. We are doing development on the GateTel GT-HE910-EUG which is a modularised version of the HE910. The external ports available on the module are the RS232 ports (USIF0) and the USB port.

     

    We need to be able to debug the our python scripts and so need access to the python debug output.

     

    The HE910 has many ports and lots of port configuration options which is great however I have read and the Family Ports Arrangement and the CMUX Implementation User Guide but it look like it isn’t possible to access the python debug output via USB and in fact it’s only possible to access the python debug output via USIF1 which isn’t available on the GateTel module.

     

    Am I misunderstanding something or are my fears confirmed.

     

    1. Indeed Python debug is available only on USIF1 for now, is advisable to do the debug phase on another HE910 hardware.

  2. So what is the USB port actually good for? Earlier, I learned that you cannot address it from your Python script.

     

     

      1. Has the situation changed lately? Is there a port setting for direct access to Python debug messages over USB?

        I use HE910-EUG with 12.00.216 fw.

        1. Hi Tom, here it is:

          import USB0

          ….

          # Debug info on USB0
          class USB0stdout:
              def __init__(self):
                  print “”  #just to run _init_
              def write(self,s):
                  USB0.send(s)

          if(sys.platform != “win32”):
              sys.stdout = USB0stdout()
              sys.stderr = USB0stdout()

          1. Hi Cosmin

            Thanks, I basically knew this. But I was hoping for something “more robust”, as this trick you presented assumes your script starts. Actually, now I am stuck with some basic problem which seems to prohibit the script from the very beginning.

            Any port setting that should send automatically all Python diagnostics to USB port instead of ASC1?

          2. No, the only debugging startup configuration is with AT#PORTCFG=3 on USIF1.

            Tom I would advise to take a look at Appzone C development, the leverage is in that direction. The new IDE is very easy to use, it includes terminal and module file management tools. Is plain C so no OP I know, but the language make easier to port useful things from elsewhere – I succesfully ported bits of Arduino code (translating objects/classes to C structures) and other pieces like a MQTT client.

            Appzone C User Guide

            Appzone C API Reference Guide

          3. Yes Cosmin, I have noted the AppZone and agreed that I should take a look at it. It seems to even support something around Python.

            But do I remember correctly that there is also an AT command which allows remapping of the ASC1 output on ASC0? Or was it only on 2G modules, such as GE865. Sorry but I have lost the name of the command.

          4. Could well be so. But now I use Antrax’s RSTermPlus, which is reasonable (though with some bugs and shortcomings), providing also a second channel for logging debug messages. The key thing I had forgotten was choosing Portconfig = 3. Without that setting you get nothing from the debug channel.

            But just for the record, is there still an AT-command to remap ASC1 to ASC0, as I try to remember?