Skip to content

Instantly share code, notes, and snippets.

@rayanamal
Last active May 23, 2026 11:30
Show Gist options
  • Select an option

  • Save rayanamal/d3ad1f96afc9c8bb7bc9dfa4a4eb0d7e to your computer and use it in GitHub Desktop.

Select an option

Save rayanamal/d3ad1f96afc9c8bb7bc9dfa4a4eb0d7e to your computer and use it in GitHub Desktop.
Patch to enable external antenna on the XIAO-ESP32-C6
diff --git a/examples/openthread/ot_rcp/main/esp_ot_rcp.c b/examples/openthread/ot_rcp/main/esp_ot_rcp.c
index 765fef58a2..bf97db1c77 100644
--- a/examples/openthread/ot_rcp/main/esp_ot_rcp.c
+++ b/examples/openthread/ot_rcp/main/esp_ot_rcp.c
@@ -31,10 +31,25 @@
#define TAG "ot_esp_rcp"
+#include "driver/gpio.h"
+#include "freertos/FreeRTOS.h"
+#include "freertos/task.h"
+
+static void xiao_select_external_antenna(void)
+{
+ gpio_set_direction(GPIO_NUM_3, GPIO_MODE_OUTPUT);
+ gpio_set_level(GPIO_NUM_3, 0);
+ vTaskDelay(pdMS_TO_TICKS(100));
+ gpio_set_direction(GPIO_NUM_14, GPIO_MODE_OUTPUT);
+ gpio_set_level(GPIO_NUM_14, 1);
+}
+
extern void otAppNcpInit(otInstance *instance);
void app_main(void)
{
+ xiao_select_external_antenna();
+
// Used eventfds:
// * ot task queue
// * radio driver
@@ -57,4 +72,4 @@ void app_main(void)
};
ESP_ERROR_CHECK(esp_openthread_start(&config));
-}
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment