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

    USB tethering with VOXL

    VOXL Flight
    3
    9
    549
    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.
    • S
      skl1g14
      last edited by

      Hi,

      I have been following this thread https://forum.modalai.com/topic/851/rndis-connection?_=1704780402514.

      I have a Jetson nano and a Voxl flight deck with the base Linux Yocto Jethro with 3.18 kernel System Image but my jetson nano does not have any Ethernet port and wireless adapter.
      I was planning to reverse USB tether so that the network from voxl can extend to the jetson nano.

      By default, the jetson nano have a usb0 virtual Ethernet interface and I verify it by connecting my PC (host) and jetson nano (device).
      https://jetbot.org/master/software_setup/wifi_setup.html.

      However, there is no interface when i try to connect my voxl (host) to jetson nano (device).
      From the guide, https://docs.modalai.com/voxl-as-usb-host , i suspect it is my OTG cable being incompatible.

      With that, i am considering setting up rndis for the voxl flight such that i can do jetson nano (host) and voxl (device) instead.
      Is there a guide on how to do so? Or will it be less pain to just get different cables and retry.

      ModeratorM 1 Reply Last reply Reply Quote 0
      • ModeratorM
        Moderator ModalAI Team @skl1g14
        last edited by

        @skl1g14 it might be easier to just use a UART between the two?

        S 1 Reply Last reply Reply Quote 0
        • S
          skl1g14 @Moderator
          last edited by

          Dear @Moderator,

          That is true but we are expecting a data rate much higher than what UART is able to provide.

          Alex KushleyevA 1 Reply Last reply Reply Quote 0
          • Alex KushleyevA
            Alex Kushleyev ModalAI Team @skl1g14
            last edited by

            @skl1g14 , can you please confirm that you are using VOXL1 or VOXL2?

            S 1 Reply Last reply Reply Quote 0
            • S
              skl1g14 @Alex Kushleyev
              last edited by

              @Alex-Kushleyev
              voxl1

              Alex KushleyevA 1 Reply Last reply Reply Quote 0
              • Alex KushleyevA
                Alex Kushleyev ModalAI Team @skl1g14
                last edited by

                @skl1g14 , thank you for confirming

                Yes if you would like to use VOXL1 as host via OTG connector, you need to have a special cable.

                A few other options:

                • since VOXL1 has on-board wifi, can you just plug in a wifi dongle into your Jetson Nano (VOXL1 can be a wifi AP or station)
                  • this seems like the option requiring least amount of adapters!
                • using USB expander board (https://docs.modalai.com/usb-to-ethernet-with-voxl/) you could add USB-to-ethernet adapter to VOXL and plug in another USB-ethernet adapter into Jetson Nano .. and connect it all together using an ethernet cable.. too many adapters though!

                I don't think we ever tried to do USB tethering with VOXL. That would also require enabling a usb gadget kernel module : https://linuxlink.timesys.com/docs/wiki/engineering/HOWTO_Use_USB_Gadget_Ethernet

                S 1 Reply Last reply Reply Quote 0
                • S
                  skl1g14 @Alex Kushleyev
                  last edited by

                  @Alex-Kushleyev

                  Hi Alex, thanks for the quick response.
                  For now we are going option A with a wifi adapter. That works well.

                  In the meantime I am moving on to other stuff.
                  I tried recompiling the kernel with https://gitlab.com/voxl-public/system-image-build/meta-voxl/-/tree/master?ref_type=heads enabling the usb_gadget flag but no luck so far.
                  Apparently yocto does not have a simple way to just "make menuconfig"

                  Will keep this post updated if i manage to get it.

                  S 1 Reply Last reply Reply Quote 0
                  • S
                    skl1g14 @skl1g14
                    last edited by

                    Here is the hack if anyone needs it.

                    The latest platform image have the RNDIS host flag set. https://gitlab.com/voxl-public/system-image-build/meta-voxl/-/blob/master/recipes-kernel/linux-quic/files/enable_RNDIS_HOST.cfg?ref_type=heads

                    1. First step is to get a compatible OTG cable. I got an off-brand one that works. Run dmesg -wH on your jetson carrier board. If there are the usb0/rndis0/l4tbr0 means the connection is solid.
                      8ccd6bd4-54ac-4b90-af91-7c199e23b565-image.png

                    2. In voxl, save the following script somewhere. /home/root/usb_tethering.sh is a good choice.

                    #!/bin/bash
                    
                    # Enable IP forwarding
                    echo 1 > /proc/sys/net/ipv4/ip_forward
                    
                    # Bring up usb0 interface
                    ifconfig usb0 up
                    
                    # Assign IP address to usb0
                    ifconfig usb0 192.168.55.2 netmask 255.255.255.0
                    
                    # Add route for USB network
                    route add -net 192.168.55.0 netmask 255.255.255.0 dev usb0
                    
                    # Set up iptables rules for NAT
                    iptables -A FORWARD -o wlan0 -i usb0 -s 192.168.55.0/24 -m conntrack --ctstate NEW -j ACCEPT
                    iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
                    iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
                    
                    1. Make it persistent by creating a systemd service. Save it at /etc/systemd/system/tethering.service
                    [Unit]
                    Description=USB Tethering Service
                    After=network.target
                    
                    [Service]
                    Type=simple
                    ExecStart=/home/root/usb_tethering.sh
                    
                    [Install]
                    WantedBy=default.target
                    
                    1. Run the following
                    sudo systemctl daemon-reload
                    sudo systemctl enable tethering.service
                    
                    1. Check with ifconfig on voxl (should have a static addr 192.168.55.2 for usb0 interface)
                      7f3df687-cb2b-4e84-b657-15965453d5d0-image.png

                    2. Check with ifconfig on jetson carrier board (the l4tbr0 default addr should be 192.168.55.1)
                      e36c7c92-a5ac-4813-a6ba-6873d993a456-image.png

                    3. Try pinging each other (optional)

                    4. In voxl, set to station mode and connect to a access point. For jetson carrier board, check if it is possible to connect to a public web.

                    ping google.com
                    

                    8d2deb76-5669-4746-878a-84c54e39394e-image.png

                    • In jetson, the dns nameserver for the l4tbr0 interface may need to change to 8.8.8.8.
                      Check with
                    systemd-resolve --status
                    
                    • Alternatively, change globally by modifying the nameserver address to 8.8.8.8 at /etc/resolv.conf

                    Bandwidth ~ 265 Mbps which should be expected from a usb2.0 controller (max 480 Mbps) and the overhead from the interfaces.
                    5090762d-76b9-47f3-9d81-a24e2e3e7af6-image.png
                    20a2f942-8713-4007-b7cd-709ece27b3bd-image.png

                    Alex KushleyevA 1 Reply Last reply Reply Quote 0
                    • Alex KushleyevA
                      Alex Kushleyev ModalAI Team @skl1g14
                      last edited by

                      @skl1g14 , very nice!! Thank you for documenting your configuration and results!!

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