Trying to interface a GPS module with my AVR using UART in Zephyr RTOS

@Middleware & OS Hi friends, I'm trying to interface a GPS module with my AVR microcontroller using UART in Zephyr RTOS. I've set up the UART peripheral and device tree configuration, but I'm not receiving any data from the GPS module. I tried configuring the UART peripheral in prj.conf, created device bindings in the device tree source file (dts), and wrote code to read data from the GPS module. When the GPS module is functioning correctly and transmitting data over UART, I should see NMEA sentences like $GPGGA, $GPRMC. I'm using the GPS(Ublox NEO-6M) module model. this is a sample of my code snippet:
#include <zephyr.h>
#include <device.h>
#include <drivers/uart.h>
#include <logging/log.h>

LOG_MODULE_REGISTER(main);

#define GPS_UART DT_NODELABEL(gps)

void main(void) {
const struct device *uart_dev = DEVICE_DT_GET(GPS_UART);

if (!device_is_ready(uart_dev)) {
LOG_ERR("UART device not ready");
return;
}

uint8_t data;
while (1) {
if (uart_poll_in(uart_dev, &data) == 0) {
LOG_INF("Received: %c", data);
}
}
}
#include <zephyr.h>
#include <device.h>
#include <drivers/uart.h>
#include <logging/log.h>

LOG_MODULE_REGISTER(main);

#define GPS_UART DT_NODELABEL(gps)

void main(void) {
const struct device *uart_dev = DEVICE_DT_GET(GPS_UART);

if (!device_is_ready(uart_dev)) {
LOG_ERR("UART device not ready");
return;
}

uint8_t data;
while (1) {
if (uart_poll_in(uart_dev, &data) == 0) {
LOG_INF("Received: %c", data);
}
}
}
What could be causing the issue of not receiving any data from the GPS module? Any Idea?
Solution:
It might not be code issue check whether your gps is synced or not sometimes it takes time for gps to lock up to a satellite and then it starts giving out data In one of our design gps sync took good 15minutes due to poor pcb design...
Jump to solution
3 Replies
Solution
electro_coco
electro_coco4mo ago
It might not be code issue check whether your gps is synced or not sometimes it takes time for gps to lock up to a satellite and then it starts giving out data In one of our design gps sync took good 15minutes due to poor pcb design
Dtynin
Dtynin4mo ago
alright @electro_coco I will check through
electro_coco
electro_coco4mo ago
Also what i did to shorten the time of gps sync to 1 minute is to put aluminum foil dish plate under it
Want results from more Discord servers?
Add your server