SparkFun_CAN-Bus_Arduino_Library icon indicating copy to clipboard operation
SparkFun_CAN-Bus_Arduino_Library copied to clipboard

No GPS reading on Arduino Uno R3

Open sunekaae opened this issue 6 years ago • 1 comments

I was not able to get any GPS readings. I am using: CAN-BUS Shield (DEV-13262) and GPS Receiver EM-506 (GPS-12751) ordered bis SK Pang Arduino Uno R3

Looking at the hookup guide, it actually seems that the author was also not able to get a GPS fix, The author suggested the reason was poor GPS connection, but perhaps it's actually the code. Looking through the code it seems to me that it will not work on Arduino Uno with software serial, because it does too many other things including delays to be able to read the incoming data from the serial GPS module. https://learn.sparkfun.com/tutorials/can-bus-shield-hookup-guide

sunekaae avatar Oct 13 '17 23:10 sunekaae

I have reorganized the code such that:

  • using "while" instead of "if" for the uart_gps.available() check
  • moving the uart_gps.available() to the top of the loop and ensuring that other code only runs once a second, ensures that there's time to read the incoming serial GPS data

I have not done substantial rewrite or refactor, rather just reorganized what already exists and tweaked it to get the GPS to work

Here's the reorganized code: https://github.com/sunekaae/SparkFun_CAN-Bus_Arduino_Library/tree/fix-gps-on-ecu-demo

sunekaae avatar Oct 13 '17 23:10 sunekaae