Main Content

Model Configuration Parameters for PX4 Flight Controller

Hardware Implementation Pane Overview

Default Hardware Implementation Pane

Configure PX4® flight controller to run Simulink® models.

  1. In the Simulink Editor, select Simulation > Model Configuration Parameters.

  2. In the Configuration Parameter dialog box, click Hardware Implementation.

  3. Set the Hardware board parameter to one of these, based on the board connected to the host computer:

    • PX4 Cube Blue H7

    • PX4 Cube Orange

    • PX4 Cube Orange Plus

    • PX4 Pixhawk® 6c

    • PX4 Pixhawk 6x

    • PX4 Pixhawk 1

    • PX4 Pixhawk 2.1 (Cube)

    • PX4 Pixhawk 4

    • Pixhawk Series

    • PX4 Pixracer

    • PX4 Uvify IFO-S

    For more information, see Supported PX4 Autopilots.

    Additionally, you can also select PX4 Host Target as the Hardware board to perform only simulation using the jMAVSim simulator.

  4. The parameter values under Hardware board settings are automatically populated to their default values.

    You can optionally adjust these parameters for your particular use case.

  5. To apply the changes, click Apply.

For more information on selecting a hardware support package and general configuration settings, see Hardware Implementation Pane (Simulink).

Build Options

ParameterDescriptionDefault Value
Build action

Option to specify whether you want only the build, or the build, load, and run actions during code generation

Build, load, and run

CMake configuration

Change the CMake configuration file that is used to build the firmware.

<empty>

Automatically determine serial port for firmware upload

Enables the automatic detection of the serial port for firmware upload, based on the hardware connections

Note

This parameter does not appear if you select the Hardware board as PX4 Host Target.

on
Serial port for firmware upload

Select the serial port of the host computer for firmware upload

Note

This parameter does not appear if you select the Hardware board as PX4 Host Target.

<empty>

Serial port for NuttX (NSH) Terminal

Select the serial port of the host computer for Nuttx (NSH) terminal

<empty>

Allow flashing FMUv3 CMake configuration on Pixhawk 1

(Applicable only if you selected PX4 Pixhawk1 or PX4 Pixhawk Series as the Hardware Board) Determines if you need to allow flashing FMUv3 configuration on Pixhawk 1

off

Simulator

Select the simulator to be used

Note

This parameter appears only if you select the Hardware board as PX4 Host Target.

jMAVSim

HITL

Note

This tab does not appear if you select PX4 Host Target as the Hardware board.

ParameterDescriptionDefault Value
Enable HITL Mode

Enables the usage of HITL mode

off
Simulator

Simulation engine containing the physics for the UAV Dynamics

jMAVSim

Connected I/O

Note

This tab does not appear if you select PX4 Pixhawk Series as the Hardware board.

ParameterDescriptionDefault Value
Hardware board Serial Port

Serial port number on the PX4 flight controller board for Connected I/O communication

Note

This parameter does not appear if you select PX4 Host Target as the Hardware board.

/dev/tty/ACM0
Use the same host serial port for Connected I/O as used for firmware upload

Sets the same host serial port for Connected I/O as the one used for firmware upload

Note

This parameter does not appear if you select PX4 Host Target as the Hardware board.

on
Host Serial Port

Serial port number on the host computer for External mode communication

Note

This parameter does not appear if you select PX4 Host Target as the Hardware board.

<empty>

External mode

ParameterDescriptionDefault Value
Communication interface

Communication interface that is used to exchange data between host computer and PX4 flight controller board.

XCP on TCP/IP — For PX4 Host Target

XCP on Serial — For all other PX4 boards

Use the same host serial port for External mode as used for firmware upload

Sets the same host serial port for External mode as the one used for firmware upload

Note

This parameter does not appear if you select PX4 Host Target as the Hardware board.

on
Host Serial Port

Serial port number on the host computer for External mode communication

Note

This parameter does not appear if you select PX4 Host Target as the Hardware board.

<empty>
Hardware board Serial Port

Serial port number on the PX4 flight controller board for External mode communication

Note

This parameter does not appear if you select PX4 Host Target as the Hardware board.

/dev/tty/ACM0
Set logging buffer size automatically

Automatically set the number of bytes to preallocate for the buffer in the hardware during simulation.

Note

This parameter does not appear if you select PX4 Host Target as the Hardware board.

on

Logging buffer size (in bytes)

Specify the memory buffer size for XCP-based External mode simulation.

Note

This parameter does not appear if you select PX4 Host Target as the Hardware board.

1024
Verbose

View External mode execution progress and updates

on

Onboard Connectivity

Note

This tab appears only if you select PX4 Host Target as the Hardware board.

ParameterDescriptionDefault Value
Onboard Connectivity

IP address of onboard computer

127.0.0.1

Clocking

Note

This tab does not appear if you select the Hardware board as PX4 Host Target.

ParameterDescriptionDefault Value
CPU Clock (MHz)

The CPU clock frequency in MHz

168

PIL

Note

This tab does not appear if you select PX4 Host Target as the Hardware board.

ParameterDescriptionDefault Value
Hardware board serial port

Serial port number on the hardware board for PIL communication

Note

This parameter does not appear if you select PX4 Host Target as the Hardware board.

/dev/ttyACM0
Use the same host serial port for PIL as used for firmware upload (mentioned under 'Build Options')

Enables the usage of same host serial port for PIL as the one used for firmware upload

Note

This parameter does not appear if you select PX4 Host Target as the Hardware board.

on
Host Serial Port

Serial port number on the host computer for PIL communication

COM6

I2C

Note

This tab does not appear if you select PX4 Host Target as the Hardware board.

ParameterDescriptionDefault Value in KHz
Bus 1 speed (KHz)Defines the rate of data communication between the peripherals connected by the I2C Bus 1.100
Bus 2 speed (KHz)Defines the rate of data communication between the peripherals connected by the I2C Bus 2.100
Bus 3 speed (KHz)Defines the rate of data communication between the peripherals connected by the I2C Bus 3.100
Bus 4 speed (KHz)Defines the rate of data communication between the peripherals connected by the I2C Bus 4.100

CAN

Note

This tab does not appear if you select PX4 Host Target as the Hardware board.

ParameterDescriptionDefault Value
CAN PortDefines the CAN port used on the host computer.CAN
Baud rate (in bits/s)Defines the rate at which data is transferred over CAN network. (in bits/s).500000
Test modeSpecifies if the CAN test mode is enabled or not.Off

MAVLink

Note

This tab does not appear if you select PX4 Host Target as the Hardware board.

ParameterDescriptionDefault Value
Enable MAVLink on /dev/ttyACM0

Enables the usage of MAVLink protocol

Note

If you enable MAVLink, you must also change the Hardware board serial port value in External mode and PIL tabs. This is because these tabs use /dev/ttyACM0 as the default serial port.

off

/dev/tty

Note

All the /dev/tty tabs are available for configuration if you select any Pixhawk Series board as the Hardware board.

Note

None of the /dev/tty tabs are displayed if you select PX4 Host Target as the Hardware board.

ParameterDescriptionDefault Value
Baud rate

Defines the rate at which data is transferred over a serial line

3000000

Parity

Determines whether the UART or USART port generates and checks for even parity or odd parity

None

Stop bits

Sets the number of stop bits to indicate end of a packet

1

Enable hardware flow control

Enables hardware flow control using RTS and CTS pins

off
View port map

View the port mapping of UART or USART port on the PX4 flight controller

 

Overrun Action

ParameterDescriptionDefault Value
Shutdown PX4 Autopilot upon overrun

Enables shutdown of PX4 Autopilot if task overrun occurs

off