Unable to talk to IMU with tty command via UART3 using GNSS Flex pHAT ZED-X20P & IM19

Hi

I’m stucked to talk to IMU via tty (AT) command. There is no response from the IMU part.

I’m using Raspberry Pi 5 (os-version 13, Trixie) and I configure the uart overlay at /boot/firmware/config.txt as below:
```[all]
Enable UART Ports
dtparam=uart0=on
enable_uart=1
dtoverlay=uart0
dtoverlay=uart2-pi5 # tested without -pi5 as well on all uarts
dtoverlay=uart3-pi5
dtoverlay=uart4-pi5
```

I configure the gnss module as below and the exprected output are arriving via UART1 and UART2 of Flex pHAT (i.e., UART0 and UART3 in Pi5).

uart1:
CFG_UART1_BAUDRATE: 115200
CFG_UART1OUTPROT_NMEA: 1
CFG_UART1OUTPROT_UBX: 1

nmea:
CFG_MSGOUT_NMEA_ID_GGA_UART1: 1
CFG_MSGOUT_NMEA_ID_GST_UART1: 1
CFG_MSGOUT_NMEA_ID_RMC_UART1: 1
CFG_NMEA_HIGHPREC: 1 # Essential for RTK precision

uart2:
CFG_UART2_BAUDRATE: 115200
CFG_UART2OUTPROT_NMEA: 1
CFG_UART2OUTPROT_UBX: 1

nmea_uart2:
CFG_MSGOUT_NMEA_ID_GGA_UART2: 1
CFG_MSGOUT_NMEA_ID_GST_UART2: 1
CFG_MSGOUT_NMEA_ID_RMC_UART2: 1
CFG_NMEA_HIGHPREC: 1 # Essential for RTK precision

rate:
CFG_RATE_MEAS: 1000
CFG_RATE_NAV: 1

pps:
CFG_TP_PERIOD_TP1: 1000000 # Period in microseconds (1,000,000 us = 1s = 1Hz)
CFG_TP_LEN_TP1: 100000 # Pulse length in microseconds (e.g., 100ms)
CFG_TP_TIMEGRID_TP1: 1 # Align to GPS time

dgnss:
CFG_NAVHPG_DGNSSMODE: 3
CFG_NAVHPG_USE_RTCM_CORR: 1

I’m unable to wake up the IMU and to output something from ther UART 4 of Flex pHAT.
what am i doing wrong? could you kindly guide me on this?

I read some of the suggestions in this link, but AT commands should work even if i’m not moving at outside, is it? my antenna is ouside of my window with RTK fixed status.

Hi @cung ,

Welcome!

To communicate with the IM19, you need to use Raspberry Pi GPIO 4 and 5.

On Raspberry Pi 5, I believe those are allocated to UART2. Not UART4.

Please try UART2, at 115200 baud.

Also, you will need to increase the navigation rate to 5Hz. Please change CFG_RATE_MEAS to 200.

I hope this helps,
Paul

1 Like

Hi @PaulZC ,
Thank you very much for your prompt reply. I updated the CFG_RATE_MEAS to 200 and
I do send AT commands via UART2 of Pi 5. I’ expect at least some data coming out from UART4 if the setup are correct, is it not the case?

When I send AT+SYSTEM_RESET via pygpsclient Options >> TTY commands :
the module seems get some information even though there is no confirmation like “OK” or similar. The rtk status does change and the module restarting confirming it received the commands.

I did the second AT command group “Feymand IM 19 Tilt Survey Setup” without modifying anything (as default, i.e., AT+LEVER_ARM2=0.0057,-0.0732,-0.0645; AT+CLUB_VECTOR=0,0,1.865 ) it seems nothing happen. I don’t see anything on IMU monitor.

what are the expected behaviour to comfirm that the setup are correct and ready to test outside?

Thank you very much again for your kind supports!

If you send AT+VERSION followed by Carriage Return and Line Feed (\r \n), you should receive information about the IM19 firmware version. Please try sending that.

The rtk status does change and the module restarting confirming it received the commands.

This is confusing. Sending AT+SYSTEM_RESET to the IM19 will reset the IM19. It should not change the RTK Status of the X20P GNSS.

For the PyGPSClient IMU Monitor View, you need to have NMEA ticked in “Protocols Shown”, and TTY unticked. If NMEA is unticked - or you have TTY ticked - you will see “No data available”.

image

1 Like

Hi @PaulZC,

Thank you very much for your kind support. I can now see some output from pygpsclient’s IMU monitor. The problem to me was how to correctly send the AT command to the IMU module.

I wrote the following small python script to send the AT commands and it works.

import serial
import time

ser = serial.Serial(“/dev/ttyAMA2”, 115200, timeout=2)
time.sleep(1)

commands = [
“AT+VERSION”,
“AT+LOAD_DEFAULT”,
“AT+GNSS_PORT=PHYSICAL_UART2”,
“AT+NASC_OUTPUT=UART1,ON”,
“AT+LEVER_ARM2=0.0057,-0.0732,-0.0645”,
“AT+CLUB_VECTOR=0,0,1.865”,
“AT+INSTALL_ANGLE=0,180,0”,
“AT+GNSS_CARD=OEM”,
“AT+WORK_MODE=408”,
“AT+CORRECT_HOLDER=ENABLE”,
“AT+SET_PPS_EDGE=RISING”,
“AT+AHRS=ENABLE”,
“AT+MAG_AUTO_SAVE=ENABLE”,
“AT+SAVE_ALL”,
]

for cmd in commands:
print(f"\n>>> Sending: {cmd}")

ser.write((cmd + "\r\n").encode())
time.sleep(0.3)  # device processing time

# Read all available response lines
start_time = time.time()
while time.time() - start_time < 2:
    if ser.in_waiting:
        line = ser.readline().decode(errors="ignore").strip()
        if line:
            print(line)
    else:
        time.sleep(0.05)

ser.close()

Here is the first few line of sample outputs:

Sending: AT+VERSION
OK
Version:IM19_H2_B2.2_A6.1_2eea4d4c024538bf5ed52

Sending: AT+LOAD_DEFAULT
OK

Sending: AT+GNSS_PORT=PHYSICAL_UART2
OK

Sending: AT+NASC_OUTPUT=UART1,ON
OK
$GPFMI,005319.48,0.00000000,0.00000000,0.000,3.12648,0.03741,9.99999,9.900,00,99,0,0004000169
$GPFMI,005319.70,0.00000000,0.00000000,0.000,3.12650,0.03744,9.99999,9.900,00,99,0,000400016E



Now I can further explore on the setups and testing phase. Thank you very much again for your help!

1 Like