eProsima / Micro-XRCE-DDS

An XRCE DDS implementation. Looking for commercial support? Contact info@eprosima.com
Apache License 2.0
156 stars 17 forks source link

Unable to connect Raspberry Pi 4 to mRo Pixhawk flight controller via uXRCE-DDS wired serial connection #175

Open Geol-23 opened 1 month ago

Geol-23 commented 1 month ago

Hello, I’m using a Raspberry Pi 4 (Ubuntu 22.04) to communicate with an mRo Pixhawk ( PX4 1.14.3). I’ve followed the guide and installed the agent as a standalone on the Pi. When I run the agent, nothing happens the agent idles waiting for a connection. I’ve used the reccommended baud rates and ports (921600, TELEM2 on the FC and UART0 on the Pi), I believe the pins and connections are the correct way around and the wire connections are solid. I’ve also added the dialout permissions and I ran lsof /dev/ttyAMA0 to check nothing else is running on that port.

To diagnose this I’ve tried to boot up a seperate FC (same version and firmware as the main FC) and the issue persists. I’ve established communication with the FC using mavproxy.py according to the guide. I've also followed the eProsima docs for the installation and usage. I’ve also used screen and minicom to take a look at the data going through /dev/ttyAMA0 when the FC and RPi are connected and there is activity (albeit it’s just invalid characters).

I think I’ve managed to narrow it down to a software issue on the Raspberry Pi. Using a feedback loop across the TX and RX pins on the Pi, I’ve managed to send and recieve characters over the serial port.

I’ve also tried installing the Agent as a ROS2 package and the issue still persits. To ensure that the workspace actually built I had to clone an earlier version of the MicroXRCE-DDS-Agent, 2.2.1. With the two devices disconnected and reading the voltage at the TX and RX pins on the Pi, both pins read 3.3V. I’m pretty sure the UART protocol is that the TX pin is high by default but would it matter if the RX pin 3.3V?

Also using screen or minicom and the same feedback loop as before, no characters appear on the terminal when running the agent. This tells me that the agent isn’t attempting to handshake with the with the client.

Logs

Raspberry Pi:

MicroXRCEAgent serial --dev /dev/ttyAMA0 -b 921600 -v 6 [1709157626.383849] info | TermiosAgentLinux.cpp | init | running... | fd: 3 [1709157626.385726] info | Root.cpp | set_verbose_level | logger setup | verbose_level: 6

Flight Controller

nsh> uxrce_dds_client status INFO [uxrce_dds_client] Running, disconnected INFO [uxrce_dds_client] Using transport: serial

To Reproduce

Install the agent standalone the RPi and configure UART0 per the guides Configure the baud rate (921600), port (TELEM2) and leave everything else default Reboot FC as needed and power it through the micro-usb port to your ground station (I’m using QGroundControl) Assuming the two are wired together and since the client is already running on the FC start the agent using this command MicroXRCEAgent serial -b 921600 -D /dev/ttyAMA0 -v 6

Expected behavior

The guide states that there should be some output on the RPi terminal and the FC terminal but nothing changes for me. When I check the status of the client, it’s running but not connected. Same with the output on the terminal.

I’m still relatively new to the Pixhawk and eProsima environment so any help is appreciated. Cheers.