I have a brand new Compute Module 4 with Raspberry Pi OS installed. The system is up-to-date, but I cannot read GPIOs or change their state.
$ gpio -v gpio version: 2.52 Copyright (c) 2012-2018 Gordon Henderson This is free software with ABSOLUTELY NO WARRANTY. For details type: gpio -warranty Raspberry Pi Details: Type: (null), Revision: 00, Memory: 4096MB, Maker: Sony * Device tree is enabled. *--> Raspberry Pi Compute Module 4 Rev 1.0 * This Raspberry Pi supports user-level GPIO access.
If I try to read all gpios I get this error:
$ gpio readall Oops - unable to determine board type... model: 20
If I try to change the state of a GPIO it doesn't work
$ gpio mode 13 out $ gpio write 13 1
However it does work with the following:
echo "13" > /sys/class/gpio/export echo "out" > /sys/class/gpio/gpio13/direction echo "1" > /sys/class/gpio/gpio13/value
What would be the correct way of using GPIOs on the CM4?