SPI Register Read
Libraries:
NVIDIA Jetson and NVIDIA DRIVE /
Communication
Description
Add-On Required: This feature requires the MATLAB Coder Support Package for NVIDIA Jetson and NVIDIA DRIVE Platforms add-on.
The SPI Register Read block reads data from the register of a Serial Peripheral Interface (SPI) device connected to an NVIDIA® Jetson™ board.
Ports
Output
Data read from the register of the SPI device, returned as a scalar or a column vector. The Output data type parameter determines the output data type. The output is an N-by-1 vector, where N is the integer specified by the Output data length parameter.
Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32
Parameters
To edit block parameters interactively, use the Property Inspector. From the Simulink® Toolstrip, on the Simulation tab, in the Prepare gallery, select Property Inspector.
Hardware board to deploy the model to.
Programmatic Use
To set the block parameter value programmatically, use
the set_param (Simulink) function.
To get the block parameter value
programmatically, use the get_param (Simulink) function.
| Parameter: | Board |
| Values: | "NVIDIA Jetson TX2 Developer Kit" | "NVIDIA Jetson AGX Xavier Developer Kit" | "NVIDIA Jetson AGX Orin Developer Kit" | "NVIDIA Jetson Xavier NX Developer Kit" | "NVIDIA Jetson Orin Nano Developer Kit" | "NVIDIA Jetson Nano Developer Kit" |
Example: set_param(gcb,"Board","NVIDIA Jetson Orin Nano Developer
Kit")
Pin connected to the SPI peripheral device. For TX2 boards, the default value is
SPI3_CS0. For other boards, the default value is
SPI0_CS0.
Dependencies
The available options depend on the Board parameter. This table shows the available interfaces for each board.
| Board | SPI Interfaces |
|---|---|
NVIDIA Jetson AGX Xavier Developer Kit | SPI0 |
NVIDIA Jetson TX2 Developer Kit | SPI3 |
NVIDIA Jetson Orin Nano Developer Kit | SPI0 and SPI1 |
NVIDIA Jetson Nano Developer Kit | SPI0 and SPI1 |
NVIDIA Jetson AGX Orin Developer Kit | SPI0 and SPI2 |
NVIDIA Jetson Xavier NX Developer Kit | SPI0 and SPI2 |
Mode to use for SPI communication. This table shows the clock polarity and clock phase for each setting.
| Mode | Clock Polarity | Clock Phase |
|---|---|---|
0 | 0 | 0 |
1 | 0 | 1 |
2 | 1 | 0 |
3 | 1 | 1 |
Programmatic Use
To set the block parameter value programmatically, use
the set_param (Simulink) function.
To get the block parameter value
programmatically, use the get_param (Simulink) function.
| Parameter: | ClockMode |
| Values: | "0" (default) | "1" | "2" | "3" |
Example: set_param(gcb,"ClockMode","2")
SPI peripheral address to read from. Each value of the register address must be a nonnegative integer less than or equal to 255.
Programmatic Use
To set the block parameter value programmatically, use
the set_param (Simulink) function.
To get the block parameter value
programmatically, use the get_param (Simulink) function.
| Parameter: | RegisterAddress |
| Values: | "0" (default) | integer between 0 and 255 in quotes |
Example: set_param(gcb,"RegisterAddress","[1 2]")
Data type to output.
Programmatic Use
To set the block parameter value programmatically, use
the set_param (Simulink) function.
To get the block parameter value
programmatically, use the get_param (Simulink) function.
| Parameter: | OutputDataType |
| Values: | "int8" (default) | "uint8" | "int16" | "uint16" | "int32" | "uint32" | "single" | "double" |
Example: set_param(gcb,"OutputDataType","int16")
Length of data to read.
Programmatic Use
To set the block parameter value programmatically, use
the set_param (Simulink) function.
To get the block parameter value
programmatically, use the get_param (Simulink) function.
| Parameter: | OutputDataLength |
| Values: | "1" (default) | positive integer in quotes |
Example: set_param(gcb,"OutputDataLength","2")
Sample time. The SPI Register Read block reads from the register at the
rate specified by the Sample Time parameter. If Sample
Time is -1, Simulink automatically chooses a sample time for the block.
Programmatic Use
To set the block parameter value programmatically, use
the set_param (Simulink) function.
To get the block parameter value
programmatically, use the get_param (Simulink) function.
| Parameter: | SampleTime |
| Values: | "-1" (default) | scalar value in quotes |
Example: set_param(gcb,"SampleTime","0.2")
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
GPU Code Generation
Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.
Version History
Introduced in R2026a
See Also
Blocks
Model Settings
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)