Hi,
I want to toggle a GPIO Pin in I.Mx8mmini to control read write operation. How to write a simple application code to do this
Regards
Santhosh Kumar S
Hello Santhosh Kumar S,
You can try the way as following:
1. Make sure the pad mux is GPIO ALT in dts.
2. Linux Userspace Naming Conversion
Linux gpio number = (gpio_bank - 1) * 32 + gpio_bit
For example, for gpiom_n, num=32 * (m-1) + n.
3. Input command to your Linux console
/* export gpio */
echo num > /sys/class/gpio/export
/* set the direction of gpio as output */
echo out > /sys/class/gpio/gpio[num]/direction
/* output low level */
echo 0 > /sys/class/gpio/gpio[num]/value
/* output high level */
echo 1 > /sys/class/gpio/gpio[num]/value
Best Regards,
Peter