I’m currently trying to establish communication over the telem2 port on the CubePilot (with CubeOrange+) to a listening microcontroller device on the other side of the connector. I’m currently building and installing the PX4 1.14 firmware, cubepilot_cubeorangeplus, with the additional communicating program I plan to run on it.
I confirmed using the serial port guide (Serial Port Mapping | PX4 User Guide) and Cube Orange plus specific guide (PX4-user_guide/cubepilot_cube_orangeplus.md at baea220ce593463b7837e96d218da2298cb8d22b · PX4/PX4-user_guide · GitHub) that USART3 (TELEM2) is mapped to /dev/ttyS1
I wrote a simple C program to try and send a message through that port. When the microcontroller did not receive any data, I hooked up a logic analyzer to the tx and rx lines on the other end, and verified no data was coming through (Both lines remained high at ~3.3v based on the analog recording)
Code I was using to communicate:
void serial_test(char* device_name)
{
struct termios tty;
int serial_port = open(device_name, O_RDWR | O_NOCTTY | O_NDELAY);if(tcgetattr(serial_port, &tty) != 0) {
printf(“Error %i from tcgetattr: %s\n”, errno, strerror(errno));
}
cfsetspeed(&tty, B57600);
if (tcsetattr(serial_port, TCSANOW, &tty) != 0) {
printf(“Error %i from tcsetattr: %s\n”, errno, strerror(errno));
}
PX4_INFO(“Sending over %s”, device_name);
unsigned char msg[] = { ‘H’, ‘e’, ‘l’, ‘l’, ‘o’, ‘\r’ };
int bytes = write(serial_port, msg, sizeof(msg));
//fflush(serial_port);
PX4_INFO(“Sent %d bytes”, bytes);
px4_usleep(10000000);
close(serial_port);
}
My question is if there is any additional configuration needed to make it work. I would expect the lines to still toggle voltage, even if some of the parity/stop configurations on the receiver weren’t correct. I used tried hooking the connector to GPS2 instead of TELEM2 and using /dev/ttyS5 to see if there was any activity there, but also did not find any.