-
Notifications
You must be signed in to change notification settings - Fork 26
Description
I am using the RisingHF SX1301 board from Seeed at this URL https://www.seeedstudio.com/LoRa-LoRaWAN-Gateway-915MHz-for-Raspberry-Pi-3.html.
It does not come with a GPS module so I purchased one thinking I was going to get a u-blox8 chip, however I didn't, it is a GE-A103 from Taiwan. I soldered it on the board and the PPS also is working correctly.
http://www.navisys.com.tw/products/SiRF_CSR_GPS_GNSS%20module/flyer/GE-A103_flyer-150429.pdf#search=%27GEA103%27
http://aitendo3.sakura.ne.jp/aitendo_data/product_img/gps/GE-A103/GE-A103_DS-161004.pdf
For some reason I keep losing the serial port so I added a bad tweak, and hopefully someone can come up with something better. Without the reconnect tweak "WARNING: [gps] read() returned value 0" is spammed on the terminal window and the GPS serial (/dev/ttyS0) is never reconnected.
Sorry I am not the greatest with git but this is what I changed.
in packet_forwarder/mp_pkt_fwd/src/mp_pkt_fwd.c
line 1922
`
void thread_gps(void) {
/* serial variables /
char serial_buff[128]; / buffer to receive GPS data /
size_t wr_idx = 0; / pointer to end of chars in buffer */
/* variables for PPM pulse GPS synchronization */
enum gps_msg latest_msg; /* keep track of latest NMEA message parsed */
/* initialize some variables before loop */
memset(serial_buff, 0, sizeof serial_buff);
while (!exit_sig && !quit_sig) {
size_t rd_idx = 0;
size_t frame_end_idx = 0;
/* blocking non-canonical read on serial port */
ssize_t nb_char = read(gps_tty_fd, serial_buff + wr_idx, LGW_GPS_MIN_MSG_SIZE);
if (nb_char <= 0) {
MSG("WARNING: [gps] read() returned value %ld\n", nb_char);
MSG("WARNING; [gps] did we disconnect? attempting to reconnect...\n");
lgw_gps_disable(gps_tty_handle);
gps_tty_handle = lgw_gps_enable(gps_tty_path, "ubx7", 0, &gps_tty_fd); /* HAL only supports u-blox 7 for now */
continue;
}
wr_idx += (size_t)nb_char;
`
This made a change necessary to make the serial handle global so it is now defined at top as a global.
line 257
int gps_tty_handle;
line 1366
In function
int main(int argc, char *argv[]) /* Start GPS a.s.a.p., to allow it to lock */ if (gps_enabled == true) { if ((gps_fake_enable == false) && (gps_tty_path[0] != '\0')) { /* do not try to open GPS device if no path set */ gps_tty_handle = lgw_gps_enable(gps_tty_path, "ubx7", 0, &gps_tty_fd); /* HAL only supports u-blox 7 for now */ if (gps_tty_handle != LGW_GPS_SUCCESS) { MSG("WARNING: [main] impossible to open %s for GPS sync (check permissions)\n", gps_tty_path); gps_active = false; gps_ref_valid = false; } else { MSG("INFO: [main] TTY port %s open for GPS synchronization\n", gps_tty_path); gps_active = true; gps_ref_valid = false; } } else { gps_active = false; gps_ref_valid = false; } }
Sorry if the above formatting is not coming through, I tried to get it to display correctly.
The above was altered so the handle is available in another function to close it before reopening it.
This is sloppy, not sure what other effects the sleep(1) has because I didn't want it to spam reconnecting the serial port.
Sorry this is not organized better, but I wanted to get it posted for others to see and hope someone can come up with a less tacky fix to reconnect the GPS when it disconnects.