Successful UART on Snapdragon Flight?

Has anyone been able to accomplish successful UART loopback on Snapdragon Flight? I have tried multiple devices, even the test program doesn’t perform read or write correctly. I have tested with an oscilloscope as well as with a loopback wire from TX to RX on all four /dev/tty-<#> ports. I have tried using DSPAL read callback as well as regular read() method. My program looks very similar to the DSPAL serial tester. My read_callback(), read() and write() codes are below:

void port_read_callback(void *context, char *buffer, size_t num_bytes) {
  int rx_dev_id = (int)context;
  char rx_buffer[SERIAL_SIZE_OF_DATA_BUFFER];

  if (num_bytes > 0) {
    memcpy(rx_buffer, buffer, num_bytes);
    rx_buffer[num_bytes] = 0;
    PX4_INFO("/dev/tty-%d read callback received bytes [%d]: %s",
      rx_dev_id, num_bytes, rx_buffer);
  } else {
    PX4_ERR("error: read callback with no data in the buffer");

int assign_serial_read_callback(int fd, int port_num) {
  int res;

  PX4_INFO("Beginning serial read callback setup");

  struct dspal_serial_ioctl_receive_data_callback recv_cb;
  recv_cb.rx_data_callback_func_ptr = port_read_callback;

  recv_cb.context = (void *)(1);

  res = ioctl(fd,
      (void *)&recv_cb);

  PX4_INFO("Using callback on fd %d",fd);
  PX4_INFO("Set serial read callback on %s %s",
    serial_path[port_num-1], res < SUCCESS ? "failed" : "succeeded");

  if (res < SUCCESS) {
    PX4_INFO("Closing file %s",
    fd = ERROR;

	return fd;

int serial_read(int fd, int port_num, char *rx_buffer) {
  int num_bytes_read = 0;

  PX4_INFO("Beginning serial read");
  num_bytes_read = read(fd, rx_buffer,
  PX4_INFO("%s read bytes [%d]: %s",
      serial_path[port_num-1], num_bytes_read, rx_buffer);

  if (num_bytes_read < 0) {
    PX4_INFO("Closing file %s",
    fd = ERROR;

	return fd;

int serial_write(int fd, int port_num, char *tx_buffer){
  int num_bytes_written = 0;

  PX4_INFO("Beginning serial write");

  num_bytes_written = write(fd,
      (const char *)tx_buffer,

  if (num_bytes_written == (ssize_t)strlen(tx_buffer)) {
    PX4_INFO("Wrote %d bytes to %s", num_bytes_written,
  } else {
    PX4_ERR("failed to write to %s", serial_path[port_num]);
    PX4_INFO("Closing file %s", serial_path[port_num]);
    fd = ERROR;

	return fd;

Edit: Pictures of scope and port setups
This is showing the port next to the power port, which I assume is J13 and tty-2 as prescribed by the blsp.config mapping from I also assume that pinouts are numbered from 1 farthest from the power port up to 6. Which makes the outputs shown on this connector to be {5V, TX, RX, GND}. APQ_GPIO{29/30} are not set up.

I find the results in the update when common ground (white wire) is connected to oscilloscope. And a quickly decaying output from TX every couple of microseconds at ~5V P-P (all ports, even inactive) when no common ground is connected to oscilloscope.

snapdragon flight port setup.

snapdragon flight oscilloscope setup

Update: Debugging UART thru the pwm_out_rc_in module.

Got some weird results debugging UART signal using PX4 module ^.

On oscilloscope, generated strange 10V peak-to-peak signal on TX pin. 10V peak-to-peak out of port J13 is expected, but the signal did not look like a square wave and was inconsistent. This occurred each time that PX4 was running and module ^ was assigned to output on port J12. Port J12 generated similar looking >10V peak-to-peak signal on TX pin, which is not expected, as J12 outputs 3.3V.

No signal output shown on other pins (including power) or when nothing connected to oscilloscope.

Seems there is a grounding issue?

@metinburak See the edit for the setup. What would the grounding issue be?