# VOXL2 Mini / AR0144 J7 Group 1 / voxl-fsync-mod

Source: https://forum.modalai.com/topic/3478/voxl2-mini-ar0144-j7-group-1-voxl-fsync-mod
Category: VOXL 2 and VOXL 2 Mini (https://forum.modalai.com/category/26/voxl-2-and-voxl-2-mini)
Tags: voxl-2-mini
Posted: 2024-05-23 20:28:20 UTC by Kerry Snyder
Replies: 3 · Views: 1440

## Kerry Snyder · 2024-05-23 20:28:20 UTC

I have been able to successfully compile and run voxl-fsync-mod on the VOXL2 Mini to generate trigger pulses on GPO 41 (on connector J10) for an external USB camera. Next, I would like to trigger our AR0144 (MSU-M0149-1) module, which is connected to J7 Group 1 (sensor3) through MDK-M0076-1-00. If I'm parsing [this page](https://docs.modalai.com/voxl2-mini-connectors/#j7-pin-out) correctly, I will want to trigger on pin 114. I think I will also need 'com.qti.sensormodule.ar0144_fsin_3.bin' from Modal to enable sync input for the image sensor.

Is this understanding correct? And would I be able to get that 'bin' file to support this configuration?

Other minor related questions:

1. Is VOXL2 Mini 1.7.X still due to be released soon (so that we can have voxl-fsync-mod built in)?
2. If we want to trigger multiple cameras on different GPIO, is our best bet to modify voxl-fsync-mod to toggle multiple pins within fsync_hrtimer_tick_cb?

## Reply by modaltb (ModalAI staff) · 2024-06-07 21:20:28 UTC

Hi @Kerry-Snyder , nice work tracking all of this down!  Impressive.

Agree, GPIO114 is the pin that routes from M0104 (voxl2-mini) J7 pin pin 16 through M0076 interposer, which connects to M0149 AR0144 pin 26 (via M0076 stuffing resistor R3).  I can physically test this when back in the office Monday on latest system image 1.3.0 as well, always like to verify on something I haven't tried yet!  If this all works nicely I'll get a public doc in place too to help others.

The camera HW IDs are 0-based, so I think you should be able to use the shipping `/usr/share/modalai/chi-cdk/ar0144-fsin/com.qti.sensormodule.ar0144_fsin_2.bin`, e.g.:
J6-lower  = HW ID 0
J6-upper = HW ID 1
J7-lower  = HW ID 2

-- -- -- 

#1]

voxl2-mini has SDK 1.3.0 support, it shows up down in the list and I need to do some SQL stuff to change the order here which I've put off so look to the bottom:
![58700bbd-95b8-4c61-ba33-dca012ae7961-image.png](https://forum.modalai.com/assets/uploads/files/1717795013123-58700bbd-95b8-4c61-ba33-dca012ae7961-image.png) 

Then find:
VOXL2 Mini SDK 1.3.0	voxl2-mini_SDK_1.3.0.tar.gz	6/3/2024, 5:23:14 PM

(see this link https://developer.modalai.com/asset/10 )

#2]

That seems about right and what I would try first for sure, we haven't done this yet but it should be doable in that location.  Holler back if you have any questions!

## Reply by Kerry Snyder · 2024-06-07 22:38:43 UTC

Thanks! I was able to grab and flash SDK 1.3.0 yesterday and it's been working well.

com.qti.sensormodule.ar0144_fsin_2.bin does seem to work - I'm able to configure gpio_num to 114 and control the ar0144 rate with voxl_fsync_mod.

The max frame rate I saw indoors was 43.5hz with sampling_period_ns set to 23000000, and outdoors was 52.6hz with sampling_period_ns set to 19000000. I suspect this is somehow related to exposure time (or an exposure cap) although I see a solid 60hz indoors and outdoors when I manually configure the frame rate. For reference, this is all measured with gstreamer qtiqmmfsrc into OpenCV and then ROS2, which could definitely impact performance and exposure control.

I'll try out a multi-gpio kernel module modification! Thanks again!

## Reply by Kerry Snyder · 2024-06-10 22:01:54 UTC

I can confirm that multi-camera triggering works with a very minor patch:

```
diff --git a/recipes-kernel/voxl-fysnc-mod/files/voxl-fsync-mod.c b/recipes-kernel/voxl-fysnc-mod/files/voxl-fsync-mod.c
index 837dd21..730e374 100644
--- a/recipes-kernel/voxl-fysnc-mod/files/voxl-fsync-mod.c
+++ b/recipes-kernel/voxl-fysnc-mod/files/voxl-fsync-mod.c
@@ -24,7 +24,10 @@
  * /sys/module/voxl_fsync_mod/parameters/pulse_width_us
  *  - uint - the length of pulse to use in microseconds, default 10, 10us
  * 
- * /sys/module/voxl_fsync_mod/parameters/gpio_num
+ * /sys/module/voxl_fsync_mod/parameters/gpio1_num
+ *  - uint - the GPIO number to use
+ * 
+ * /sys/module/voxl_fsync_mod/parameters/gpio2_num
  *  - uint - the GPIO number to use
  */
 #define GPIO_OFFSET 1100
@@ -38,8 +41,10 @@ static uint pulse_width_us = 10; //
 module_param(pulse_width_us, uint, 0644);
 
 /* GPIO number */
-static uint gpio_num = 109;
-module_param(gpio_num, uint, 0644);
+static uint gpio1_num = 41;
+module_param(gpio1_num, uint, 0644);
+static uint gpio2_num = 114;
+module_param(gpio2_num, uint, 0644);
 
 /* enable/disable the GPIO output and timestamps */
 static int enabled = 0;
@@ -143,8 +148,10 @@ static enum hrtimer_restart fsync_hrtimer_tick_cb(struct hrtimer *timer)
 {
 	/* initialize on being enabled */
 	if (!initialized && enabled) {
-		gpio_direction_output((gpio_num + GPIO_OFFSET), 0);
-		gpio_export((gpio_num + GPIO_OFFSET), true);
+		gpio_direction_output((gpio1_num + GPIO_OFFSET), 0);
+		gpio_export((gpio1_num + GPIO_OFFSET), true);
+		gpio_direction_output((gpio2_num + GPIO_OFFSET), 0);
+		gpio_export((gpio2_num + GPIO_OFFSET), true);
 		initialized = true;
 		pr_info("voxl-fsync: initialized\n");
 	}
@@ -153,7 +160,8 @@ static enum hrtimer_restart fsync_hrtimer_tick_cb(struct hrtimer *timer)
 	hrtimer_forward_now(&fsync_hrtimer, ns_to_ktime(sampling_period_ns));
 	
 	if (enabled) {
-		gpio_set_value((gpio_num + GPIO_OFFSET), 1);
+		gpio_set_value((gpio1_num + GPIO_OFFSET), 1);
+		gpio_set_value((gpio2_num + GPIO_OFFSET), 1);
 
 		/* TIMESTAMP TIMESTAMP TIMESTAMP*/
 		mutex_lock(&fysnc_mutex);
@@ -163,7 +171,8 @@ static enum hrtimer_restart fsync_hrtimer_tick_cb(struct hrtimer *timer)
 		if(pulse_width_us > 0)
 			udelay(pulse_width_us);
 
-		gpio_set_value((gpio_num + GPIO_OFFSET), 0);
+		gpio_set_value((gpio1_num + GPIO_OFFSET), 0);
+		gpio_set_value((gpio2_num + GPIO_OFFSET), 0);
 
 		/* signal clients */
 		fsync_update_pending = 1;

```
