Changing baud rate doesn't allow second command

rjmccorkle robert.mccorkle at
Mon Apr 25 16:41:01 CEST 2011

On Apr 25, 7:06 am, Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-
a470-7603bd3aa... at> wrote:
> Am 25.04.2011 14:46, schrieb rjmccorkle:
> > hi - I need to open a serial port in 9600 and send a command followed
> > by closing it, open serial port again and send a second command at
> > 115200.  I have both commands working separately from the python
> > command line but it won't work in the script.  Any idea why?
> What does "won't work" mean? I can't see any issues in the code.
> I suppose the string sent with 9600 tells the device to change the
> speed. Are you sure that it is received correctly?
> Additionally, maybe you have output issues. E.g. you just write
> "ser.baudrate" instead of "print ser.baudrate", so that could be a
> source of behavioral differences.
> > #import os
> > #program = 'C:\Program Files\Program.exe'+'-start'
> > #os.system(r'program)
> I suppose this doesn't belong to the problem?
> Thomas

The code is fine but it seems it won't switch baud rates using
pyserial.  I have to initiate the first msg in 9600 to change the
setting of the gps
And then send the second command in 115200 because it's in
configuration mode on the unit.  I can see hooking two pcs together
via null modem that the command is sent but I don't see the next msg
go across.  I'll try sleeps but even w a 15 sec sleep after close
connection to allow for configuration mode to set (Which only takes
about 4 seconds) it wasn't sending the second command.  Weird.  My
buddy suggested I make two files for the separate calls but I wouldn't
think that would make a diff or be necessary...

More information about the Python-list mailing list