Clear Filters
Clear Filters

PX4 HIL with Pixhawk 6x with Monitor and Tune ERROR:Could not connect to target application: XCP internal error: timeout expired, in response to XCP CONNECT command

12 views (last 30 days)
I'm trying to run with monitor and tune this mathworks demo where Pixhawk is connected through USB type C cable and via FTDI converter connected to the TELEM1 port as shown in the figure above:
I follow all the instruction in the documentation:
  1. Set up all the parameters in QGC
  2. Disable MAV_0_CONFIG (for monitor and tune)
  3. Set up HIL mode into the simulink block with jmasim
  4. Set up external mode for TELEM 1 (dev/ttyS6) and Host serial port (the FTDI converter has COM6)
  5. Applied a baud rate of 115200 to dev/ttyS6
I have tried to make it work with TELEM1(/dev/ttyS6),TELEM2(/dev/ttyS4),TELEM3(/dev/ttyS1) , GPS2(/dev/ttyS7) ect but it does not work either. The error that appear is the following:
I'm using windows 10(version 22H2 OS build 1905.3570), Matlab 2023b and pixhawk 6x. How can I fix this problem?

Accepted Answer

Arun Mathamkode
Arun Mathamkode on 2 Nov 2023
From the details provided, the serial port mapping you used, PX4 hardware connections, QGC parameters and the configuration settings in Simulink look correct. To figure out what might be going wrong you can consider following the below steps.
  • Ensure that you are able to run the Monitor and Tune simulation with the same target if you choose USB(/dev/ttyACM0) as the port for the Monitor and Tune simulation. This will ensure that all the customization to add Simulink generated PX4 app to the PX4 stack is done correctly.
  • Ensure that the wire connections to FTDI are proper. Just Tx and Rx connections are sufficient (Hardware Tx to FTDI Rx and vice-versa). If there is a way for you to verify the FTDI connection please have a look at that as well. One way I can think of is to enable MALInk on the TELEM port and make sure you have established a connection between Pixhawk and QGC over USB. Now if you open PuTTY or any other similar application on COM6 and try to read data, you should see some MAVLink data.
If you are not able to resolve this, please reach out to MathWorks Tech Support.
Salvatore Matteo Mennea
Salvatore Matteo Mennea on 2 Nov 2023
@Arun Mathamkode Thank you! The problem was that the Hardware Tx was connected to FTDI TX and so the RX.So connecting them in the opposite way,I fixed it! I have another problem. If I want to perform simulation with UAV dynamics simulink-based model( this demo here ) which COM port do I have to insert into the blocks "MAVlink Bridge Source" and "MAVlink bridge Sink"? I have this error message "Unable to create a communication link with the serial port. Please check the input argument PORT and verify that a device is connected."
I have the USB that is the COM3 and FTDI converter that is the COM6. I tried both but I have this error. How can I fix it?
Ankur Bose
Ankur Bose on 9 Nov 2023
It should be the USB COM port COM3. In your controller, ensure that "enable mavlink in tty/ACM0" checkbox is selected and then deployed on hardware before you run the plant model

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!