Openlog and GPS module - duplex serial comms

Hi,

I’m using an Openlog to capture the output from a U-Blox GPS module, which is in the form of NMEA text. It works easily and well if I take the default output from the GPS. Both modules connected to a common 3.3v and ground rail, Tx from GPS connected to Rx on Openlog. All good.

However, I would like to reduce the volume and frequency of messages, with the intention of extending battery life. By default the GPS module produces 8 different messages per second. I can suppress unwanted messages, and also reduce the message frequency, by sending configuration messages to the GPS module. Unfortunately the specific GPS module I am using doesn’t have the ability to save configuration, so I need to send these config messages every time at startup.

My idea was to modify the Openlog-minimal sketch so that it writes the relevant config messages on the Tx pin, as part of the setup() routine. Then by connecting Openlog Tx to GPS Rx, the GPS should receive and process these, and reduce its message output.

No such luck. If I do the above, the data recorded by the Openlog appears to be corrupted. I see fragments of the expected GPS output, mixed up with binary data. It seems as perhaps the devices are not syncing on a common baud rate.

Am I doing something (duplex comms) that is fundamentally flawed or outside the design of the Openlog, or is there something in the way I have implemented this which would explain the failure?

I think I solved it! The command strings I attempted to write to the GPS device tipped the sketch over the available memory limits on the Openlog device. I assume the stack was getting corrupted and the sketch crashed. I solved it by wrapping the strings in the F() macro, that instructs the compiler to keep the strings in program memory, e.g:

NewSerial.print(F(“$PUBX,40,GSV,0,0,0,0,0,0*59\r\n”));

It works now.

Hi Rob,

Glad to hear you were able to figure it out and that’s a neat fix to conserve memory! I’m sure this post will come in handy for other users trying to repurpose their OpenLogs to both log data and run some simple code so thank you very much for sharing your solution!