Main Content

Pin Mapping for Arduino Timer-Dependent Blocks

Simulink® Support Package for Arduino® Hardware supports these blocks whose operation is dependent on the timer of the Arduino hardware board.

To view the pin mapping for these blocks, click View pin map in the Block Parameters dialog box. This opens the pin mapping table for Arduino boards and Arduino compatible ESP32 boards. For example, to find which pins you can use in the Standard Servo Write block for the Uno board, look for the Standard Servo Write entry under the Blocks column vertically down and Uno board horizontally across. Pins 0-13 can be used for the Uno board.

Arduino timer dependent blocks pin mapping table

For ESP32-WROOM and ESP32-WROVER Arduino compatible boards, use the following pin mapping table to enter the pin numbers for the timer dependent blocks in the Simulink model.

Arduino ESP32 timer dependent blocks pin mapping table

For Teensy 4.0 and 4.1 Arduino compatible boards, use the following pin mapping table to enter the pin numbers for the timer dependent blocks in the Simulink model.

Arduino Teensy timer dependent blocks pin mapping table

For Raspberry Pi® Pico and Pico W Arduino compatible boards, use the following pin mapping table to enter the pin numbers for the timer dependent blocks in the Simulink model.

Arduino Teensy timer dependent blocks pin mapping table

Conflicting Pin Configurations on Arduino Timer

Use one Arduino timer for only one block functionality at a time. For example, if your model uses the PWM block, you cannot connect the Input Capture and Servo blocks to the same timer. Similarly, if your model uses the Input Capture block, you cannot connect the PWM and Servo blocks to the same timer. And, if your model uses the Servo blocks, you cannot connect the PWM and Input Capture blocks to the same timer.

If your Simulink model utilizes multiple timer-dependent blocks, you can use the following table to avoid timer conflicts.

Arduino BoardArduino TimerArduino Pin Connections for Input Capture BlockArduino Pin Connections for PWM BlockServo Block Usage Conflict
Uno, Nano 3.0Timer 189, 10Set 1
Mega 2560/ADKTimer 54844, 45, 46Set 1
Timer 1NA11, 12Set 2
Timer 3NA2, 3, 5Set 3
Timer 4496, 7, 8Set 4
Leonardo, Robot Control Board, Robot Motor Board, MicroTimer 149, 10Set 1
Timer 4136, 13NA
MKR 1000, MKR Wifi 1010, MKR ZeroTimer TCC0106, 7, 11, 18 (A3), 19 (A4)NA
Timer TCC162, 3NA
Timer TCC219 (A4)8NA
Timer TC3200, 1Set 1
Timer TC410NA
Nano 33 IoTTimer TCC0105, 6, 9, 10, 16, 17NA
Timer TCC164NA
Timer TCC21911NA
Timer TC32012NA
Timer TC419Set 1
DueTimer TC0_CH022, 13NA
Timer TC2_CH211NASet 4

Consider these example combinations for different Arduino boards:

  • For the Arduino Leonardo board, if your Simulink model uses the Input Capture block that is connected to pin number 4, then you cannot connect the PWM block to pin number 9 and 10, and you cannot use Servo blocks in the model.

  • For the Arduino Nano 33 IoT board, if your Simulink model uses the Input Capture block that is connected to pin number 10, then you cannot connect the PWM block to pin numbers 5, 6, 9, 10, 16, and 17.

Supported Default PWM Frequencies and Pins on Arduino Compatible Teensy Boards

Use this table to configure the PWM block in your Simulink model and map the default PWM frequencies with the hardware pins on your Arduino compatible Teensy boards.

Arduino Compatible BoardTimerPWM PinsPWM Default FrequenciesInput Capture Pins
Teensy 4.1FlexPWM1.01, 44, 454.482 kHzNA
FlexPWM1.10, 42, 43
FlexPWM1.224, 46, 47
FlexPWM1.37, 8, 25
FlexPWM2.04, 33
FlexPWM2.15
FlexPWM2.26, 9
FlexPWM2.336, 37
FlexPWM3.054
FlexPWM3.128, 29
FlexPWM3.351
FlexPWM4.022
FlexPWM4.123
FlexPWM4.22, 3
QuadTimer1.0103.611 kHz10
QuadTimer1.11212
QuadTimer1.21111
QuadTimer2.013NA
QuadTimer3.019NA
QuadTimer3.11818
QuadTimer3.214NA
QuadTimer3.315NA
QuadTimer4.1NA6
QuadTimer4.2NA9
Teensy 4.0FlexPWM1.01, 36, 374.482 kHzNA
FlexPWM1.10, 34, 35
FlexPWM1.224, 38, 39
FlexPWM1.37, 8, 25
FlexPWM2.04, 33
FlexPWM2.15
FlexPWM2.26, 9
FlexPWM3.128, 29
FlexPWM4.022
FlexPWM4.123
FlexPWM4.22, 3
QuadTimer1.0103.611 kHz10
QuadTimer1.11212
QuadTimer1.21111
QuadTimer2.013NA
QuadTimer3.019NA
QuadTimer3.11818
QuadTimer3.214NA
QuadTimer3.315NA
QuadTimer4.1NA6
QuadTimer4.2NA9

The following table provides the maximum frequency that the PWM block generates in your Simulink model for an 8-bit resolution input data.

Arduino Compatible BoardInput Data ResolutionPWM ValueGenerated PWM Output Frequency (Hz) for CPU Speeds: 600 MHz, 450 MHzGenerated PWM Output Frequency (Hz) for CPU Speeds: 528 MHz, 396 MHzGenerated PWM Output Frequency (Hz) for CPU Speeds: 24 MHz
Teensy 4.0 and 4.180–255585937.551562593750

See Also

|