# VOXL2 - Cube Orange External Flight Controller Integration

Source: https://forum.modalai.com/topic/3389/voxl2-cube-orange-external-flight-controller-integration
Category: VOXL 2 and VOXL 2 Mini (https://forum.modalai.com/category/26/voxl-2-and-voxl-2-mini)
Tags: voxl-2
Posted: 2024-05-02 21:23:25 UTC by Jetson Nano
Replies: 13 · Views: 4027

## Jetson Nano · 2024-05-02 21:23:25 UTC

Hello @Chad-Sweet @Eric-Katzfey @tom @Alex-Kushleyev ,

I'm using VOXL2 as a compute unit and need to connect a external flight controller for port availability and other feasibility needs. In my application, I'm using Pixhawk standard [Cube Orange](https://docs.cubepilot.org/user-guides/autopilot/the-cube-module-overview) as external FC. 

For hardware integration, I'm referring to the documentation as listed [here](https://docs.modalai.com/voxl2-external-flight-controller/) as a model reference.

1. I'm integrating the the USB3/UART Add-On Board (M0125) to VOXL 2 (M0054) which giving a 4 pin JST GH connector with a UART available at /dev/ttyHS1 from the applications processor.

2. I'm connecting the 4 pin JST type Output to the Cube Orange's Telemetry (TELEM1) port using 4 Ping JST GH connector to 6 pin GH Connector.

3. In VOXL2, under ```/etc/modalai/voxl-mavlink-server.conf``` , I set external_ap_flight_controller paramater to **true** instead of default.

4. In QGC, once I check by connecting the debug port of *Cube to host PC* through a USB data cable, under mavlink console upon checking using **mavlink status**, I receive the following outputs,

```
mavlink status

instance #0:
    mavlink chan: #0
    type:        GENERIC LINK OR RADIO
    flow control: OFF
    rates:
      tx: 487.3 B/s
      txerr: 0.0 B/s
      tx rate mult: 1.000
      tx rate max: 2880 B/s
      rx: 0.0 B/s
      rx loss: 0.0%
    FTP enabled: NO, TX enabled: YES
    mode: Minimal
    Forwarding: Off
    MAVLink version: 1
    transport protocol: serial (/dev/ttyS4 @57600)

instance #1:
    mavlink chan: #1
    type:        GENERIC LINK OR RADIO
    flow control: OFF
    rates:
      tx: 601.9 B/s
      txerr: 0.0 B/s
      tx rate mult: 0.306
      tx rate max: 1200 B/s
      rx: 0.0 B/s
      rx loss: 0.0%
    FTP enabled: YES, TX enabled: YES
    mode: Normal
    Forwarding: On
    MAVLink version: 1
    transport protocol: serial (/dev/ttyS0 @921600)

instance #2:
    mavlink chan: #2
    type:        GENERIC LINK OR RADIO
    flow control: OFF
    rates:
      tx: 817.9 B/s
      txerr: 0.0 B/s
      tx rate mult: 0.306
      tx rate max: 1200 B/s
      rx: 12875.7 B/s
      rx loss: 125.2%
    Received Messages:
      sysid:  1, compid:197, Total: 47361 (lost: 5999736)
      sysid:  1, compid:196, Total: 568 (lost: 24)
    FTP enabled: YES, TX enabled: YES
    mode: Normal
    Forwarding: On
    MAVLink version: 2
    transport protocol: serial (/dev/ttyS1 @921600)

instance #3:
    GCS heartbeat valid
    mavlink chan: #3
    type:        USB CDC
    flow control: ON
    rates:
      tx: 32408.2 B/s
      txerr: 0.0 B/s
      tx rate mult: 1.000
      tx rate max: 100000 B/s
      rx: 20.9 B/s
      rx loss: 0.0%
    Received Messages:
      sysid:255, compid:190, Total: 1196 (lost: 0)
    FTP enabled: YES, TX enabled: YES
    mode: Config
    Forwarding: On
    MAVLink version: 2
    transport protocol: serial (/dev/ttyACM0 @2000000)
    ping statistics:
      last: 34.42 ms
      mean: 17.87 ms
      max: 426.75 ms
      min: 0.28 ms
      dropped packets: 0
nsh>
```

Is this the recommended method of integrating an external FC with VOXL2? How do I verify further to know that my external FC is being used instead of VOXL's internal FC?

*Assuming, I'm having a custom Starling drone setup on my hardware build and integrating external FC, how do I do vehicle actuator setup in QGC once I'm done setting up external FC?*

## Reply by tom (ModalAI staff) · 2024-05-02 23:39:18 UTC

@Jetson-Nano You can disable px4 on voxl with `systemctl disable voxl-px4` to ensure its not running

## Reply by Jetson Nano · 2024-05-03 13:24:12 UTC (in reply to tom)

@tom yes, I have done that.

## Reply by Eric Katzfey (ModalAI staff) · 2024-05-03 14:25:08 UTC (in reply to Jetson Nano)

@Jetson-Nano If you have disabled the internal flight controller and remove the USB connection to the external flight controller and are still seeing the connection to QGC then I think you are setup. Are seeing any issues?

## Reply by Jetson Nano · 2024-05-04 10:16:58 UTC (in reply to Eric Katzfey)

@Eric-Katzfey, I'm having a Starling drone setup on my custom airframe build and having integrated external FC, how do I do vehicle actuator setup in QGC once I'm done setting up external FC?

## Reply by Eric Katzfey (ModalAI staff) · 2024-05-04 15:55:17 UTC (in reply to Jetson Nano)

@Jetson-Nano Once you are up and running on your external Orange Cube then VOXL 2 is just a conduit for mavlink packets. You should be able to interact with your Orange Cube normally. I do not know anything about Orange Cubes so can't answer how to do vehicle actuator setup in QGC with it.

## Reply by Jetson Nano · 2024-05-06 06:33:41 UTC (in reply to Eric Katzfey)

Hey @Eric-Katzfey , I saw [this](https://forum.modalai.com/topic/3336/voxl-esc-with-cube-running-px4) post and in this you have asked to add the driver to the build configuration, but how do I include the voxl_esc driver to a build of different board configuration?

One more question, can I use the J5 connector of [this](https://docs.modalai.com/usb2-type-a-breakout-add-on/#usb2-type-a-breakout-m0141) to connect to the telemetry port of the FC?

## Reply by Eric Katzfey (ModalAI staff) · 2024-05-06 14:39:10 UTC (in reply to Jetson Nano)

@Jetson-Nano To add the driver you need to modify the build configuration file (https://github.com/PX4/PX4-Autopilot/blob/main/boards/cubepilot/cubeorange/default.px4board). You can add the voxl-esc driver to that with `CONFIG_DRIVERS_ACTUATORS_VOXL_ESC=y`

## Reply by Eric Katzfey (ModalAI staff) · 2024-05-06 14:39:56 UTC (in reply to Jetson Nano)

@Jetson-Nano Yes, you should be able to use the UART pins on that J5 connector.

## Reply by Jetson Nano · 2024-05-06 14:53:31 UTC (in reply to Eric Katzfey)

Thank you @Eric-Katzfey , I'll test this out and get back to you on the result

## Reply by Jetson Nano · 2024-05-07 07:38:16 UTC (in reply to Jetson Nano)

Hey @Eric-Katzfey , I tested whatever you told,

1. I connected to the UART port on the J5 of M0141, and I tested, it is not working. When using a companion computer you can run
 ```
cat /dev/ttyHSx
``` 
to get data from the FC, you'll get random symbols. I tried it and it is not working, when I tested yesterday with [this](https://www.modalai.com/products/m0125?variant=47083939791152) I got the output as said previously, but still with J5 I tried the pymavlink part by changing the baud rate, but I am getting this output
 ```
voxl2:/home$ python3 mavlink_shell.py /dev/ttyTHS1
Connecting to MAVLINK...
```
And what will be the port for the J5 connector of M0141, it is not listed in the below table.

![f14a4425-60c1-4ecf-9f43-ea072727ba21-image.png](https://forum.modalai.com/assets/uploads/files/1715067387392-f14a4425-60c1-4ecf-9f43-ea072727ba21-image.png) 

2. The VOXL ESC Driver part, I added that to the board config and built, after that I am not able to see any VOXL_ESC parameters.

## Reply by Eric Katzfey (ModalAI staff) · 2024-05-07 14:36:21 UTC (in reply to Jetson Nano)

@Jetson-Nano For the UART issue it's best to take things step by step. I would first verify the Orange Cube telemetry port by attaching it to a laptop or desktop computer. Make sure you can attach to QGC that way. And note the baudrate being used when it is working. That will validate the Orange Cube. Then validate the port of the add on card that you want to use with VOXL 2. For example, with M0141, validate /dev/ttyHS1 by attaching to a computer with a serial to UART cable and sending / receiving test data with a simple Python script. Once you are sure that the parts are working individually then you can hook them together and start debugging higher level things like voxl-mavlink-server.

## Reply by Eric Katzfey (ModalAI staff) · 2024-05-07 14:42:29 UTC (in reply to Jetson Nano)

@Jetson-Nano For the VOXL ESC part, now that you have the driver in your build you need to start the driver. For testing you can just go to the Nuttx shell and run `voxl_esc start -d <uart-port>`. This will show you if it is starting correctly. Once it is working correctly you should see the `VOXL_ESC_XXX` parameters and then you need to add the device start into your Orange Cube start scripts.

## Reply by Jetson Nano · 2024-05-10 08:51:53 UTC (in reply to Eric Katzfey)

Thank you @Eric-Katzfey , it worked, I tested each port individually and made sure the individual ports are working, and then integrated the two and is working fine.

Here is my solution if anyone needs.

I used Telem 1 port of the cube and the UART pins on the J5 connector of [USB2 Type A Breakout (M0141)](https://www.modalai.com/products/m0141?variant=46829445513520) . The parameters I set for MAV 1 is here 

![214a9a31-6231-4a59-bb93-3048e5fc9c5b-image.png](https://forum.modalai.com/assets/uploads/files/1715330904479-214a9a31-6231-4a59-bb93-3048e5fc9c5b-image.png) 

![33012de2-cc53-484e-99de-dc534345f369-image.png](https://forum.modalai.com/assets/uploads/files/1715330935684-33012de2-cc53-484e-99de-dc534345f369-image.png) 

After disabling the voxl-px4 services, Connect to VOXL wifi and check QGC, you'll get the FC data in which the cube is used as the flight controller.

The VOXL ESC, I haven't tested it yet, I'll test and get back if any problems.
