Dtynin
Dtynin
DIIDevHeads IoT Integration Server
Created by Dtynin on 7/11/2024 in #middleware-and-os
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?
5 replies