PX4 Serial Communication Issue with Mixed px4_info Messages(1.16.0)

Hello everyone, I have a question and hope to get some support.

I wrote a custom serial read/write program that binds to a PX4 serial port via parameters (I used Telem3/4).

However, I noticed that no matter which serial port I select to, when I output custom messages, they are always mixed with px4_info/error messages, as shown in the image below.

What could be causing this issue? I am currently testing on version 1.16.0, using the micoair_h743 board. My serial port initialization code is as follows:

void Test_uart::Uart_Init(void)

{

uint32_t baudRateConst;

struct termios uart_config;

_band = _param_custom_baud.get();

switch (_band)

    {

case 0:

baudRateConst = B9600;

break;

case 1:

baudRateConst = B19200;

break;

#ifdef B38400

case 2:

baudRateConst = B38400;

break;

#endif

#ifdef B57600

case 3:

baudRateConst = B57600;

break;

#endif

#ifdef B115200

case 4:

baudRateConst = B115200;

break;

default:

baudRateConst = B115200;

    }

_fd = open(_device, O_RDWR | O_NONBLOCK);

tcgetattr(_fd, &uart_config);

cfsetspeed(&uart_config, baudRateConst);

uart_config.c_cflag &= ~(CSTOPB | PARENB | CRTSCTS);

uart_config.c_lflag &= ~(ECHO | ECHONL | ICANON | IEXTEN | ISIG);

uart_config.c_iflag &= ~(IGNBRK | BRKINT | ICRNL | INLCR | PARMRK | INPCK | ISTRIP | IXON);

uart_config.c_oflag = 0;

tcsetattr(_fd, TCSANOW, &uart_config);

}

My guess is that either the console is enabled on the serial port, or MAVLink.

Check the defconfig file for what UART the console is on, and check the MAVx_ params for the mavlink configuration (or check mavlink status) in the console.

I just checked the deconfig file and found only CONFIG_USART6_SERIAL_CONSOLE set yes, yet I’m not using USART6.
In QGroundControl I also verified the MAVLink parameters: only TELEM1 is used.

Another new finding: when I deployed the same custom module on v1.14.3, this problem did not occur.

Ok, so you want to use Telem3 and Telem4 on Micoair h743, let’s see:

Let’s look at the defconfig:

Let’s do the mapping:

  • USART1 → /dev/ttyS0 → Telem1
  • USART2 → /dev/ttyS1→ Telem2
  • USART3 → /dev/ttyS2→GPS
  • UART4 → /dev/ttyS3→Telem3
  • USART6 → /dev/ttyS4→ Console
  • UART7 → /dev/ttyS5→ UART6
  • UART8 → /dev/ttyS6 → Telem4

Does that make sense? Can you check mavlink status to see what’s running? Have you configured any OSD on ports?

Thank you for your help,your serial-port mapping is right.

I’m not used MSP_OSD or Mavlink _OSD on any port.

I’ll check the “mavlink status” nsh output during the next test and get back to you. Thanks again!

This is the output of mavlink_status , but I think it’s irrelevant; the information printed on the serial port looks more like system_console messages.

Ah, what if you disable the console in defconfig?

i can`t find any config set about *console in deconfig file,But after comparing the defconfig files of v1.14.3 and v1.16.0, I found two options that are absent in v1.16.0:

  • CONFIG_SERIAL_TERMIOS=y

  • CONFIG_STM32H7_SERIAL_DISABLE_REORDERING=y

Also, what does the newly added line CONFIG_DRIVERS_CDCACM_AUTOSTART=y in the px4board file of v1.16.0 mean?

Which file are you looking at?

*board_name/nuttx-config/nsh/deconfig

Which autopilot? I can’t help you if I don’t see the file…