Hi everyone,
I received my GM862-GPS and a breakout board a few days ago and now have it connected to an FTDI cable to my computer. I have been able to run AT commands to it and have even uploaded a simple python script onto it using Hyperterminal.
import SER
SER.set_speed('115200','8N1')
SER.send('\r\n--------------------\r\n\r\n')
SER.send('Hello!\r\n')
I have run at#escript, at#execscr and at#startmodescr=1,10 but nothing seems to happen when the module boots. Is there something that I’m doing wrong? I have seen a few other posts where people have had similar problems but they were using the evaluation boards and were advised to use the DTR switch. Because mine is a breakout board I do not have one, could this be the reason why my scripts are not running? and what could I do to fix this?
Thanks!
Hi,
A good starting point when working with GM862 modules and Python is to get a free program called RSTERM from Round Solutions.
This program is special type of hyperterminal that lets you “talk” to the GM862 by pushing “buttons” on an on screen form that are then converted into AT commands and sent via a serial cable to the GM862. You can then see the response on the hyperteminal.
RSTERM also has buttons to “compile (makes a .pyo)” scripts, upload scripts, activate scripts, delete scripts etc.
I never had any success with PytonWin in uploading, etc, etc. I use PythonWin to create the script and then I compile and load it onto the GM862 using RSTERM.
John
thanks for the quick reply John!
I already have been using rsterm (It’s really usefull!!) However I haven’t been able to upload scripts using it, possibly because I am only connecting VCC, GND, RX and TX on the FTDI cable. I’m assuming the other two lines are important somehow but I’m not sure how to connect / use them.
However I am able to upload programs perfectly well using hyperterminal and enable them using the AT command. Problem is that It either isn’t executing or displaying the serial output. Any ideas?
Thanks!
Hi again,
I use the Sparkfun GM862-RS232 eval board which only uses TX and TX (no flow control CTS/RTS) and I run it through a USB to COM port cable and so I do not think the problem is with your cable.
The DTR switch does have something to do with instructing the module to either run the enabled script on power-up or wait for AT commands.
The docs for the RS232 board state that “scripts must be loaded at 115200 using flow control” (? odd given that the edge connector only uses TX and TX).
The docs go on to say “Execution of a script at power on happens when the DTR switch is set to high”. The script of course must also be enabled.
Have you tried compiling and uploading from RSTERM just to see if the script runs at least once when you have loaded it? I find that a compiled (.pyo) script runs much faster that a .py.
John
John
Hi,
Ahh I see, I’ve tried using RSterm but every time I start the download process, I brings up an error saying “No Prompt”. I’ve tried using uncomiled (.py) and compiled (.pyo) scripts and neither seems to work =/
Could there be something wrong with the script itself?
Thanks!
Ok, I have a very basic script working at the moment, I realised that I had accidentally turned the serial multiplexing on! Multiplexing is now off and this script is able to run…
import SER
import sys
import GPS
SER.set_speed('115200','8N1')
class SerWriter:
def write(self,s):
SER.send(s+'\r')
sys.stdout = sys.stderr = SerWriter()
print '---------- GPS TRACKER V0.1 ----------'
while 1:
print('DEBUG>> About to get GPS Position')
gpsLoc = GPS.getActualPosition()
print(gpsLoc)
print('DEBUG>> About to Split String')
newLoc = gpsLoc.split(',')
for item in newLoc:
print(item)
MOD.sleep(1000)
This script works and keeps looping as it should… however when I add one or two lines to it, nothing happens, it doesn’t even run!
import SER
import sys
import GPS
SER.set_speed('115200','8N1')
class SerWriter:
def write(self,s):
SER.send(s+'\r')
sys.stdout = sys.stderr = SerWriter()
print '---------- GPS TRACKER V0.1 ----------'
while 1:
print('DEBUG>> About to get GPS Position')
gpsLoc = GPS.getActualPosition()
print(gpsLoc)
print('DEBUG>> About to Split String')
newLoc = gpsLoc.split(',')
for item in newLoc:
print(item)
print('DEBUG>> Building Post request?')
postReq = 'Post blah blah blah'
MOD.sleep(1000)
Can anyone see where It might be going wrong? This is driving me crazy!!!
Thanks,
James
Hi James,
What is the “postReq” line in your code supposed to do?
John
Hi John,
postReq was a string that I was building to allow the Modem to send some data to my server, nothing too vital.
I’ve actually solved the problem, it turned out that I had forgotten to import the MOD library, so when it uploaded to the modem, it never got past compiling!
Really appreciate your help though!
Regarding [rsterm, there is a commercial branch which is actively under development, supported and open to improvements suggestions, of course with more functions, newer version than the free one, [see it here.](TheByteWorks - Quality ready made and affordable custom software)](TheByteWorks - Quality ready made and affordable custom software)