GPy seems very unstable



  • I have been struggling since purchasing my GPy to work reliably with it, and was hoping someone had some suggestions for what I may be doing wrong.

    I updated my firmware to the latest stable using the firmware updater tool (appears to be 1.18.2) and wrote some simple scripts for interacting with a TCP server via LTE through a Hologram SIM.

    When attempting to run PyMakr/Atom, I get a lot of strange behavior, so I've taken mostly to uploading my files via PyMakr and importing my scripts from the REPL. They seem to start but frequently suffer random pauses, failures, and other breakage.

    For example, sometimes it will hang on the construction of the LTE object. If I press enter a few times, the REPL will come back to life but no error message or other indication of success is apparent.

    I used some sample code to configure and attach the modem, but it never seems to work from my script (it hangs while waiting for isattached()), but if I enter them one by one in the REPL, the modem attaches without a problem. I tried to mimic exactly what I had done with sleeps between every AT command, along with any crazy thing I could think of - varying sleeps, resetting modem, calling detach or dettach or disconnect (or all 3) prior to trying to configure anything, changing order of commands, sending various queries to the MT, etc.

    I had started with time.sleep(10) between each command, but often the sleep would never seem to return (no print out ever occurred). If I pressed enter several times, the REPL prompt would show back up, again, without any sort of Python error or other indication.

    Below is my current code after a morning spent trying random things to make it work. I would appreciate any ideas, because so far it seems like I can't make this thing do anything I would expect. Thanks!

    from network import LTE
    
    print('starting')
    
    lte = LTE()         # instantiate the LTE object
    lte.reset()
    print('lte created')
    for i in range(0,10):
        print (i)
        time.sleep(1)
    print (lte.send_at_cmd('AT+CGDCONT=1,"IP","hologram"'))
    print('cmd1')
    for i in range(0,10):
        print (i)
        time.sleep(1)
    print (lte.send_at_cmd('AT+CFUN=1'))
    print('cmd2')
    time.sleep(1)
    print (lte.send_at_cmd('AT+CEREG=2'))
    
    while not lte.isattached():
        time.sleep(1)
    print('connecting')
    
    time.sleep(1)
    lte.isconnected()
    time.sleep(1)
    
    lte.connect()       # start a data session and obtain an IP address
    while not lte.isconnected():
        time.sleep(1)
    print('connected')
    


  • @helltoupee Oops, should have read P2 not P23. Check the flash instructions to be sure.

    Also have a look at safe boot options. You might be able to boot your previous firmware.



  • @helltoupee I have not had problems trying to reflash. Make sure you have a good connection between P23 and GND when you boot to force the device into flash mode.
    Did the reflash appear to go all the way to completion?
    I would try again.

    Peter.



  • @tuftec Thanks for the response. I am using a 5V 2A supply and connections seem nice and solid. The sim card is a Hologram, LTE Cat-M1, I believe.

    I tried rewriting my code using the built in attach vs AT commands and had no better luck (still worked from the REPL when entered manually but not from a script).

    I tried to flash the latest firmware and now the device is acting even stranger than before. I can't actually get it to re-enter flash mode so I can't even try to roll back. Any suggestion on how to recover it? Is this level of instability or change between firmware updates expected? I'm new to the PyCom world but so far there seem to be so many basic connectivity and configuration issues.



  • Hi.

    How are you using your Gpy? NB-IoT, Cat-M1?

    I am using a FiPy for NB-IoT.
    Here are few pointers that I have fond useful:

    1. Make sure you have a good clean 5V (@1A or so) powering your device
    2. Use the latest version of Pycom h/w (upgraded with the latest Sequans modem features)
    3. Use the latest Pycom f/w (1.20.0.rc7 or later)
    4. Be careful with interconnection of other devices for monitoring repl output etc. I had an issue with a TTL connected USB dongle that would feed current into my module when it went to sleep. This caused strange behaviour on wake up. Sometimes I would get random watchdog resets (not actually using the watchdog feature).
    5. Make sure you keep all input pins within the 0 - 3.3V range. May cause issues as per 4).
    6. I use the LTE specific commands to set up the device rather than dropping down to the AT command level. This seems to work for me. So use lte.init, lte.attach, lte.isattached, lte.connect, lte.isconnected, lte.deinit. Then use sockets for sending data (UDP works well for NB-IoT). I still have an issue where I occasionally get an OS error when trying to use lte.deinit (OSError: the requested operation failed). I have not tracked the cause down yet.

    I always use pymkr (within Atom) over the wifi repl to load new application code changes now. It is relatively fast and easy. You might need to add a button to your harware to force it back to the repl (safe boot) if your code has no obvious exit to the repl (like mine).

    I hope this helps.

    Please share your experience.

    Peter.


Log in to reply
 

Pycom on Twitter