Main Content

Usage of Alternate Pin Names

This section explains about accessing multiple hardware peripherals connected to the same pin using alternate pin names.

To view the pin mapping of blocks, click View pin map in the Block Parameters dialog box. This opens the pin mapping table.

Apart from the pins names mentioned in the pin mapping table (which can be accessed from the block mask), there are other alternate pin names (Px_y_ALTz) that can be used to access other hardware peripherals connected to the same pin.

You can use the alternate pin the same way as any other normal pin names in the block mask. The alternate pin names are not mentioned in the pin mapping table. To know which hardware peripherals the alternate pins are mapped to, refer PeripheralPins.c file from their respective hardware folder.

Note

  • The Mbed OS 5.14.1 version is verified in this example.

  • The alternate pin names are only applicable for Simulink® Coder™ Support Package for STMicroelectronics® Nucleo Boards and Discovery boards.

Example 1. Alternate pin for PWM Output block in STM32 Nucleo H743ZI2

In STM32 Nucleo H743ZI2 board, the pin PC_9 is connected to Timer 3 of channel 4 (TIM3_channel4) and Timer 8 of channel 4 (TIM8_channel4).

  • To generate PWM output on pin PC_9 using TIM3_channel4, specify PC_9 in the Pin parameter of the PWM Output block.

  • To generate PWM output on pin PC_9 using TIM8_channel4, specify the alternate pin name PC_9_ALT0 in Pin parameter of the PWM Output block. You can get this alternate pin name by referring to PeripheralPins.c file.

You can notice that in the PeripheralPins.c file, the pin PC_9 is mapped to TIM3_channel4 and PC_9_ALT0 is mapped to TIM8_channel4.

Example 2. Alternate pin for PWM Output block in STM32F746G-Discovery board

In STM32F746G-Discovery board, the pin PB_8 is connected to Timer 4 of channel 3 (TIM4_channel3 and Timer 10 of channel 1 (TIM10_channel1).

  • To generate PWM output on pin PB_8 using TIM4_channel3, specify PB_8 in the Pin parameter of the PWM Output block.

  • To generate PWM output on pin PB_8 using TIM10_channel1, specify the alternate pin name PB_8_ALT0 in Pin parameter of the PWM Output block. You can get this alternate pin name by referring to PeripheralPins.c file.

You can notice that in the PeripheralPins.c file, the pin PB_8 is mapped to TIM4_channel3 and PB_8_ALT0 is mapped to TIM10_channel1.

Alternate pin

External Websites