Main Content

GPIO Write

Set logical state of an output pin

Since R2021b

Add-On Required: This feature requires the MATLAB Coder Support Package for NVIDIA Jetson and NVIDIA DRIVE Platforms add-on.

  • NVIDIA GPIO write block

NVIDIA Jetson and NVIDIA DRIVE / Basic


Use this block to:

  • Create a physical output to a GPIO pin.

  • Receive the logical value from other blocks in the model as a stream of boolean values.

  • Write the logical value to a GPIO pin at intervals that are determined by Sample time.


You can damage your target hardware by:

  • Shorting a GPIO pin to ground.

  • Shorting a GPIO pin with high voltage to another GPIO pin with low voltage.

  • Connecting a GPIO pin to a voltage source greater than the maximum voltage.

  • Exceeding the maximum current by driving multiple GPIO pins high simultaneously.



expand all

The input port to set the GPIO pin status.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | Boolean | fixed point | enumerated | bus


expand all

Specify the name of the target board. This selection affects the pins available for general purpose input and output.

Programmatic Use

Block Parameter: Board
Type: character vector, string
Values: 'NVIDIA Jetson TX1'|'NVIDIA Jetson TX2'|'NVIDIA Jetson Nano'|'NVIDIA Jetson AGX Xavier'|'NVIDIA Jetson Xavier NX'
Default: 'NVIDIA Jetson TX1'

Select a GPIO pin to write the logical status.

To open the pin mapping table, click View pin map. Make sure to assign different pin numbers to the different blocks of your model.

Specify how often the block should read the port buffer. Enter a value greater than 0 or -1 (for inherited sample time).

When you specify this parameter as-1, Simulink® determines the best sample time for the block based on the block context within the model.

This value defaults to a sample time of 0.1 seconds. Smaller values require the processor to complete the same number of instructions in less time and this can cause task overruns.

Version History

Introduced in R2021b