Skip to content

Commit 99ffed0

Browse files
committed
ESP32 demo app: set ESP GPIO to put BW1092 bootloader in update mode
1 parent 0a30505 commit 99ffed0

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

host/embedded/esp32-app/main/app_main.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ task waits for this semaphore to be given before queueing a transmission.
5353
Pins in use. The SPI Master can use the GPIO mux, so feel free to change these if needed.
5454
*/
5555

56+
// This pin is used on BW1092. On BW1098EMB it should connect to SPI2.5
57+
// Assert low to put DepthAI bootloader in DFU update mode.
58+
#define GPIO_UPDATE_DEPTHAI_FW 4
59+
// Set to 1 only when updating DepthAI firmware, then reset to 0
60+
#define ENABLE_FW_UPDATE 0
61+
5662
// DepthAI uses SPI2.6 pin as an interrupt output, open-drain, active low.
5763
#define GPIO_HANDSHAKE 2 // ESP32 pin that connects to SPI2.6
5864

@@ -95,6 +101,12 @@ static void IRAM_ATTR gpio_handshake_isr_handler(void* arg)
95101
//Main application
96102
void app_main()
97103
{
104+
if (ENABLE_FW_UPDATE) {
105+
gpio_reset_pin (GPIO_UPDATE_DEPTHAI_FW);
106+
gpio_set_direction(GPIO_UPDATE_DEPTHAI_FW, GPIO_MODE_OUTPUT);
107+
gpio_set_level (GPIO_UPDATE_DEPTHAI_FW, 0);
108+
}
109+
98110
esp_err_t ret;
99111
spi_device_handle_t handle;
100112

0 commit comments

Comments
 (0)