Hardware & cameraFreeRaspberry Pi OS

pinctrl & vcgencmd

Built-in diagnostic commands: read and set GPIO pins from the terminal, check temperature, clocks and power problems.

What you use it for

  • Test wiring without writing code
  • Check if your Pi is overheating
  • Detect an underpowered supply

Commands

Read a pin
pinctrl get 17
Set GPIO17 as output, high
pinctrl set 17 op dh
CPU temperature
vcgencmd measure_temp
Power/throttling flags (0x0 = all good)
vcgencmd get_throttled

Pro tips

  • If get_throttled is not 0x0, check your power supply and cooling first.
  • pinctrl replaced the older raspi-gpio tool.