GPIO relay on/off how set and check in torizon imx7 using python?

I am using mx7 torizon os i want check using some specific SODIMM chip my relay light should turn on off when i set.so,
I run this command :
docker run --rm -it -v /dev:/dev --device-cgroup-rule=‘c 254:* rmw’ torizonextras/arm32v7-gpiod.
whithin this container i used gpiochip1 line26 :SODIMM_133 pin number but my relay light dosent turn on when i run
gpioset gpiochip1 26=1
gpioset gpiochip1 26=0
can you help me to set or check relay input output on torizon?

Hi, I’m the Toradex AI Assistant.

I might make mistakes. Our support team will step in if needed. If I answered your question, please tick the “Solution” checkbox. For follow-up questions to me, please use @ToradexAI in your post.

Did you like my answer? :+1: :-1:


Hello! I understand you’re trying to control a relay via the SODIMM_133 pin on your Colibri iMX7 running Torizon OS, but the relay is not responding to your gpioset commands. Let’s go through step-by-step troubleshooting:


1. Verify SODIMM_133 Pin Mapping

First, confirm that SODIMM_133 corresponds to gpiochip1 line 26 by running:

gpiofind SODIMM_133

This command tells you which gpiochip and line number the system currently uses for SODIMM_133.


2. Check GPIO Pin Status

Get detailed info about all GPIOs and see the current state and direction:

gpioinfo

Look for SODIMM_133 in the output. Make sure the pin is “unused” or not allocated by another driver or kernel module.


3. Try Using the SODIMM Name Directly (Recommended Way)

Instead of the chip/line numbers, try using the SODIMM name directly:

gpioset SODIMM_133=1
gpioset SODIMM_133=0

This method is less error-prone and avoids pin mapping confusion.
(How to use GPIO on TorizonCore – Use Case Example)


4. Physical and Hardware Checks

  • Voltage & Current: Ensure your relay is compatible with 3.3V logic and check that the GPIO pin can handle the required relay current (it may need a transistor/driver circuit if not).
  • Multimeter Test: Measure the voltage on SODIMM_133 when you run the above gpioset commands; you should see the pin go high/low correspondingly.
  • Connections: Double-check the wiring between the SODIMM_133 pin and your relay circuit.

5. Pin Multiplexing and Device Tree

Some pins are multiplexed (can function as GPIO or another peripheral). SODIMM_133 must be configured as a GPIO in your device tree. If not, the pin may not respond. For more info on pin configuration and multiplexing, see:
(How to use GPIO on TorizonCore – Use Case Example)


6. Container Access

Your Docker run command looks correct for exposing GPIOs:

docker run --rm -it -v /dev:/dev --device-cgroup-rule='c 254:* rmw' torizonextras/arm32v7-gpiod

Make sure you’re using straight single quotes ' not curly quotes in the --device-cgroup-rule argument.


If, after these checks, your relay still doesn’t turn on/off:

  • Confirm pin mapping with gpiofind
  • Test the pin outside of the container (on the host)
  • Try another SODIMM pin to rule out a hardware or mapping issue

Feel free to share your command outputs if you’d like more help!

Best regards,
Toradex AI Assistant.

I did all steps but not able to blink led when my gpio is on is there any need to set pins in overlay file help me to solve this issue @ToradexAI

I am not getting solution please help me to solve this issue give steps to set gpio and how i set using toradex imx7 on torizon .

Hi @intersense.design!

I saw you opened another topic about the same issue, and it was resolved in the other thread. Although I’m glad you could solve it, I have to ask you not to open two topics about the same issue. It makes our work more difficult and generates unnecessary workload.

That being said, can I consider this topic solved since you found a solution in the other one?

Best regards.

yes ,thank you I’ll take care of it next time.

1 Like