it is possible? via overlays=* parameter? how?
Set gpio pin high when Zero turns on and low when turned off
Hi. I know that some pins are high by default. So you need just set it to low on system startup.
echo 490 > /sys/class/gpio/export
#turnoff the pin
echo 0 /sys/class/gpio/gpio490/value
The systemd should be used for that. Just write a simple service with trigger on system startup
Mr. T REX XP, could you go in details and explain how to write that service? I suppose it will be either a bash scrip or a C file, right? It calso be done for I2C, PWM and SPI, right?
I have connected my Raxda Zero to my custom circuit (which was based on RPI). The point is that I have connected a digital Output (Pin 16) to the PowerKey pin of a LTE modem. If this pin goes from low volt level to high volt level, the modem will switch on or reset. When Radxa Zero starts, it puts pin 16 to high volt level by default.
How can I tell Radxa that keep this pin low at boot?
I have try to use a script to put this pin low at boot, however this script takes a long time to run and the pulse to the modem it is practically instantaneous when Radxa gets 5V. I have tried crontab, /etc/init.d and systemd.service.
Someone knows how to define the GPIO state at boot?
This is defined in the SoC. You can switch to a different pin or use additional circuit to invert the signal level.
how to control LOW\HIGH level when boot?
I want to set pin 37 (GPIOAO_9) when booting into HIGH level.
If by “when boot” you mean when power is applied then that’s not really controllable. U-Boot is suppose to leave pin level as default hardware value when it starts Linux kernel.
If you are ok to have it set up when system is booted, you can create a systemd service to set the level on boot. You can find many guides on this and you only need a very basic unit file.
If you still need the pin to be what you want when the power is on, then you should either switch to a different pin with your desired on-boot signal level, or have a simple external circuit to reverse the output level. Transistor can do this job.