How to PORT/PINS

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to PORT/PINS

How to PORT/PINS

 

2

Introduction


Before a microcontroller can interact with external hardware, its pins must be configured correctly. Whether you want to read a button state, drive an LED, communicate with a sensor, or use a peripheral, the first step is to configure the corresponding pins.

3

Pins Configuration


First, identify the pin you want to use. In this example, we will use the following pin:

  • RGBLED0_RED
  • PTA29
  • GPIO29
Note: When working in S32 Configuration Tools, the pin MSCR value (third line) is not required. However, it will be needed later if you also configure the same pins in EB tresos.

Configure the pins according to their intended use: input, output, or input/output. To begin, open the Pins Tool by clicking the Pins button in the upper-right corner.

configToolView.png

In the Pins Tool, the pins are organized into Functional Groups. In the default projects provided with the Model-Based Design Toolbox, these groups are arranged based on the peripheral to which the pins are routed.

functionalGroups.png

For this step, focus on the Pins tab in the upper-left area of the window. Search for the pin you want to configure; in this example, PTA29.

pinPinsView.png

If the desired functionality is already routed to a different pin, first disable that routing by clearing the corresponding selection before assigning it to PTA29. Next, update the identifier and label as needed, then enable the routing by selecting the checkbox on the left. This opens the routing selection dialog.

selecttypeofsignal.png

Select SIUL2:gpio,29, as it matches the intended functionality. A second dialog then prompts you to select the pin direction.

directionofpin.png

In this example, the LED is configured as Input/Output, matching the configuration used by the example project. Depending on the intended use of the pin, a different direction may be required — for example, a push button is typically configured as an input. Additional examples can be found in the default projects provided with the Model-Based Design Toolbox.

4

Configure Port Component


The Port component must reflect the same pin configuration defined in the Pins Tool. After returning to the Peripherals Tool, the Port component may be highlighted in red because the pin configuration was modified in the Pins Tool and has not yet been updated in the Port component.

PortComponent.png

In the default Model-Based Design Toolbox projects, PortPins are grouped into PortContainers according to their associated peripheral, such as Dio_Pins or Can_Pins. Locate the Dio_Pins PortContainer and update the PortPin entries so that they match the values configured in the Pins Tool.

rgbled.png

The pin will already contain the MSCR value inherited from the Pins configuration. Update the pin name as desired so it can be easily identified in the model, then repeat the process for each additional pin.

The PortPin Id uniquely identifies each PortPin entry. The identifier must remain unique across all PortContainers.

Note: If a duplicate PortPin Id value is used, the configuration will report an error.

Assign a unique PortPin Id value to each configured pin. For example, a configuration containing 40 pins can use identifiers within the range described by the tool configuration.

5

Conclusion


Once the pin configuration is complete and the Port component has been updated accordingly, you can continue with the configuration of the software components that will use those pins.

評価なし
バージョン履歴
最終更新日:
13 時間前
更新者: