ModalAI Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    VOXL2 unused/repurposed GPIO

    Ask your questions right here!
    5
    12
    751
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      hmlow
      last edited by

      Hi devs

      What could i do if i wish to use a GPIO to turn an external MOSFET switch on/off?

      I've looked thru the docs but i cant seem to find any unused GPIOs on the VOXL2 (including the 5G modem addon).

      The closest i got is pin9 of J19:
      https://docs.modalai.com/voxl2-offboard-sensors/

      Where the note for pin 9 says "*RC power , controllable via GPIO 159"
      I am not using J19 at the moment so how should i go about "controlling" GPIO159?

      Thanks

      VinnyV 1 Reply Last reply Reply Quote 0
      • VinnyV
        Vinny ModalAI Team @hmlow
        last edited by

        Hi @hmlow
        I would advise against trying to use VREG_3P3V_RC as a FET control signal. It is a power rail, and it will have a slow rise time relative to a GPIO.
        Your best bet is to look into the linux user guide sections to learn how to change SPI or I2C ports into GPIOs.
        https://docs.modalai.com/voxl2-linux-user-guide/
        If that page is not clear, please ask again and we'll need someone from SW to respond.

        On Voxl2, J10 is an SPI port.
        On M0090 5G modem, both J8 and J9 are SPI and UART+I2C respectively. These are the ideal candidates to turn into GPIOs.
        Note, the I2C ports have pull-ups, so if you need fast rise times, try to use the SPI or UART designated ports.

        Second Note: I am also in process of a new design which will expose all GPIOs on J3 + J5 for testing/development uses. It may still be a couple months before we list that for sale, but if it works for you longer term, try to hold off. I will "open" those schematics too to help all users see how to manipulate that design for their use.

        H Jyotish KumarJ 2 Replies Last reply Reply Quote 0
        • H
          hmlow @Vinny
          last edited by

          @Vinny actually, I am trying to use Pin 9 to drive a MOSFET switch as a simple on/off.. I won't need it to "switch" quickly.

          Now that you mention that pin 9 is actually a power rail, I would like to explore if it is possible to use this pin directly to drive my load of around 200mA.

          Would that bust the 1A (is this refering to the entire 3V3 load on the board?) limit specified in the docs?

          VinnyV 1 Reply Last reply Reply Quote 0
          • VinnyV
            Vinny ModalAI Team @hmlow
            last edited by

            @hmlow yes 200mA is fine. That amount won't barely stress anything. Keep in mind, that power rail is for RC, so if there are any bind or reset functions executed related to RC, that rail might toggle so be sure you investigate all options before you commit to using that long term.

            If you wanted to explore other GPIO controls as your original plan, our software engineer pointed me to this page about rebuilding the kernel for any permanent changes you need....
            https://docs.modalai.com/voxl2-kernel-build-guide/
            Hope that helps.

            1 Reply Last reply Reply Quote 0
            • Filip SlezakF
              Filip Slezak
              last edited by

              Hey, trying to do something very similar myself.

              Can't seem to toggle pin 46 on the VOXL2 J10. Following docs.modalai.com/voxl-gpio-io I run into the following:

              voxl2:~$ echo 46 > /sys/class/gpio/export
              -bash: echo write error: Invalid argument
              

              Eventually, I'd like this to match the state of a radio remote control switch to kill another board's power supply. Maybe through ROS
              but preferably not. Can you guide me through it please?

              1 Reply Last reply Reply Quote 0
              • tomT
                tom admin
                last edited by

                @Filip-Slezak That doc is for VOXL1, see here for info on VOXL2: https://docs.modalai.com/voxl2-linux-user-guide/#gpios

                1 Reply Last reply Reply Quote 0
                • Filip SlezakF
                  Filip Slezak
                  last edited by

                  @tom said in VOXL2 unused/repurposed GPIO:

                  https://docs.modalai.com/voxl2-linux-user-guide/#gpios

                  Indeed, thanks for the fast reply. I also just ran into the bind.c here https://forum.modalai.com/topic/1466/voxl2-gpio-and-serial-interfaces/3 and turns out I didn't account for the chip offset. How do I figure out which one to use? In this case it was 1100. This should now be a permanent setting right?

                  To modify those from code I could copy the _gpio_control function above and use it in a ros package, right? I am looking for a clean way to do this. Please tell me if there's a better way to directly toggle based on radio signal.

                  Also, I can't find any python code examples, are there any?

                  1 Reply Last reply Reply Quote 0
                  • Filip SlezakF
                    Filip Slezak
                    last edited by

                    def gpio_init(pin):
                        with open("/sys/class/gpio/export", "w") as config:
                            config.write(str(pin).encode())
                        return
                    
                    def gpio_exit(pin):
                        with open("/sys/class/gpio/unexport", "w") as config:
                            config.write(str(pin).encode())
                        return
                    
                    def gpio_set_mode(pin, direction):
                        with open("/sys/class/gpio/gpio{}/direction".format(pin), "w") as mode:
                            mode.write(str(direction).encode())
                        return
                    
                    def gpio_set_value(pin, value):     
                        with open("/sys/class/gpio/gpio{}/value".format(pin), "w") as gpio:
                            gpio.write(str(value).encode())
                        return
                         
                    
                    1 Reply Last reply Reply Quote 0
                    • Jyotish KumarJ
                      Jyotish Kumar @Vinny
                      last edited by

                      Hi @Vinny
                      An expansion board to access the GPIO pins in J3 and J5 connectors would be extreamly helpful.
                      Are there any updates on the designing front? Really looking forwards to this option.

                      Yours sincerely,
                      Jyothish.

                      VinnyV 2 Replies Last reply Reply Quote 0
                      • VinnyV
                        Vinny ModalAI Team @Jyotish Kumar
                        last edited by

                        Hi @Jyotish-Kumar
                        Yes! We just sent the board for fabrication yesterday!
                        I'm hoping to get a page up soon to explain it and post the schematics and usage.
                        Please give us a month or so enabling us to validate it before making it available.
                        Thanks

                        1 Reply Last reply Reply Quote 1
                        • VinnyV
                          Vinny ModalAI Team @Jyotish Kumar
                          last edited by

                          Hi @Jyotish-Kumar
                          Our design is being assembled and we expect to have it in our hands next week for initial bring-up. Keep an eye out for website purchase links.
                          Hope this helps you out!!!
                          https://docs.modalai.com/voxl2-dev-test-board/

                          Jyotish KumarJ 1 Reply Last reply Reply Quote 1
                          • Jyotish KumarJ
                            Jyotish Kumar @Vinny
                            last edited by

                            @Vinny Great!
                            So happy to hear about that. Looking forwards to its availability on store soon.

                            Warm regards,
                            Jyothish.

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post
                            Powered by NodeBB | Contributors