Main Content

GPIO Read

Read logical state of an input 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 read block

Libraries:
NVIDIA Jetson and NVIDIA DRIVE / Basic

Description

Use this block to:

  • Create a physical input from a GPIO pin.

  • Read the logical value of the GPIO pin at intervals that are determined by Sample time.

  • Send the logical value to other blocks in the model as a stream of boolean values.

Warning

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.

Ports

Output

expand all

Logical state of an input pin at intervals that are determined by Sample time.

Data Types: Boolean

Parameters

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