Dear guys,
I activated the SPI on IMX6ULL.
In particular I have 4 different SPI chip select associated to following SODIMM:
MX6UL_PAD_UART2_CTS_B__GPIO1_IO22 0x70a0 /* SODIMM 32 */
MX6UL_PAD_UART2_RTS_B__GPIO1_IO23 0x70a0 /* SODIMM 34 */
MX6UL_PAD_UART2_RX_DATA__GPIO1_IO21 0x70a0 /* SODIMM 38 */
MX6UL_PAD_UART2_TX_DATA__GPIO1_IO20 0x70a0 /* SODIMM 36 */
For more details see the ticket (How to use SPI on Colibri IMX6ULL).
I need to change the value of SPI output gpio on sometime while the my application is running.
If I use the Toradex GPIO tool the value is changed right, For example I changed the value of gpio-20.
I saw the change value using the command: cat /sys/kernel/debug/gpio and with the oscilloscope.
Before:
gpiochip0: GPIOs 0-31, parent: platform/209c000.gpio, 209c000.gpio: gpio-2 ( |VCC_USB[1-4] ) out lo
gpio-11 ( |enable ) out hi
gpio-20 ( |spi_imx ) out hi
gpio-21 ( |spi_imx ) out hi
gpio-22 ( |spi_imx ) out hi
gpio-23 ( |spi_imx ) out hi
After:
gpiochip0: GPIOs 0-31, parent: platform/209c000.gpio, 209c000.gpio: gpio-2 ( |VCC_USB[1-4] ) out lo
gpio-11 ( |enable ) out hi
gpio-20 ( |spi_imx ) out hi
gpio-21 ( |spi_imx ) out lo
gpio-22 ( |spi_imx ) out hi
gpio-23 ( |spi_imx ) out hi
I tried to use the following lines:
// export GPIO
fd = open("/sys/class/gpio/export", O_WRONLY);
write(fd, "21", 2);
close(fd);
// configure as output
fd = open("/sys/class/gpio/gpio21/direction", O_WRONLY);
write(fd, "out", 3);
close(fd);
fd = open("/sys/class/gpio/gpio21/value", O_WRONLY | O_SYNC);
write(fd, "0", 1);
I used these commands on the VF61 and they run right. Then I tried to export gpio21 on IMX6ULL it’s give me a error message and the folder gpio21 is not created. I tried the following command line: echo 21 > /sys/class/gpio/export
and obtained this error: write error: Device or resource busy
How could I change the status of SPI GPIO output?
Thank you,
Best regards
Matteo