How to assign pins to nodes

nRF Connect for VS Code

tags
nRF Connect for VS Code

This procedure is only available to nodes that have pins.

To assign a pin to a node, complete the following steps:

  1. Open the Peripherals View using the switch at the bottom right corner of the Editor.
    View switch
  2. Select the node you want to assign to a pin. You can do this from the Peripherals View or from the Nodes View. The Nodes View list is more comprehensive. In the example below, &spi20 has been selected under soc/&global_peripherals, which is not present in the Peripherals View.
    The Node Inspector panel is updated.
    Node Inspector panel (center) can be opened from Nodes or Peripherals
  3. In the Pins properties, make sure that the node you are assigning to a pin is enabled. If not, click the Enable Node button.
    Enable Node button
    The Pins properties are updated and the node tile is added to the Peripherals View.
    "Example: spi20 node enabled"
  4. In the Pins properties, assign the node property to a pin by selecting it from the drop-down menu.
    The selection is mirrored in the Peripherals and Pins Views. "Example: spi20 pins enabled".
  5. If the node has pins that are unavailable for assignment to nodes, but you want to assign them, click the Add Pin State button to add the pin control state.
    "Add Pin State in Pins".
    The custom pin control state is added and automatically enabled, and the pin can now be assigned to a node. In the following example, Enabled and Disabled pin states were added.
    "Example: SCK with two custom pin states".

  6. Check for any assignment issues in the Problems panel in the Visual Studio Code's Panel Views.

  7. Save your changes either in the editor or in the devicetree file.

The node is assigned to the chosen pin and the change is mirrored in the devicetree code file. You can hover over the pin in the Pins View to see the tooltip with the list of available assignments, including the respective node, function, and state.