PX4 HITL Simulink Monitor & Tune (External Mode over XCP Serial) fails to connect on Cube Orange Plus while normal deployment works

I am working on the MathWorks example “PX4 Autopilot in Hardware-in-the-Loop (HITL) Simulation with UAV Dynamics in Simulink” using real PX4 hardware.
Hardware & setup
  • Flight controller: Cube Orange Plus
  • Host OS: Windows
  • PX4 firmware: PX4-Autopilot (HITL enabled)
  • Simulink version: R2024b
  • Communication:
  • USB-TTL (FTDI) connected to the Cube (TELEM/UART)
  • MAVLink over USB/UDP for QGroundControl
  • Wiring verified and matches the example
  • COM port detected correctly in Windows Device Manager
What works (Method 1)
✔ Controller deployed to the autopilot in normal mode (no Monitor & Tune / no External Mode)
✔ HITL simulation runs correctly
✔ QGroundControl receives MAVLink data and vehicle behaves as expected
What does NOT work (Method 2 – Monitor & Tune)
When deploying the controller for Monitor & Tune (External Mode using XCP on Serial), the connection fails.
Notes
  • I followed the example step-by-step exactly as documented.
  • The same serial port (COM16) works for normal deployment.
  • No other application (PuTTY, QGC, etc.) is using COM16 during Monitor & Tune.
  • Baud rate is set to 921600 as required by the example.
  • The issue appears only when enabling External Mode (XCP on Serial).
Question
  • Is there a known limitation or additional PX4 configuration required for External Mode (XCP on Serial) with Cube Orange Plus?
  • Is this issue related to PX4 firmware, serial port assignment, or Windows serial driver behavior?
  • Has anyone successfully used Monitor & Tune with PX4 HITL on real hardware (Cube / Pixhawk series)?
action: EXT_INIT
Creating Target Handler (XCP on Serial)...
Build directory:
C:\Users\Rahul\OneDrive - BLUJ AEROSPACE PRIVATE LIMITED\Documents\MATLAB\Examples\R2024b\px4\PX4HITLSimulinkPlant2\px4demo_HITLSimulinkPlant\work\code\Quadcopter_ControllerWithNavigation_ert_rtw
Serial Port Name: COM16
Baud Rate: 921600
action: EXT_CONNECT
Connecting to the target...
External Mode Open Protocol Connect command failed
Caused by:
Could not connect to target application:
XCP serial port error: open: The system cannot find the file specified
[system:2 at
\\mathworks\hub\3rdparty\R2024b\11242549\win64\boost\include\boost-1_81\
boost\asio\detail\impl\win_iocp_serial_port_service.ipp:66:5
in function 'open']
Component: Simulink
Category: Model error

Réponses (1)

Use GPS2 or GPS1 for monitor and tune communication over non-USB port connection, as there might be issues using TELEM1 or TELEM2 ports for Cube Orange/Cube Blue H7/ Cube Orange Plus. Deployment on Cube Orange Autopilot from Simulink - MATLAB & Simulink. For the GPS1 and GPS2 ports, make sure that GPS_1_CONFIG or GPS_2_CONFIG are not assigned to those ports, ensuring that PX4 does not start any GPS protocol on them.

Community Treasure Hunt

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

Start Hunting!

Translated by