From 43731b8da567f4f9a92c9386114c08c36e9dc3a6 Mon Sep 17 00:00:00 2001 From: lady ada Date: Fri, 19 Jun 2020 18:14:44 -0400 Subject: [PATCH 1/2] debuggy but working with RX/TX on 22/23, gpio 0 must be pulled down by arduino for flow control --- main/sketch.ino.cpp | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/main/sketch.ino.cpp b/main/sketch.ino.cpp index b7ac78a..cb04a1c 100644 --- a/main/sketch.ino.cpp +++ b/main/sketch.ino.cpp @@ -34,7 +34,7 @@ extern "C" { #define SPI_BUFFER_LEN SPI_MAX_DMA_LEN -int debug = 0; +int debug = 1; uint8_t* commandBuffer; uint8_t* responseBuffer; @@ -103,30 +103,49 @@ void setup() { } } -#define UNO_WIFI_REV2 +#define AIRLIFT 1 void setupBluetooth() { + if (debug) ets_printf("setup periph\n"); + + while (1) { + vTaskDelay(portMAX_DELAY); + } + periph_module_enable(PERIPH_UART1_MODULE); periph_module_enable(PERIPH_UHCI0_MODULE); + if (debug) ets_printf("setup pins\n"); + #ifdef UNO_WIFI_REV2 uart_set_pin(UART_NUM_1, 1, 3, 33, 0); // TX, RX, RTS, CTS +#elif defined(AIRLIFT) + // TX GPIO1 & RX GPIO3 on ESP32 'hardware' UART + // RTS on ESP_BUSY (GPIO33) + // CTS on GPIO0 (GPIO0) + uart_set_pin(UART_NUM_1, 22, 23, 33, 0); #else uart_set_pin(UART_NUM_1, 23, 12, 18, 5); -#endif uart_set_hw_flow_ctrl(UART_NUM_1, UART_HW_FLOWCTRL_CTS_RTS, 5); +#endif + + if (debug) ets_printf("setup controller\n"); esp_bt_controller_config_t btControllerConfig = BT_CONTROLLER_INIT_CONFIG_DEFAULT(); btControllerConfig.hci_uart_no = UART_NUM_1; #ifdef UNO_WIFI_REV2 btControllerConfig.hci_uart_baudrate = 115200; +#elif defined(AIRLIFT) + btControllerConfig.hci_uart_baudrate = 115200; #else btControllerConfig.hci_uart_baudrate = 912600; #endif esp_bt_controller_init(&btControllerConfig); - while (esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_IDLE); + while (esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_IDLE) { + if (debug) ets_printf("idle\n"); + } esp_bt_controller_enable(ESP_BT_MODE_BLE); esp_bt_sleep_enable(); @@ -134,6 +153,7 @@ void setupBluetooth() { while (1) { vTaskDelay(portMAX_DELAY); + if (debug) ets_printf("."); } } @@ -146,7 +166,7 @@ void setupWiFi() { if (debug) ets_printf("*** NOSHIELD\n"); while (1); // no shield } - + commandBuffer = (uint8_t*)heap_caps_malloc(SPI_BUFFER_LEN, MALLOC_CAP_DMA); responseBuffer = (uint8_t*)heap_caps_malloc(SPI_BUFFER_LEN, MALLOC_CAP_DMA); From 56d7b740ed2751b7efed1e7590098829626c1324 Mon Sep 17 00:00:00 2001 From: lady ada Date: Fri, 19 Jun 2020 18:36:22 -0400 Subject: [PATCH 2/2] bump version, change HCI uart to main uart. kill main thread when done setting up bt --- Makefile | 2 +- combine.py | 2 +- main/CommandHandler.cpp | 2 +- main/sketch.ino.cpp | 5 +++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index e6e33fb..04d7798 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ load-passthrough: cp passthrough.UF2 $(BOOT_VOLUME) load-nina: - esptool.py --port $(M4_PORT) --before no_reset --baud $(UPLOAD_BAUD) write_flash 0 NINA_W102-1.6.1.bin + esptool.py --port $(M4_PORT) --before no_reset --baud $(UPLOAD_BAUD) write_flash 0 NINA_W102-1.7.0.bin load-circuitpython: cp $(CIRCUITPYTHON_UF2) $(BOOT_VOLUME) diff --git a/combine.py b/combine.py index 023ff09..fd8faa8 100644 --- a/combine.py +++ b/combine.py @@ -31,7 +31,7 @@ for i in range(0, len(certsData)): # zero terminate the pem file outputData[0x10000 + len(certsData)] = 0 -outputFilename = "NINA_W102-1.6.1.bin" +outputFilename = "NINA_W102-1.7.0.bin" if (len(sys.argv) > 1): outputFilename = sys.argv[1] diff --git a/main/CommandHandler.cpp b/main/CommandHandler.cpp index 703995d..5000e55 100644 --- a/main/CommandHandler.cpp +++ b/main/CommandHandler.cpp @@ -28,7 +28,7 @@ #include "Arduino.h" -const char FIRMWARE_VERSION[6] = "1.6.1"; +const char FIRMWARE_VERSION[6] = "1.7.0"; // Optional, user-defined X.509 certificate char CERT_BUF[1300]; diff --git a/main/sketch.ino.cpp b/main/sketch.ino.cpp index cb04a1c..f7d1ee7 100644 --- a/main/sketch.ino.cpp +++ b/main/sketch.ino.cpp @@ -34,7 +34,7 @@ extern "C" { #define SPI_BUFFER_LEN SPI_MAX_DMA_LEN -int debug = 1; +int debug = 0; uint8_t* commandBuffer; uint8_t* responseBuffer; @@ -123,7 +123,8 @@ void setupBluetooth() { // TX GPIO1 & RX GPIO3 on ESP32 'hardware' UART // RTS on ESP_BUSY (GPIO33) // CTS on GPIO0 (GPIO0) - uart_set_pin(UART_NUM_1, 22, 23, 33, 0); + // uart_set_pin(UART_NUM_1, 22, 23, 33, 0); + uart_set_pin(UART_NUM_1, 1, 3, 33, 0); #else uart_set_pin(UART_NUM_1, 23, 12, 18, 5); uart_set_hw_flow_ctrl(UART_NUM_1, UART_HW_FLOWCTRL_CTS_RTS, 5);