Changing baud rate doesn't allow second command

rjmccorkle robert.mccorkle at gmail.com
Mon Apr 25 17:09:07 EDT 2011


On Apr 25, 10:09 am, Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-
a470-7603bd3aa... at spamschutz.glglgl.de> wrote:
> Am 25.04.2011 16:41, schrieb rjmccorkle:
>
> > 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.
>
> Ok.
>
>  > 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.
>
> The receiver changes speed as well, I suppose?
>
>  > 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.
>
> mmm... strange.
>
>  > My buddy suggested I make two files for the separate calls but I wouldn't
>
> > think that would make a diff or be necessary...
>
> Normally not, but it might worth trying.
>
> Anyway, have you tried to use setBaudrate() instead of close() and
> creating a new connection?
>
> I can't see why it should make a difference, but I as well can't see why
> your approach is not working, especially as it works if you do it
> manually...
>
> Maybe your target device expects to get something signalled via the
> status lines?
>
> Thomas

Ya the gps box goes into configuration and expected another carriage
return. Added \r before the second write and it works like a charm.  I
only found that by having to run the second write twice to discover it
was wanting a second command from me... It worked to send the command
twice but that's sloppy cuz it just needed a \r.

Thanks for everyones help



More information about the Python-list mailing list