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 Pixhawk® 1

    • PX4 Pixhawk® 2.1 (Cube)

    • PX4 Pixhawk® 4

    • Pixhawk® Series

    • PX4 Pixracer

    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.

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

Note

This parameter does not appear if you select the Hardware board as PX4 Crazyflie 2.0.

<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

Connected I/O

Note

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

ParameterDescriptionDefault Value
Enable Connected I/O

Enables the usage of Connected I/O

on
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
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

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

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. However, if you select PX4 Crazyflie 2.0 as the Hardware board, only the /dev/ttyACM0 and /dev/ttyS1 tabs are available for configuration.

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

 

PWM Frequency

Note

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

ParameterDescriptionDefault Value
Enable Oneshot125 protocol for Main PWM channels

Enables the Oneshot125 protocol for Main PWM channels

off

Configure Frequency for Main PWM channels (in Hz)

Set the frequency of Main PWM channels

400

Enable Oneshot125 protocol for AUX PWM channels

Enables the Oneshot125 protocol for AUX PWM channels

off

Configure Frequency for AUX PWM channels (in Hz)

Set the frequency of AUX PWM channels

200

Main PWM

Note

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

ParameterDescriptionDefault Value
Main PWM channel x failsafe ON time value (in us)

Time value (in microseconds) that represents the ON time value of PWM signal for the particular Main channel, during failsafe condition

900

Main PWM channel x disarmed ON time value (in us)

Time value (in microseconds) that represents the ON time value of PWM signal for the particular Main channel, during disarmed condition

900

AUX PWM

Note

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

ParameterDescriptionDefault Value
AUX PWM channel x failsafe ON time value (in us)

Time value (in microseconds) that represents the ON time value of PWM signal for the particular AUX channel, during failsafe condition

900

AUX PWM channel x disarmed ON time value (in us)

Time value (in microseconds) that represents the ON time value of PWM signal for the particular AUX channel, during disarmed condition

900

PWM

Note

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

ParameterDescriptionDefault Value
PWM channel x disarmed ON time value (in us)

Time value (in microseconds) that represents the ON time value of PWM signal for the particular PWM channel, during disarmed condition

900

Overrun Action

ParameterDescriptionDefault Value
Shutdown PX4 Autopilot upon overrun

Enables shutdown of PX4 Autopilot if task overrun occurs

off