├── .gitignore ├── .gitmodules ├── Makefile ├── main ├── SerialCommand.cpp ├── SerialCommand.h ├── commands.cpp ├── commands.h ├── component.mk ├── main.cpp ├── main.h ├── multiserial.cpp └── multiserial.h ├── programming ├── ota_flash.py └── requirements.txt ├── readme.md └── sdkconfig /.gitignore: -------------------------------------------------------------------------------- 1 | .pioenvs 2 | .piolibdeps 3 | fp-lib-table 4 | *.DS_Store 5 | hardware/*.pdf 6 | hardware/*.svg 7 | hardware/*.bak 8 | hardware/*-bak 9 | hardware/*-cache* 10 | hardware/*_saved* 11 | hardware/*_autosave* 12 | *.gbr 13 | *.gbj 14 | *.gbrjob 15 | *.zip 16 | *.drl 17 | _saved_* 18 | *.gcode 19 | .vscode 20 | .vscode/.browse.c_cpp.db* 21 | .vscode/c_cpp_properties.json 22 | .vscode/launch.json 23 | build/ 24 | sdkconfig.old 25 | programming/bin/* 26 | programming/include/* 27 | programming/lib/* 28 | programming/share/* 29 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "components/arduino"] 2 | path = components/arduino 3 | url = https://github.com/coddingtonbear/arduino-esp32 4 | branch = esp32-bluetooth-bridge-collected-patches 5 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | PROJECT_NAME := bridge 2 | include $(IDF_PATH)/make/project.mk 3 | -------------------------------------------------------------------------------- /main/SerialCommand.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * SerialCommand - A Wiring/Arduino library to tokenize and parse commands 3 | * received over a serial port. 4 | * 5 | * Copyright (C) 2012 Stefan Rado 6 | * Copyright (C) 2011 Steven Cogswell 7 | * http://husks.wordpress.com 8 | * 9 | * Version 20120522 10 | * 11 | * This library is free software: you can redistribute it and/or modify 12 | * it under the terms of the GNU Lesser General Public License as published by 13 | * the Free Software Foundation, either version 3 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This library is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with this library. If not, see . 23 | */ 24 | #include "SerialCommand.h" 25 | 26 | /** 27 | * Constructor makes sure some things are set. 28 | */ 29 | SerialCommand::SerialCommand() 30 | : commandList(NULL), 31 | commandCount(0), 32 | defaultHandler(NULL), 33 | term('\n'), // default terminator for commands, newline character 34 | last(NULL) 35 | { 36 | strcpy(delim, " "); // strtok_r needs a null-terminated string 37 | clearBuffer(); 38 | 39 | serial = &Serial; 40 | } 41 | 42 | SerialCommand::SerialCommand(Stream* serialPort) 43 | : commandList(NULL), 44 | commandCount(0), 45 | defaultHandler(NULL), 46 | term('\n'), // default terminator for commands, newline character 47 | last(NULL) 48 | { 49 | strcpy(delim, " "); // strtok_r needs a null-terminated string 50 | clearBuffer(); 51 | 52 | serial = serialPort; 53 | } 54 | 55 | void SerialCommand::help() { 56 | serial->println("Available commands:"); 57 | serial->println("==================="); 58 | for (int i = 0; i < commandCount; i++) { 59 | serial->println(commandList[i].command); 60 | } 61 | serial->println("==================="); 62 | } 63 | /** 64 | * Adds a "command" and a handler function to the list of available commands. 65 | * This is used for matching a found token in the buffer, and gives the pointer 66 | * to the handler function to deal with it. 67 | */ 68 | void SerialCommand::addCommand(const char *command, void (*function)()) { 69 | #ifdef SERIALCOMMAND_DEBUG 70 | serial->print("Adding command ("); 71 | serial->print(commandCount); 72 | serial->print("): "); 73 | serial->println(command); 74 | #endif 75 | 76 | commandList = (SerialCommandCallback *) realloc(commandList, (commandCount + 1) * sizeof(SerialCommandCallback)); 77 | strncpy(commandList[commandCount].command, command, SERIALCOMMAND_MAXCOMMANDLENGTH); 78 | commandList[commandCount].function = function; 79 | commandCount++; 80 | } 81 | 82 | void SerialCommand::disableEcho() { 83 | echoEnabled = false; 84 | } 85 | 86 | void SerialCommand::prompt() { 87 | if(echoEnabled) { 88 | serial->println(); 89 | serial->print(SERIALCOMMAND_PROMPT); 90 | } 91 | } 92 | 93 | /** 94 | * This sets up a handler to be called in the event that the receveived command string 95 | * isn't in the list of commands. 96 | */ 97 | void SerialCommand::setDefaultHandler(void (*function)(const char *)) { 98 | defaultHandler = function; 99 | } 100 | 101 | void SerialCommand::readChar(char inChar) { 102 | if (inChar == term) { // Check for the terminator (default '\r') meaning end of command 103 | if(echoEnabled) { 104 | serial->print(inChar); // Echo back to serial stream 105 | } 106 | #ifdef SERIALCOMMAND_DEBUG 107 | serial->print("Received: "); 108 | serial->println(buffer); 109 | #endif 110 | 111 | char *command = strtok_r(buffer, delim, &last); // Search for command at start of buffer 112 | if (command != NULL) { 113 | boolean matched = false; 114 | for (int i = 0; i < commandCount; i++) { 115 | #ifdef SERIALCOMMAND_DEBUG 116 | serial->print("Comparing ["); 117 | serial->print(command); 118 | serial->print("] to ["); 119 | serial->print(commandList[i].command); 120 | serial->println("]"); 121 | #endif 122 | 123 | if (strncmp(command, "help", 4) == 0) { 124 | help(); 125 | matched = true; 126 | break; 127 | } 128 | 129 | // Compare the found command against the list of known commands for a match 130 | if (strncmp(command, commandList[i].command, SERIALCOMMAND_MAXCOMMANDLENGTH) == 0) { 131 | #ifdef SERIALCOMMAND_DEBUG 132 | serial->print("Matched Command: "); 133 | serial->println(command); 134 | #endif 135 | 136 | // Execute the stored handler function for the command 137 | (*commandList[i].function)(); 138 | matched = true; 139 | break; 140 | } 141 | } 142 | if (!matched && (defaultHandler != NULL)) { 143 | (*defaultHandler)(command); 144 | } 145 | } 146 | clearBuffer(); 147 | prompt(); 148 | } else if(inChar == 0x8 && bufPos > 0) { 149 | if(echoEnabled) { 150 | serial->write(0x08); 151 | serial->print(' '); 152 | serial->write(0x08); 153 | } 154 | bufPos--; 155 | buffer[bufPos] = '\0'; 156 | } else if (isprint(inChar)) { // Only printable characters into the buffer 157 | if(echoEnabled) { 158 | serial->print(inChar); // Echo back to serial stream 159 | } 160 | if (bufPos < SERIALCOMMAND_BUFFER) { 161 | buffer[bufPos++] = inChar; // Put character into buffer 162 | buffer[bufPos] = '\0'; // Null terminate 163 | } else { 164 | #ifdef SERIALCOMMAND_DEBUG 165 | serial->println("Line buffer is full - increase SERIALCOMMAND_BUFFER"); 166 | #endif 167 | } 168 | } 169 | } 170 | 171 | /** 172 | * This checks the Serial stream for characters, and assembles them into a buffer. 173 | * When the terminator character (default '\n') is seen, it starts parsing the 174 | * buffer for a prefix command, and calls handlers setup by addCommand() member 175 | */ 176 | void SerialCommand::readSerial() { 177 | while (serial->available() > 0) { 178 | char inChar = serial->read(); // Read single available character, there may be more waiting 179 | readChar(inChar); 180 | 181 | } 182 | } 183 | 184 | /* 185 | * Clear the input buffer. 186 | */ 187 | void SerialCommand::clearBuffer() { 188 | buffer[0] = '\0'; 189 | bufPos = 0; 190 | } 191 | 192 | /** 193 | * Retrieve the next token ("word" or "argument") from the command buffer. 194 | * Returns NULL if no more tokens exist. 195 | */ 196 | char *SerialCommand::next() { 197 | return strtok_r(NULL, delim, &last); 198 | } 199 | -------------------------------------------------------------------------------- /main/SerialCommand.h: -------------------------------------------------------------------------------- 1 | /** 2 | * SerialCommand - A Wiring/Arduino library to tokenize and parse commands 3 | * received over a serial port. 4 | * 5 | * Copyright (C) 2012 Stefan Rado 6 | * Copyright (C) 2011 Steven Cogswell 7 | * http://husks.wordpress.com 8 | * 9 | * Version 20120522 10 | * 11 | * This library is free software: you can redistribute it and/or modify 12 | * it under the terms of the GNU Lesser General Public License as published by 13 | * the Free Software Foundation, either version 3 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This library is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU Lesser General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with this library. If not, see . 23 | */ 24 | #ifndef SerialCommand_h 25 | #define SerialCommand_h 26 | 27 | #if defined(WIRING) && WIRING >= 100 28 | #include 29 | #elif defined(ARDUINO) && ARDUINO >= 100 30 | #include 31 | #else 32 | #include 33 | #endif 34 | #include 35 | 36 | #define SERIALCOMMAND_PROMPT ">> " 37 | 38 | // Size of the input buffer in bytes (maximum length of one command plus arguments) 39 | #define SERIALCOMMAND_BUFFER 1024 40 | // Maximum length of a command excluding the terminating null 41 | #define SERIALCOMMAND_MAXCOMMANDLENGTH 25 42 | 43 | // Uncomment the next line to run the library in debug mode (verbose messages) 44 | //#define SERIALCOMMAND_DEBUG 45 | 46 | 47 | class SerialCommand { 48 | public: 49 | SerialCommand(); // Constructor 50 | SerialCommand(Stream*); // Constructor 51 | void addCommand(const char *command, void(*function)()); // Add a command to the processing dictionary. 52 | void setDefaultHandler(void (*function)(const char *)); // A handler to call when no valid command received. 53 | 54 | void help(); 55 | void prompt(); 56 | void readSerial(); // Main entry point. 57 | void readChar(char); 58 | void clearBuffer(); // Clears the input buffer. 59 | char *next(); // Returns pointer to next token found in command buffer (for getting arguments to commands). 60 | 61 | void disableEcho(); 62 | 63 | private: 64 | // Command/handler dictionary 65 | struct SerialCommandCallback { 66 | char command[SERIALCOMMAND_MAXCOMMANDLENGTH + 1]; 67 | void (*function)(); 68 | }; // Data structure to hold Command/Handler function key-value pairs 69 | SerialCommandCallback *commandList; // Actual definition for command/handler array 70 | byte commandCount; 71 | 72 | // Pointer to the default handler function 73 | void (*defaultHandler)(const char *); 74 | 75 | bool echoEnabled = true; 76 | 77 | char delim[2]; // null-terminated list of character to be used as delimeters for tokenizing (default " ") 78 | char term; // Character that signals end of command (default '\n') 79 | 80 | char buffer[SERIALCOMMAND_BUFFER + 1]; // Buffer of stored characters while waiting for terminator character 81 | int bufPos; // Current position in the buffer 82 | char *last; // State variable used by strtok_r during processing 83 | 84 | Stream* serial; 85 | }; 86 | 87 | void serialCommandHelp(); 88 | 89 | #endif //SerialCommand_h 90 | -------------------------------------------------------------------------------- /main/commands.cpp: -------------------------------------------------------------------------------- 1 | #include "SerialCommand.h" 2 | #include "commands.h" 3 | #include "libb64/cdecode.h" 4 | #include "esp_ota_ops.h" 5 | #include "commands.h" 6 | #include "main.h" 7 | 8 | SerialCommand commands(&CmdSerial); 9 | 10 | bool connectedHigh = false; 11 | bool monitorEnabled = false; 12 | bool escapeEnabled = false; 13 | 14 | void setupCommands() { 15 | commands.addCommand("flash_esp32", flashEsp32); 16 | commands.addCommand("flash_uc", flashUC); 17 | commands.addCommand("reset_uc", resetUC); 18 | commands.addCommand("connected", connected); 19 | commands.addCommand("monitor", monitorBridge); 20 | commands.addCommand("nrst", setRst); 21 | commands.addCommand("unescape", unescape); 22 | commands.setDefaultHandler(unrecognized); 23 | } 24 | 25 | void unescape() { 26 | CmdSerial.disableInterface(&SerialBT); 27 | escapeEnabled = false; 28 | } 29 | 30 | void enableEscape() { 31 | CmdSerial.enableInterface(&SerialBT); 32 | CmdSerial.println(""); 33 | escapeEnabled = true; 34 | } 35 | 36 | void commandPrompt() { 37 | commands.prompt(); 38 | } 39 | 40 | void commandLoop() { 41 | commands.readSerial(); 42 | } 43 | 44 | void commandByte(char inChar) { 45 | commands.readChar(inChar); 46 | } 47 | 48 | void unrecognized(const char *cmd) { 49 | CmdSerial.print(""); 52 | } 53 | 54 | bool monitorBridgeEnabled() { 55 | return monitorEnabled; 56 | } 57 | 58 | bool escapeIsEnabled() { 59 | return escapeEnabled; 60 | } 61 | 62 | void setRst() { 63 | char* state = commands.next(); 64 | 65 | if(state == NULL) { 66 | pinMode(UC_NRST, INPUT); 67 | } else { 68 | bool nrstState = atoi(state); 69 | 70 | pinMode(UC_NRST, OUTPUT); 71 | if(nrstState) { 72 | digitalWrite(UC_NRST, HIGH); 73 | } else { 74 | digitalWrite(UC_NRST, LOW); 75 | } 76 | } 77 | } 78 | 79 | void monitorBridge() { 80 | char* state = commands.next(); 81 | 82 | if(state == NULL) { 83 | Serial.println(monitorEnabled ? "1": "0"); 84 | return; 85 | } 86 | monitorEnabled = atoi(state); 87 | } 88 | 89 | void connected() { 90 | char* state = commands.next(); 91 | 92 | if(state == NULL) { 93 | Serial.println(connectedHigh ? "1": "0"); 94 | return; 95 | } 96 | 97 | int target = atoi(state); 98 | if(target) { 99 | connectedHigh = true; 100 | digitalWrite(PIN_CONNECTED, HIGH); 101 | } else { 102 | connectedHigh = false; 103 | digitalWrite(PIN_CONNECTED, LOW); 104 | } 105 | } 106 | 107 | void resetUC() { 108 | pinMode(UC_NRST, OUTPUT); 109 | digitalWrite(UC_NRST, LOW); 110 | delay(500); 111 | digitalWrite(UC_NRST, HIGH); 112 | pinMode(UC_NRST, INPUT); 113 | } 114 | 115 | void flashUC() { 116 | digitalWrite(PIN_CONNECTED, HIGH); 117 | delay(250); 118 | resetUC(); 119 | delay(500); 120 | digitalWrite(PIN_CONNECTED, LOW); 121 | } 122 | 123 | void flashEsp32() { 124 | CmdSerial.println(""); 125 | CmdSerial.flush(); 126 | esp_err_t err; 127 | esp_ota_handle_t update_handle = 0; 128 | 129 | const esp_partition_t *configured = esp_ota_get_boot_partition(); 130 | const esp_partition_t *running = esp_ota_get_running_partition(); 131 | const esp_partition_t *update_partition = NULL; 132 | 133 | unsigned long last_data = millis(); 134 | 135 | CmdSerial.disableInterface(&UCSerial); 136 | if(configured != running) { 137 | CmdSerial.println("Warning: OTA boot partition does not match running partition."); 138 | } 139 | 140 | char otaReadData[OTA_BUFFER_SIZE + 1] = {0}; 141 | char otaWriteData[OTA_BUFFER_SIZE + 1] = {0}; 142 | uint16_t bufferLength = 0; 143 | uint16_t bytesDecoded = 0; 144 | 145 | update_partition = esp_ota_get_next_update_partition(NULL); 146 | err = esp_ota_begin(update_partition, OTA_SIZE_UNKNOWN, &update_handle); 147 | if (err != ESP_OK) { 148 | CmdSerial.print("Error beginning OTA update: "); 149 | CmdSerial.println(esp_err_to_name(err)); 150 | goto cleanUp; 151 | } 152 | CmdSerial.println(""); 153 | SerialBT.flush(); 154 | // pad last_data slightly to allow for a delayed start 155 | last_data = millis() + 5000; 156 | 157 | while(true) { 158 | while(!SerialBT.available()) { 159 | if(millis() > (last_data + 1000)) { 160 | CmdSerial.println(""); 161 | goto updateReady; 162 | } 163 | } 164 | 165 | uint bytesRead = SerialBT.readBytesUntil('\n', otaReadData, OTA_BUFFER_SIZE); 166 | last_data = millis(); 167 | 168 | if(bytesRead == 0) { 169 | continue; 170 | } 171 | 172 | base64_decodestate decodeState; 173 | base64_init_decodestate(&decodeState); 174 | bufferLength = base64_decode_block(otaReadData, bytesRead, otaWriteData, &decodeState); 175 | bytesDecoded += bufferLength; 176 | 177 | err = esp_ota_write(update_handle, otaWriteData, bufferLength); 178 | if(err != ESP_OK) { 179 | CmdSerial.print("Could not write data: "); 180 | CmdSerial.println(esp_err_to_name(err)); 181 | goto cleanUp; 182 | } 183 | } 184 | 185 | updateReady: 186 | CmdSerial.print(bytesDecoded); 187 | CmdSerial.println(" bytes written"); 188 | err = esp_ota_end(update_handle); 189 | if(err != ESP_OK) { 190 | CmdSerial.print("Could not complete update: "); 191 | CmdSerial.println(esp_err_to_name(err)); 192 | goto cleanUp; 193 | } 194 | 195 | err = esp_ota_set_boot_partition(update_partition); 196 | if(err != ESP_OK) { 197 | CmdSerial.print("Could not set boot partition: "); 198 | CmdSerial.println(esp_err_to_name(err)); 199 | goto cleanUp; 200 | } 201 | 202 | CmdSerial.println(""); 203 | CmdSerial.flush(); 204 | delay(5000); 205 | esp_restart(); 206 | 207 | cleanUp: 208 | CmdSerial.println(""); 209 | CmdSerial.flush(); 210 | delay(5000); 211 | esp_restart(); 212 | } 213 | -------------------------------------------------------------------------------- /main/commands.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define OTA_BUFFER_SIZE 1024 4 | 5 | void setupCommands(); 6 | void commandPrompt(); 7 | void commandLoop(); 8 | void commandByte(char); 9 | 10 | bool monitorBridgeEnabled(); 11 | bool escapeIsEnabled(); 12 | 13 | void flashEsp32(); 14 | void resetUC(); 15 | void flashUC(); 16 | void monitorBridge(); 17 | void connected(); 18 | void setRst(); 19 | void enableEscape(); 20 | void unescape(); 21 | void unrecognized(const char *cmd); 22 | -------------------------------------------------------------------------------- /main/component.mk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/coddingtonbear/esp32-bluetooth-bridge/7734cb905696882ddcbf7bbfd217ff82ddf71c6c/main/component.mk -------------------------------------------------------------------------------- /main/main.cpp: -------------------------------------------------------------------------------- 1 | #include "Arduino.h" 2 | #include "BluetoothSerial.h" 3 | 4 | #include "esp_bt.h" 5 | 6 | #include "multiserial.h" 7 | #include "main.h" 8 | #include "commands.h" 9 | 10 | #if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED) 11 | #error Bluetooth is not enabled! Please run `make menuconfig` to and enable it 12 | #endif 13 | 14 | char BT_CTRL_ESCAPE_SEQUENCE[] = {'\4', '\4', '\4', '!'}; 15 | uint8_t BT_CTRL_ESCAPE_SEQUENCE_LENGTH = sizeof(BT_CTRL_ESCAPE_SEQUENCE)/sizeof(BT_CTRL_ESCAPE_SEQUENCE[0]); 16 | 17 | BluetoothSerial SerialBT; 18 | unsigned long lastSend = 0; 19 | bool isConnected = false; 20 | bool btKeyHigh = false; 21 | String sendBuffer; 22 | String commandBuffer; 23 | 24 | int8_t escapeSequencePos = 0; 25 | unsigned long lastEscapeSequenceChar = 0; 26 | 27 | bool bridgeInit = false; 28 | bool ucTx = false; 29 | 30 | HardwareSerial UCSerial(1); 31 | MultiSerial CmdSerial; 32 | 33 | void setup() { 34 | pinMode(BT_KEY, INPUT_PULLDOWN); 35 | pinMode(PIN_CONNECTED, OUTPUT); 36 | digitalWrite(PIN_CONNECTED, LOW); 37 | pinMode(UC_NRST, INPUT); 38 | 39 | SerialBT.begin(BT_NAME); 40 | Serial.begin(115200); 41 | UCSerial.begin(230400, SERIAL_8E1, UC_RX, UC_TX); 42 | UCSerial.setRxBufferSize(1024); 43 | 44 | CmdSerial.addInterface(&Serial); 45 | CmdSerial.addInterface(&SerialBT); 46 | CmdSerial.addInterface(&UCSerial); 47 | 48 | sendBuffer.reserve(MAX_SEND_BUFFER); 49 | commandBuffer.reserve(MAX_CMD_BUFFER); 50 | 51 | setupCommands(); 52 | 53 | while(CmdSerial.available()) { 54 | CmdSerial.read(); 55 | } 56 | CmdSerial.disableInterface(&SerialBT); 57 | CmdSerial.disableInterface(&UCSerial); 58 | 59 | Serial.print(""); 62 | commandPrompt(); 63 | 64 | #ifdef PIN_READY 65 | digitalWrite(PIN_READY, HIGH); 66 | pinMode(PIN_READY, OUTPUT); 67 | #endif 68 | } 69 | 70 | void sendBufferNow() { 71 | int sentBytes = 0; 72 | if(isConnected) { 73 | if(sendBuffer.length() > 0) { 74 | while(sentBytes < sendBuffer.length()) { 75 | sentBytes += SerialBT.write( 76 | &(((const uint8_t*)sendBuffer.c_str())[sentBytes]), 77 | sendBuffer.length() - sentBytes 78 | ); 79 | } 80 | } 81 | } 82 | sendBuffer = ""; 83 | lastSend = millis(); 84 | } 85 | 86 | void loop() { 87 | commandLoop(); 88 | 89 | bool _connected = SerialBT.hasClient(); 90 | 91 | if(isConnected != _connected) { 92 | isConnected = _connected; 93 | 94 | if(isConnected) { 95 | Serial.println(""); 96 | } else { 97 | Serial.println(""); 98 | unescape(); 99 | } 100 | digitalWrite(PIN_CONNECTED, isConnected); 101 | } 102 | 103 | bool _btKeyHigh = digitalRead(BT_KEY) == HIGH; 104 | if(btKeyHigh != _btKeyHigh) { 105 | btKeyHigh = _btKeyHigh; 106 | 107 | if(btKeyHigh) { 108 | Serial.println(""); 109 | } else { 110 | Serial.println(""); 111 | } 112 | } 113 | 114 | if(UCSerial.available()) { 115 | int read = UCSerial.read(); 116 | 117 | if(read != -1) { 118 | if(btKeyHigh) { 119 | // The uC is trying to send us a command; let's process 120 | // it as such. 121 | commandByte(read); 122 | } else { 123 | if(monitorBridgeEnabled()) { 124 | if(!ucTx || bridgeInit == false) { 125 | Serial.println(); 126 | Serial.print("UC> "); 127 | ucTx = true; 128 | bridgeInit = true; 129 | } 130 | Serial.print((char)read); 131 | } 132 | 133 | sendBuffer += (char)read; 134 | if( 135 | ((char)read == '\n') 136 | || sendBuffer.length() >= (MAX_SEND_BUFFER - 1) 137 | ) { 138 | sendBufferNow(); 139 | } 140 | } 141 | } 142 | } else if (millis() - lastSend > MAX_SEND_WAIT) { 143 | sendBufferNow(); 144 | } 145 | if(!escapeIsEnabled()) { 146 | if(SerialBT.available()) { 147 | int read = SerialBT.read(); 148 | 149 | if(read != -1) { 150 | if(monitorBridgeEnabled()) { 151 | if(ucTx || bridgeInit == false) { 152 | Serial.println(); 153 | Serial.print("BT> "); 154 | ucTx = false; 155 | bridgeInit = true; 156 | } 157 | Serial.print((char)read); 158 | } 159 | UCSerial.write((char)read); 160 | if( 161 | read == BT_CTRL_ESCAPE_SEQUENCE[escapeSequencePos] 162 | && ( 163 | millis() > ( 164 | lastEscapeSequenceChar + BT_CTRL_ESCAPE_SEQUENCE_INTERCHARACTER_DELAY 165 | ) 166 | ) 167 | ) { 168 | lastEscapeSequenceChar = millis(); 169 | escapeSequencePos++; 170 | } else { 171 | escapeSequencePos = 0; 172 | } 173 | if(escapeSequencePos == BT_CTRL_ESCAPE_SEQUENCE_LENGTH) { 174 | enableEscape(); 175 | } 176 | } 177 | } 178 | } 179 | } 180 | -------------------------------------------------------------------------------- /main/main.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Arduino.h" 4 | #include "BluetoothSerial.h" 5 | #include "multiserial.h" 6 | 7 | // This is the name that this device will appear under during discovery 8 | #define BT_NAME "esp32-bridge" 9 | 10 | // At least this number of ms must elapse between each 11 | // character of the escape sequence for it to be counted; this 12 | // is done to prevent legitimate occurrences of the escape sequence 13 | // occurring in binary causing us to enter the bridge mode. 14 | #define BT_CTRL_ESCAPE_SEQUENCE_INTERCHARACTER_DELAY 250 15 | 16 | // For communicating with the microcontroller, we will transmit and 17 | // receive on the following pins. Do not set these to match the pins 18 | // used by defualt for the ESP32 unit's UART1 (IO35 and IO34). I've also 19 | // heard, but not confirmed, that the IO pin used for TX must be a higher 20 | // IO number than the pin used for RX. If you can confirm or deny this, 21 | // I'd love to hear a definitive answer. 22 | #define UC_TX 27 23 | #define UC_RX 14 24 | 25 | // This pin will be pulled HIGH (if defined) when the device is 26 | // ready for connections 27 | #define PIN_READY 5 28 | 29 | // This pin will be pulled HIGH when a client is connected over bluetooth. 30 | #define PIN_CONNECTED 4 31 | 32 | // If your microcontroller pulls this pin HIGH, it can send commands 33 | // directly to the ESP32 unit 34 | #define BT_KEY 16 35 | 36 | // Connect this to your microcontoller's reset line to allow you to 37 | // reset your microcontoller at-will. 38 | #define UC_NRST 17 39 | 40 | #define MAX_SEND_WAIT 50 41 | #define MAX_CMD_BUFFER 128 42 | #define MAX_SEND_BUFFER 128 43 | 44 | void setup(); 45 | void loop(); 46 | void sendBufferNow(); 47 | 48 | extern MultiSerial CmdSerial; 49 | extern HardwareSerial UCSerial; 50 | extern BluetoothSerial SerialBT; 51 | -------------------------------------------------------------------------------- /main/multiserial.cpp: -------------------------------------------------------------------------------- 1 | #include "multiserial.h" 2 | 3 | MultiSerial::MultiSerial() {} 4 | 5 | void MultiSerial::addInterface(Stream* interface) { 6 | interfaces[interfaceCount] = interface; 7 | interfacesEnabled[interfaceCount] = true; 8 | interfaceCount++; 9 | } 10 | 11 | void MultiSerial::enableInterface(Stream* interface) { 12 | for(uint8_t i = 0; i < interfaceCount; i++) { 13 | if(interfaces[i] == interface) { 14 | interfacesEnabled[i] = true; 15 | } 16 | } 17 | } 18 | 19 | void MultiSerial::disableInterface(Stream* interface) { 20 | for(uint8_t i = 0; i < interfaceCount; i++) { 21 | if(interfaces[i] == interface) { 22 | interfacesEnabled[i] = false; 23 | } 24 | } 25 | } 26 | 27 | int MultiSerial::available() { 28 | int available = 0; 29 | 30 | for(uint8_t i = 0; i < interfaceCount; i++) { 31 | if(interfacesEnabled[i]) { 32 | available += interfaces[i]->available(); 33 | } 34 | } 35 | 36 | return available; 37 | } 38 | 39 | int MultiSerial::peek() { 40 | for(uint8_t i = 0; i < interfaceCount; i++) { 41 | if(interfacesEnabled[i]) { 42 | if(interfaces[i]->available()) { 43 | return interfaces[i]->peek(); 44 | } 45 | } 46 | } 47 | 48 | return -1; 49 | } 50 | 51 | int MultiSerial::read() { 52 | for(uint8_t i = 0; i < interfaceCount; i++) { 53 | if(interfacesEnabled[i]) { 54 | if(interfaces[i]->available()) { 55 | return interfaces[i]->read(); 56 | } 57 | } 58 | } 59 | 60 | return -1; 61 | } 62 | 63 | void MultiSerial::flush() { 64 | for(uint8_t i = 0; i < interfaceCount; i++) { 65 | if(interfacesEnabled[i]) { 66 | interfaces[i]->flush(); 67 | } 68 | } 69 | } 70 | 71 | size_t MultiSerial::write(uint8_t value) { 72 | size_t count = 0; 73 | 74 | for(uint8_t i = 0; i < interfaceCount; i++) { 75 | if(interfacesEnabled[i]) { 76 | count += interfaces[i]->write(value); 77 | } 78 | } 79 | 80 | return count; 81 | } 82 | -------------------------------------------------------------------------------- /main/multiserial.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class MultiSerial : public Stream 6 | { 7 | public: 8 | MultiSerial(); 9 | 10 | void addInterface(Stream*); 11 | void enableInterface(Stream* interface); 12 | void disableInterface(Stream* interface); 13 | 14 | virtual int available(); 15 | virtual int peek(); 16 | virtual int read(); 17 | virtual void flush(); 18 | 19 | virtual size_t write(uint8_t); 20 | inline size_t write(unsigned long n) {return write((uint8_t)n);}; 21 | inline size_t write(long n) {return write((uint8_t)n);}; 22 | inline size_t write(unsigned int n) {return write((uint8_t)n);}; 23 | inline size_t write(int n) {return write((uint8_t)n);}; 24 | using Print::write; 25 | operator bool() {return true;}; 26 | 27 | private: 28 | unsigned long baud; 29 | uint8_t mode; 30 | 31 | bool interfacesEnabled[5]; 32 | Stream* interfaces[5]; 33 | uint8_t interfaceCount = 0; 34 | }; 35 | -------------------------------------------------------------------------------- /programming/ota_flash.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import base64 3 | import time 4 | 5 | import click 6 | import serial 7 | 8 | 9 | READY_SIGNAL = b"" 10 | 11 | 12 | class OtaFailed(Exception): 13 | pass 14 | 15 | 16 | def main( 17 | port, 18 | file, 19 | baud=115200, 20 | chunk_size=700, 21 | escape_sequence=None, 22 | escape_sequence_interbyte_delay=0, 23 | pre_escape_commands=[], 24 | ): 25 | print( 26 | "Flashing {file} to device at {port} ({baud})...".format( 27 | file=file, 28 | port=port, 29 | baud=baud, 30 | ) 31 | ) 32 | 33 | with serial.Serial(port, baud, timeout=1) as ser: 34 | if pre_escape_commands: 35 | ser.write(b'\n') 36 | for command in pre_escape_commands: 37 | ser.write(command.encode('ascii')) 38 | ser.write(b'\n') 39 | 40 | if escape_sequence: 41 | for byte in escape_sequence: 42 | ser.write(byte) 43 | time.sleep(escape_sequence_interbyte_delay) 44 | ser.write(b'\n') 45 | 46 | ser.write(b'flash_esp32\n') 47 | 48 | while True: 49 | line = ser.readline().strip() 50 | if(line != READY_SIGNAL): 51 | print(line.strip().decode('utf8')) 52 | else: 53 | print("Sending data...") 54 | with open(file, 'rb') as inf: 55 | try: 56 | transmit_file(ser, inf, chunk_size) 57 | except OtaFailed: 58 | print_serial_responses(ser) 59 | raise 60 | print("Data transmission completed.") 61 | print_serial_responses(ser) 62 | break 63 | 64 | 65 | def transmit_file(ser, inf, chunk_size): 66 | output = bytearray() 67 | 68 | with click.progressbar(inf.read()) as data: 69 | for byte in data: 70 | output += byte.to_bytes(1, byteorder='big') 71 | if(len(output) >= chunk_size): 72 | transmit_chunk(ser, output) 73 | output = bytearray() 74 | 75 | if ser.in_waiting: 76 | line = ser.readline().strip() 77 | if line: 78 | line = line.decode('ascii') 79 | print(line) 80 | if line.startswith( 81 | "" 88 | ): 89 | raise OtaFailed("Flash failed.") 90 | elif line.startswith( 91 | "" 92 | ): 93 | raise OtaFailed( 94 | "Unexpected early completion." 95 | ) 96 | transmit_chunk(ser, output) 97 | 98 | 99 | def transmit_chunk(ser, data): 100 | ser.write(base64.b64encode(data)) 101 | ser.write(b'\n') 102 | 103 | 104 | def print_serial_responses(ser, seconds=3): 105 | occurred = time.time() 106 | # Collect any serial messages that occur over 107 | # the next three seconds 108 | while(time.time() < occurred + seconds): 109 | if ser.in_waiting: 110 | line = ser.readline().strip() 111 | if line: 112 | print(line.decode('utf-8')) 113 | 114 | 115 | def type_escape_sequence(data): 116 | escape_sequence_bytes = [] 117 | 118 | for part in data.split(','): 119 | if part.startswith('0x'): 120 | escape_sequence_bytes.append(int(part, 16)) 121 | continue 122 | 123 | escape_sequence_bytes.append(ord(part.encode('ascii'))) 124 | 125 | return escape_sequence_bytes 126 | 127 | 128 | if __name__ == '__main__': 129 | parser = argparse.ArgumentParser() 130 | parser.add_argument('port', type=str) 131 | parser.add_argument( 132 | '--file', 133 | type=str, 134 | help=( 135 | 'ESP32 programming file to flash over-the-air to the device. ' 136 | 'Note that this file is the file having the extension `.bin`, not ' 137 | 'the file having the extension `.elf`!. This defaults to ' 138 | '`../build/bridge.bin`.' 139 | ), 140 | default='../build/bridge.bin', 141 | ) 142 | parser.add_argument('--baud', type=int, default=115200) 143 | parser.add_argument( 144 | '--escape-sequence', 145 | type=type_escape_sequence, 146 | help=( 147 | 'Comma-separated bytes to transmit to escape the serial ' 148 | 'pass-through to the microcontroller. This should match ' 149 | '`BT_CTRL_ESCAPE_SEQUENCE` in `main.cpp`. Non-printable ' 150 | 'characters can be specified as hexadecimal values prefixed ' 151 | 'with `0x`. Defaults to `0x04,0x04,0x04,!`.' 152 | ), 153 | default=[b'\4', b'\4', b'\4', b'!'] 154 | ) 155 | parser.add_argument( 156 | '--escape-sequence-interbyte-delay', 157 | type=float, 158 | help=( 159 | 'Amount of time (in seconds) to delay between each byte ' 160 | 'of the escape sequence. Defaults to 0.75s.' 161 | ), 162 | default=0.75, 163 | ) 164 | parser.add_argument( 165 | '--pre-escape-command', 166 | type=str, 167 | help=( 168 | 'Commands to issue to the pass-through microcontroller prior ' 169 | 'to escaping the serial pass-through. These are intended to ' 170 | 'be used as a way of preventing the pass-through microcontroller ' 171 | 'turning off the ESP32 unit during programming. By default, ' 172 | 'this sends nothing.' 173 | ), 174 | default=[], 175 | action='append', 176 | ) 177 | parser.add_argument( 178 | '--chunk-size', 179 | type=int, 180 | help=( 181 | 'Maximum chunk size use for sending binary data. Binary data ' 182 | 'is sent in Base64-encoded chunks that the ESP32 unit must then ' 183 | 'decode into their actual bytes. The higher this value is, ' 184 | 'the faster the device may be flashed, but this number of bytes ' 185 | 'cannot after being Base64-encoded exceed the buffer size ' 186 | 'the ESP32 unit has reserved for this process (generally ' 187 | '1024kB); on average Base64 encoding bytes results in a 40% ' 188 | 'increase in size. This value defaults to 700 resulting in ' 189 | 'a transmitted byte count of about 980 bytes per chunk.' 190 | ), 191 | default=700, 192 | ) 193 | 194 | args = parser.parse_args() 195 | 196 | main( 197 | args.port, 198 | args.file, 199 | baud=args.baud, 200 | chunk_size=args.chunk_size, 201 | escape_sequence=args.escape_sequence, 202 | escape_sequence_interbyte_delay=args.escape_sequence_interbyte_delay, 203 | pre_escape_commands=args.pre_escape_command, 204 | ) 205 | -------------------------------------------------------------------------------- /programming/requirements.txt: -------------------------------------------------------------------------------- 1 | click==6.7 2 | pyserial==3.4 3 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # ESP32 Bluetooth Bridge (Replaces HC-05) 2 | 3 | Do you have a project where you'd like it to be possible for you to connect 4 | to (and potentially reprogram) another microcontroller over Bluetooth, but 5 | also want to have the flexibility to add new Bluetooth, BLE, or WIFI 6 | features? I previously used the HC-05 bluetooth module for providing Bluetooth 7 | tty access for interactions and programming; the ESP32, though, is only 8 | slightly more expensive and provides many features that the HC-05 9 | cannot offer -- including that it itself can be programmed over-the-air to 10 | add your own features and functionality very easily. 11 | 12 | This repository contains a simple Bluetooth-to-UART bridge roughly 13 | mirroring how the HC-05 behaved, but adds a handful of new features: 14 | 15 | * An escape sequence allowing you to break out of your serial bridge 16 | to send commands to the wireless unit itself directly. 17 | * The ability to accept commands including one allowing you to monitor 18 | the bluetooth bridge via the ESP32's UART1. 19 | * Configurable pin connections for: 20 | * Indicating when a client is connected over bluetooth (`PIN_CONNECTED`) 21 | * Allowing the bridged microcontroller to send commands directly to the 22 | ESP32 (`BT_KEY`). 23 | * Connecting to the Microcontroller's reset line for debugging, 24 | flashing, and troubleshooting. 25 | * RX/TX output pins for connecting to the microcontroller. 26 | * A variety of (partially STM32-specific) commands and the ability 27 | for you to add your own very easily. 28 | 29 | ## Commands 30 | 31 | ### `flash_esp32` 32 | 33 | This command begins an OTA flash of the ESP32 unit itself. In general, 34 | there is no need for you to run this command directly, instead use the 35 | included python script in `programming/ota_flash.py` to flash the ESP32 36 | unit over bluetooth. See "Flashing the ESP32 Over-the-air" for details. 37 | 38 | ### `flash_uc` 39 | 40 | This command is designed to reboot an STM32 microcontroller into its 41 | serial bootloader by: 42 | 43 | * Pulling its BOOT0 pin high (see `PIN_CONNECTED` in `main.h`) 44 | * Pulling its nRST line low for 250ms (see `UC_NRST` in `main.h`) 45 | * Pulling its nRST line high 46 | 47 | At that point, the microcontroller will be ready to accept programming 48 | over bluetooth. 49 | 50 | ### `reset_uc` 51 | 52 | Briefly pulls the microcontroller's reset line low to cause it to restart. 53 | 54 | ### `boot0 [0|1]` 55 | 56 | * When called without an argument: returns the current state of the BOOT0 pin 57 | (i.e. `PIN_CONNECTED`). 58 | * When called with an argument of `0`: Pulls BOOT0 (`PIN_CONNECTED`) low. 59 | * When called with an argument of `1`: Pulls BOOT0 (`PIN_CONNECTED`) high. 60 | 61 | `PIN_CONNECTED` is generally connected directly to the `BOOT0` pin of the 62 | microcontroller to emulate the procedure historically used for using an 63 | HC-05 unit to flash an STM32 microcontroller. You'll notice that they 64 | are used interchangably throughout this document and in the source, but do 65 | know that you can adjust the state of this pin independently from its 66 | default behavior of indicating whether a client is connected. 67 | 68 | ### `monitor [0|1]` 69 | 70 | * When called without an argument: returns the current state of the serial 71 | monitor. 72 | * When called with an argument of `0`: Turns serial monitoring off. 73 | * When called with an argument of `1`: Turns serial monitoring on. 74 | 75 | Note that this is probably only useful if you are issuing commands 76 | to the ESP32 unit's UART1 instead of communicating over Bluetooth. 77 | 78 | ### `nrst [0|1]` 79 | 80 | * When called without an argument: stops setting the state of the 81 | microcontroller's nRST pin by reconfiguring the corresponding ESP32 82 | pin as an input. 83 | * When called with an argument of `0`: Pulls nRST (`UC_NRST`) low. 84 | * When called with an argument of `1`: Pulls nRST (`UC_NRST`) high. 85 | 86 | ### `unescape` 87 | 88 | Exits "escaped" mode if the device had previously recieved 89 | the relevant escape sequence. This is useful for allowing you to 90 | re-enable pass-through functionality after issuing an escape sequence 91 | to send your microcontroller a command. 92 | 93 | ## Building the firmware 94 | 95 | First, make sure that you have installed the xtensa compiler 96 | (`xtensa-esp32-elf-gcc`) and that it is available on your PATH. 97 | 98 | Next, make sure you've cloned all necessary submodules: 99 | 100 | ``` 101 | git submodule update --init --recursive 102 | ``` 103 | 104 | After that, set the `IDF_PATH` environment variable 105 | to point at your clone of the esp32 IDF (https://github.com/espressif/esp-idf) -- 106 | and make sure that you've checked out a commit that is compatible with 107 | the version of arduino-esp32 in use. If you're running this repository 108 | as it is now, that commit should be `aaf12390`. 109 | 110 | Now, just ask it to compile: 111 | 112 | ``` 113 | make 114 | ``` 115 | 116 | You're now ready to flash that firmware onto the device. Note that if you 117 | are flashing over the air, you should follow the procedure described below 118 | under "Flashing the ESP32 Over-the-air" instead of following the usual 119 | `make flash` procedure. 120 | 121 | ## Escape Sequence 122 | 123 | *Default*: `CTRL+D`, `CTRL+D`, `CTRL+D`, `!` 124 | 125 | The escape sequence keys must be pressed _at least_ 500ms apart from one 126 | another (and, obviously, no other keys may be pressed between each of your 127 | escape sequence bytes). This might sound a little strange, but this 128 | behavior exists as a way of making sure that the bytes transmitted as 129 | part of your escape sequence aren't occurring naturally as part of 130 | some other data you're intentionally transmitting to your microcontroller. 131 | 132 | If you want to make adjustments to this behavior, see: 133 | 134 | * `main.h`: `BT_CTRL_ESCAPE_SEQUENCE_INTERCHARACTER_DELAY` to adjust the 135 | minimum amount of time that must pass between each character of your 136 | escape sequence. 137 | * `main.cpp`; `BT_CTRL_ESCAPE_SEQUENCE` to adjust the escape sequence itself. 138 | 139 | 140 | ## Flashing the ESP32 Over-the-air 141 | 142 | It's possible to flash the ESP32 unit itself over blueotooth by 143 | using the included python script (`programming/ota_flash.py`); to do that, 144 | follow the instructions below. 145 | 146 | Note that flashing is essentially 100% safe for an ESP32 module; the 147 | device's built-in Over-the-air programming functionality is cleverly 148 | designed and will not switch to the newly-programmed source unless it 149 | passes a verification procedure. If the flashing process fails for any 150 | reason, the installed code will remain unchanged. 151 | 152 | ### Building the firmware 153 | 154 | See "Building the firmware". 155 | 156 | ### Installing Dependencies 157 | 158 | From your clone of this repository, run the following commands: 159 | 160 | ``` 161 | cd programming 162 | virtualenv . --python=python3 163 | source bin/activate 164 | pip install -r requirements.txt 165 | cd .. 166 | ``` 167 | 168 | ### Flashing the firmware 169 | 170 | From your clone of this repository, run the following commands: 171 | 172 | ``` 173 | cd programming 174 | python ota_flash.py /path/to/bluetooth/device 175 | ``` 176 | 177 | By default, this will: 178 | 179 | * Connect to the device you have specified (at which point, you will 180 | be connected via the pass-through to the connected microcontroller). 181 | * Sends the "Escape Sequence" mentioned above to escape the pass-through. 182 | * Issues the command `flash_esp32`. 183 | * Waits for the ESP32 unit to be ready. 184 | * Sends the new firmware stored in `../build/bridge.bin`. 185 | * Prints any messages received from the ESP32 unit during this process. 186 | 187 | At the end of this process, you should see one of the following messages: 188 | 189 | * ``: If the flashing process completed successfully. 190 | * ``: If the flashing process failed for some reason. 191 | Consult the other displayed messages to determine a potential cause 192 | for this flashing fialure. Note that failures are completely safe, and 193 | you can try re-flashing again as soon as you'd like. 194 | 195 | See `python ota_flash.py --help` for other options. 196 | -------------------------------------------------------------------------------- /sdkconfig: -------------------------------------------------------------------------------- 1 | # 2 | # Automatically generated file; DO NOT EDIT. 3 | # Espressif IoT Development Framework Configuration 4 | # 5 | CONFIG_IDF_TARGET="esp32" 6 | 7 | # 8 | # SDK tool configuration 9 | # 10 | CONFIG_TOOLPREFIX="xtensa-esp32-elf-" 11 | CONFIG_PYTHON="python" 12 | CONFIG_MAKE_WARN_UNDEFINED_VARIABLES=y 13 | 14 | # 15 | # Application manager 16 | # 17 | CONFIG_APP_COMPILE_TIME_DATE=y 18 | CONFIG_APP_EXCLUDE_PROJECT_VER_VAR= 19 | CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR= 20 | 21 | # 22 | # Arduino Configuration 23 | # 24 | CONFIG_ENABLE_ARDUINO_DEPENDS=y 25 | CONFIG_AUTOSTART_ARDUINO=y 26 | CONFIG_DISABLE_HAL_LOCKS= 27 | 28 | # 29 | # Debug Log Configuration 30 | # 31 | CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_NONE= 32 | CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_ERROR=y 33 | CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_WARN= 34 | CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_INFO= 35 | CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_DEBUG= 36 | CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL_VERBOSE= 37 | CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL=1 38 | CONFIG_ARDUHAL_LOG_COLORS= 39 | CONFIG_ARDUHAL_ESP_LOG=y 40 | CONFIG_ARDUHAL_PARTITION_SCHEME_DEFAULT=y 41 | CONFIG_ARDUHAL_PARTITION_SCHEME_MINIMAL= 42 | CONFIG_ARDUHAL_PARTITION_SCHEME_NO_OTA= 43 | CONFIG_ARDUHAL_PARTITION_SCHEME_MIN_SPIFFS= 44 | CONFIG_ARDUHAL_PARTITION_SCHEME="default" 45 | CONFIG_AUTOCONNECT_WIFI= 46 | CONFIG_ARDUINO_SELECTIVE_COMPILATION=y 47 | CONFIG_ARDUINO_SELECTIVE_ArduinoOTA=y 48 | CONFIG_ARDUINO_SELECTIVE_AsyncUDP=y 49 | CONFIG_ARDUINO_SELECTIVE_AzureIoT=y 50 | CONFIG_ARDUINO_SELECTIVE_BLE=y 51 | CONFIG_ARDUINO_SELECTIVE_BluetoothSerial=y 52 | CONFIG_ARDUINO_SELECTIVE_DNSServer=y 53 | CONFIG_ARDUINO_SELECTIVE_EEPROM=y 54 | CONFIG_ARDUINO_SELECTIVE_ESP32=y 55 | CONFIG_ARDUINO_SELECTIVE_ESPmDNS=y 56 | CONFIG_ARDUINO_SELECTIVE_FS=y 57 | CONFIG_ARDUINO_SELECTIVE_HTTPClient=y 58 | CONFIG_ARDUINO_SELECTIVE_NetBIOS=y 59 | CONFIG_ARDUINO_SELECTIVE_Preferences=y 60 | CONFIG_ARDUINO_SELECTIVE_SD= 61 | CONFIG_ARDUINO_SELECTIVE_SD_MMC= 62 | CONFIG_ARDUINO_SELECTIVE_SimpleBLE=y 63 | CONFIG_ARDUINO_SELECTIVE_SPI=y 64 | CONFIG_ARDUINO_SELECTIVE_SPIFFS=y 65 | CONFIG_ARDUINO_SELECTIVE_Ticker=y 66 | CONFIG_ARDUINO_SELECTIVE_Update=y 67 | CONFIG_ARDUINO_SELECTIVE_WebServer=y 68 | CONFIG_ARDUINO_SELECTIVE_WiFi=y 69 | CONFIG_ARDUINO_SELECTIVE_WiFiClientSecure=y 70 | CONFIG_ARDUINO_SELECTIVE_Wire=y 71 | 72 | # 73 | # Bootloader config 74 | # 75 | CONFIG_LOG_BOOTLOADER_LEVEL_NONE=y 76 | CONFIG_LOG_BOOTLOADER_LEVEL_ERROR= 77 | CONFIG_LOG_BOOTLOADER_LEVEL_WARN= 78 | CONFIG_LOG_BOOTLOADER_LEVEL_INFO= 79 | CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG= 80 | CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE= 81 | CONFIG_LOG_BOOTLOADER_LEVEL=0 82 | CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_8V= 83 | CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V=y 84 | CONFIG_BOOTLOADER_FACTORY_RESET= 85 | CONFIG_BOOTLOADER_APP_TEST= 86 | CONFIG_BOOTLOADER_WDT_ENABLE=y 87 | CONFIG_BOOTLOADER_WDT_DISABLE_IN_USER_CODE= 88 | CONFIG_BOOTLOADER_WDT_TIME_MS=9000 89 | CONFIG_APP_ROLLBACK_ENABLE= 90 | 91 | # 92 | # Security features 93 | # 94 | CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT= 95 | CONFIG_SECURE_BOOT_ENABLED= 96 | CONFIG_FLASH_ENCRYPTION_ENABLED= 97 | 98 | # 99 | # Serial flasher config 100 | # 101 | CONFIG_ESPTOOLPY_PORT="/dev/ttyUSB0" 102 | CONFIG_ESPTOOLPY_BAUD_115200B= 103 | CONFIG_ESPTOOLPY_BAUD_230400B= 104 | CONFIG_ESPTOOLPY_BAUD_921600B=y 105 | CONFIG_ESPTOOLPY_BAUD_2MB= 106 | CONFIG_ESPTOOLPY_BAUD_OTHER= 107 | CONFIG_ESPTOOLPY_BAUD_OTHER_VAL=115200 108 | CONFIG_ESPTOOLPY_BAUD=921600 109 | CONFIG_ESPTOOLPY_COMPRESSED=y 110 | CONFIG_FLASHMODE_QIO= 111 | CONFIG_FLASHMODE_QOUT= 112 | CONFIG_FLASHMODE_DIO=y 113 | CONFIG_FLASHMODE_DOUT= 114 | CONFIG_ESPTOOLPY_FLASHMODE="dio" 115 | CONFIG_ESPTOOLPY_FLASHFREQ_80M= 116 | CONFIG_ESPTOOLPY_FLASHFREQ_40M=y 117 | CONFIG_ESPTOOLPY_FLASHFREQ_26M= 118 | CONFIG_ESPTOOLPY_FLASHFREQ_20M= 119 | CONFIG_ESPTOOLPY_FLASHFREQ="40m" 120 | CONFIG_ESPTOOLPY_FLASHSIZE_1MB= 121 | CONFIG_ESPTOOLPY_FLASHSIZE_2MB= 122 | CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y 123 | CONFIG_ESPTOOLPY_FLASHSIZE_8MB= 124 | CONFIG_ESPTOOLPY_FLASHSIZE_16MB= 125 | CONFIG_ESPTOOLPY_FLASHSIZE="4MB" 126 | CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y 127 | CONFIG_ESPTOOLPY_BEFORE_RESET=y 128 | CONFIG_ESPTOOLPY_BEFORE_NORESET= 129 | CONFIG_ESPTOOLPY_BEFORE="default_reset" 130 | CONFIG_ESPTOOLPY_AFTER_RESET=y 131 | CONFIG_ESPTOOLPY_AFTER_NORESET= 132 | CONFIG_ESPTOOLPY_AFTER="hard_reset" 133 | CONFIG_MONITOR_BAUD_9600B= 134 | CONFIG_MONITOR_BAUD_57600B= 135 | CONFIG_MONITOR_BAUD_115200B=y 136 | CONFIG_MONITOR_BAUD_230400B= 137 | CONFIG_MONITOR_BAUD_921600B= 138 | CONFIG_MONITOR_BAUD_2MB= 139 | CONFIG_MONITOR_BAUD_OTHER= 140 | CONFIG_MONITOR_BAUD_OTHER_VAL=115200 141 | CONFIG_MONITOR_BAUD=115200 142 | 143 | # 144 | # Partition Table 145 | # 146 | CONFIG_PARTITION_TABLE_SINGLE_APP=y 147 | CONFIG_PARTITION_TABLE_TWO_OTA= 148 | CONFIG_PARTITION_TABLE_CUSTOM= 149 | CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" 150 | CONFIG_PARTITION_TABLE_FILENAME="partitions_singleapp.csv" 151 | CONFIG_PARTITION_TABLE_OFFSET=0x8000 152 | CONFIG_PARTITION_TABLE_MD5=y 153 | 154 | # 155 | # Compiler options 156 | # 157 | CONFIG_OPTIMIZATION_LEVEL_DEBUG=y 158 | CONFIG_OPTIMIZATION_LEVEL_RELEASE= 159 | CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED=y 160 | CONFIG_OPTIMIZATION_ASSERTIONS_SILENT= 161 | CONFIG_OPTIMIZATION_ASSERTIONS_DISABLED= 162 | CONFIG_CXX_EXCEPTIONS=y 163 | CONFIG_CXX_EXCEPTIONS_EMG_POOL_SIZE=0 164 | CONFIG_STACK_CHECK_NONE= 165 | CONFIG_STACK_CHECK_NORM=y 166 | CONFIG_STACK_CHECK_STRONG= 167 | CONFIG_STACK_CHECK_ALL= 168 | CONFIG_STACK_CHECK=y 169 | CONFIG_WARN_WRITE_STRINGS=y 170 | CONFIG_DISABLE_GCC8_WARNINGS= 171 | 172 | # 173 | # Component config 174 | # 175 | 176 | # 177 | # Application Level Tracing 178 | # 179 | CONFIG_ESP32_APPTRACE_DEST_TRAX= 180 | CONFIG_ESP32_APPTRACE_DEST_NONE=y 181 | CONFIG_ESP32_APPTRACE_ENABLE= 182 | CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y 183 | CONFIG_AWS_IOT_SDK= 184 | 185 | # 186 | # Bluetooth 187 | # 188 | CONFIG_BT_ENABLED=y 189 | 190 | # 191 | # Bluetooth controller 192 | # 193 | CONFIG_BTDM_CONTROLLER_MODE_BLE_ONLY= 194 | CONFIG_BTDM_CONTROLLER_MODE_BR_EDR_ONLY= 195 | CONFIG_BTDM_CONTROLLER_MODE_BTDM=y 196 | CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN=3 197 | CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN=2 198 | CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN=0 199 | CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN_EFF=3 200 | CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN_EFF=2 201 | CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN_EFF=0 202 | CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE_0=y 203 | CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE_1= 204 | CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE=0 205 | CONFIG_BTDM_CONTROLLER_HCI_MODE_VHCI=y 206 | CONFIG_BTDM_CONTROLLER_HCI_MODE_UART_H4= 207 | 208 | # 209 | # MODEM SLEEP Options 210 | # 211 | CONFIG_BTDM_CONTROLLER_MODEM_SLEEP=y 212 | CONFIG_BTDM_MODEM_SLEEP_MODE_ORIG=y 213 | CONFIG_BTDM_MODEM_SLEEP_MODE_EVED= 214 | CONFIG_BTDM_LPCLK_SEL_MAIN_XTAL=y 215 | CONFIG_BLE_SCAN_DUPLICATE=y 216 | CONFIG_SCAN_DUPLICATE_BY_DEVICE_ADDR=y 217 | CONFIG_SCAN_DUPLICATE_BY_ADV_DATA= 218 | CONFIG_SCAN_DUPLICATE_BY_ADV_DATA_AND_DEVICE_ADDR= 219 | CONFIG_SCAN_DUPLICATE_TYPE=0 220 | CONFIG_DUPLICATE_SCAN_CACHE_SIZE=200 221 | CONFIG_BLE_MESH_SCAN_DUPLICATE_EN= 222 | CONFIG_BLUEDROID_ENABLED=y 223 | CONFIG_BLUEDROID_PINNED_TO_CORE_0=y 224 | CONFIG_BLUEDROID_PINNED_TO_CORE_1= 225 | CONFIG_BLUEDROID_PINNED_TO_CORE=0 226 | CONFIG_BTC_TASK_STACK_SIZE=8192 227 | CONFIG_BLUEDROID_MEM_DEBUG= 228 | CONFIG_CLASSIC_BT_ENABLED=y 229 | CONFIG_A2DP_ENABLE=y 230 | CONFIG_A2DP_SINK_TASK_STACK_SIZE=2048 231 | CONFIG_A2DP_SOURCE_TASK_STACK_SIZE=2048 232 | CONFIG_BT_SPP_ENABLED=y 233 | CONFIG_HFP_ENABLE=y 234 | CONFIG_HFP_CLIENT_ENABLE=y 235 | CONFIG_HFP_AUDIO_DATA_PATH_PCM=y 236 | CONFIG_HFP_AUDIO_DATA_PATH_HCI= 237 | CONFIG_BT_SSP_ENABLED=y 238 | CONFIG_GATTS_ENABLE=y 239 | CONFIG_GATTS_SEND_SERVICE_CHANGE_MANUAL= 240 | CONFIG_GATTS_SEND_SERVICE_CHANGE_AUTO=y 241 | CONFIG_GATTS_SEND_SERVICE_CHANGE_MODE=0 242 | CONFIG_GATTC_ENABLE=y 243 | CONFIG_GATTC_CACHE_NVS_FLASH= 244 | CONFIG_BLE_SMP_ENABLE=y 245 | CONFIG_BT_STACK_NO_LOG=y 246 | CONFIG_BT_ACL_CONNECTIONS=4 247 | CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST=y 248 | CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY=y 249 | CONFIG_BLE_HOST_QUEUE_CONGESTION_CHECK= 250 | CONFIG_SMP_ENABLE=y 251 | CONFIG_BT_RESERVE_DRAM=0xdb5c 252 | 253 | # 254 | # Driver configurations 255 | # 256 | 257 | # 258 | # ADC configuration 259 | # 260 | CONFIG_ADC_FORCE_XPD_FSM= 261 | CONFIG_ADC2_DISABLE_DAC=y 262 | 263 | # 264 | # SPI configuration 265 | # 266 | CONFIG_SPI_MASTER_IN_IRAM= 267 | CONFIG_SPI_MASTER_ISR_IN_IRAM=y 268 | CONFIG_SPI_SLAVE_IN_IRAM= 269 | CONFIG_SPI_SLAVE_ISR_IN_IRAM=y 270 | 271 | # 272 | # ESP32-specific 273 | # 274 | CONFIG_IDF_TARGET_ESP32=y 275 | CONFIG_ESP32_DEFAULT_CPU_FREQ_80=y 276 | CONFIG_ESP32_DEFAULT_CPU_FREQ_160= 277 | CONFIG_ESP32_DEFAULT_CPU_FREQ_240= 278 | CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=80 279 | CONFIG_SPIRAM_SUPPORT=y 280 | 281 | # 282 | # SPI RAM config 283 | # 284 | CONFIG_SPIRAM_BOOT_INIT= 285 | CONFIG_SPIRAM_USE_MEMMAP= 286 | CONFIG_SPIRAM_USE_CAPS_ALLOC=y 287 | CONFIG_SPIRAM_USE_MALLOC= 288 | CONFIG_SPIRAM_TYPE_AUTO=y 289 | CONFIG_SPIRAM_TYPE_ESPPSRAM32= 290 | CONFIG_SPIRAM_TYPE_ESPPSRAM64= 291 | CONFIG_SPIRAM_SIZE=-1 292 | CONFIG_SPIRAM_SPEED_40M=y 293 | CONFIG_SPIRAM_CACHE_WORKAROUND=y 294 | CONFIG_SPIRAM_BANKSWITCH_ENABLE=y 295 | CONFIG_SPIRAM_BANKSWITCH_RESERVE=8 296 | CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST=y 297 | CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY= 298 | CONFIG_MEMMAP_TRACEMEM= 299 | CONFIG_MEMMAP_TRACEMEM_TWOBANKS= 300 | CONFIG_ESP32_TRAX= 301 | CONFIG_TRACEMEM_RESERVE_DRAM=0x0 302 | 303 | # 304 | # Core dump 305 | # 306 | CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH= 307 | CONFIG_ESP32_ENABLE_COREDUMP_TO_UART= 308 | CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y 309 | CONFIG_ESP32_ENABLE_COREDUMP= 310 | CONFIG_TWO_UNIVERSAL_MAC_ADDRESS= 311 | CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS=y 312 | CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS=4 313 | CONFIG_SYSTEM_EVENT_QUEUE_SIZE=32 314 | CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE=2048 315 | CONFIG_MAIN_TASK_STACK_SIZE=4096 316 | CONFIG_IPC_TASK_STACK_SIZE=1024 317 | CONFIG_TIMER_TASK_STACK_SIZE=4096 318 | CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF=y 319 | CONFIG_NEWLIB_STDOUT_LINE_ENDING_LF= 320 | CONFIG_NEWLIB_STDOUT_LINE_ENDING_CR= 321 | CONFIG_NEWLIB_STDIN_LINE_ENDING_CRLF= 322 | CONFIG_NEWLIB_STDIN_LINE_ENDING_LF= 323 | CONFIG_NEWLIB_STDIN_LINE_ENDING_CR=y 324 | CONFIG_NEWLIB_NANO_FORMAT= 325 | CONFIG_CONSOLE_UART_DEFAULT=y 326 | CONFIG_CONSOLE_UART_CUSTOM= 327 | CONFIG_CONSOLE_UART_NONE= 328 | CONFIG_CONSOLE_UART_NUM=0 329 | CONFIG_CONSOLE_UART_BAUDRATE=115200 330 | CONFIG_ULP_COPROC_ENABLED=y 331 | CONFIG_ULP_COPROC_RESERVE_MEM=512 332 | CONFIG_ESP32_PANIC_PRINT_HALT= 333 | CONFIG_ESP32_PANIC_PRINT_REBOOT=y 334 | CONFIG_ESP32_PANIC_SILENT_REBOOT= 335 | CONFIG_ESP32_PANIC_GDBSTUB= 336 | CONFIG_ESP32_DEBUG_OCDAWARE=y 337 | CONFIG_ESP32_DEBUG_STUBS_ENABLE=y 338 | CONFIG_INT_WDT=y 339 | CONFIG_INT_WDT_TIMEOUT_MS=300 340 | CONFIG_INT_WDT_CHECK_CPU1=y 341 | CONFIG_TASK_WDT=y 342 | CONFIG_TASK_WDT_PANIC=y 343 | CONFIG_TASK_WDT_TIMEOUT_S=5 344 | CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=y 345 | CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1= 346 | CONFIG_BROWNOUT_DET=y 347 | CONFIG_BROWNOUT_DET_LVL_SEL_0=y 348 | CONFIG_BROWNOUT_DET_LVL_SEL_1= 349 | CONFIG_BROWNOUT_DET_LVL_SEL_2= 350 | CONFIG_BROWNOUT_DET_LVL_SEL_3= 351 | CONFIG_BROWNOUT_DET_LVL_SEL_4= 352 | CONFIG_BROWNOUT_DET_LVL_SEL_5= 353 | CONFIG_BROWNOUT_DET_LVL_SEL_6= 354 | CONFIG_BROWNOUT_DET_LVL_SEL_7= 355 | CONFIG_BROWNOUT_DET_LVL=0 356 | CONFIG_REDUCE_PHY_TX_POWER=y 357 | CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1=y 358 | CONFIG_ESP32_TIME_SYSCALL_USE_RTC= 359 | CONFIG_ESP32_TIME_SYSCALL_USE_FRC1= 360 | CONFIG_ESP32_TIME_SYSCALL_USE_NONE= 361 | CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC=y 362 | CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL= 363 | CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_OSC= 364 | CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_8MD256= 365 | CONFIG_ESP32_RTC_CLK_CAL_CYCLES=1024 366 | CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY=2000 367 | CONFIG_ESP32_XTAL_FREQ_40= 368 | CONFIG_ESP32_XTAL_FREQ_26= 369 | CONFIG_ESP32_XTAL_FREQ_AUTO=y 370 | CONFIG_ESP32_XTAL_FREQ=0 371 | CONFIG_DISABLE_BASIC_ROM_CONSOLE= 372 | CONFIG_ESP_TIMER_PROFILING= 373 | CONFIG_COMPATIBLE_PRE_V2_1_BOOTLOADERS= 374 | CONFIG_ESP_ERR_TO_NAME_LOOKUP=y 375 | 376 | # 377 | # Wi-Fi 378 | # 379 | CONFIG_SW_COEXIST_ENABLE=y 380 | CONFIG_SW_COEXIST_PREFERENCE_WIFI=y 381 | CONFIG_SW_COEXIST_PREFERENCE_BT= 382 | CONFIG_SW_COEXIST_PREFERENCE_BALANCE= 383 | CONFIG_SW_COEXIST_PREFERENCE_VALUE=0 384 | CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=4 385 | CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=10 386 | CONFIG_ESP32_WIFI_STATIC_TX_BUFFER= 387 | CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER=y 388 | CONFIG_ESP32_WIFI_TX_BUFFER_TYPE=1 389 | CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=32 390 | CONFIG_ESP32_WIFI_CSI_ENABLED= 391 | CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y 392 | CONFIG_ESP32_WIFI_TX_BA_WIN=6 393 | CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=y 394 | CONFIG_ESP32_WIFI_RX_BA_WIN=6 395 | CONFIG_ESP32_WIFI_NVS_ENABLED=y 396 | CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_0=y 397 | CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_1= 398 | CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN=752 399 | CONFIG_ESP32_WIFI_DEBUG_LOG_ENABLE= 400 | 401 | # 402 | # PHY 403 | # 404 | CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y 405 | CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION= 406 | CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER=20 407 | CONFIG_ESP32_PHY_MAX_TX_POWER=20 408 | 409 | # 410 | # Power Management 411 | # 412 | CONFIG_PM_ENABLE= 413 | 414 | # 415 | # ADC-Calibration 416 | # 417 | CONFIG_ADC_CAL_EFUSE_TP_ENABLE=y 418 | CONFIG_ADC_CAL_EFUSE_VREF_ENABLE=y 419 | CONFIG_ADC_CAL_LUT_ENABLE=y 420 | 421 | # 422 | # Event Loop Library 423 | # 424 | CONFIG_EVENT_LOOP_PROFILING= 425 | 426 | # 427 | # ESP HTTP client 428 | # 429 | CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS=y 430 | 431 | # 432 | # HTTP Server 433 | # 434 | CONFIG_HTTPD_MAX_REQ_HDR_LEN=512 435 | CONFIG_HTTPD_MAX_URI_LEN=512 436 | 437 | # 438 | # Ethernet 439 | # 440 | CONFIG_DMA_RX_BUF_NUM=10 441 | CONFIG_DMA_TX_BUF_NUM=10 442 | CONFIG_EMAC_L2_TO_L3_RX_BUF_MODE=y 443 | CONFIG_EMAC_CHECK_LINK_PERIOD_MS=2000 444 | CONFIG_EMAC_TASK_PRIORITY=20 445 | CONFIG_EMAC_TASK_STACK_SIZE=3072 446 | 447 | # 448 | # FAT Filesystem support 449 | # 450 | CONFIG_FATFS_CODEPAGE_DYNAMIC= 451 | CONFIG_FATFS_CODEPAGE_437= 452 | CONFIG_FATFS_CODEPAGE_720= 453 | CONFIG_FATFS_CODEPAGE_737= 454 | CONFIG_FATFS_CODEPAGE_771= 455 | CONFIG_FATFS_CODEPAGE_775= 456 | CONFIG_FATFS_CODEPAGE_850=y 457 | CONFIG_FATFS_CODEPAGE_852= 458 | CONFIG_FATFS_CODEPAGE_855= 459 | CONFIG_FATFS_CODEPAGE_857= 460 | CONFIG_FATFS_CODEPAGE_860= 461 | CONFIG_FATFS_CODEPAGE_861= 462 | CONFIG_FATFS_CODEPAGE_862= 463 | CONFIG_FATFS_CODEPAGE_863= 464 | CONFIG_FATFS_CODEPAGE_864= 465 | CONFIG_FATFS_CODEPAGE_865= 466 | CONFIG_FATFS_CODEPAGE_866= 467 | CONFIG_FATFS_CODEPAGE_869= 468 | CONFIG_FATFS_CODEPAGE_932= 469 | CONFIG_FATFS_CODEPAGE_936= 470 | CONFIG_FATFS_CODEPAGE_949= 471 | CONFIG_FATFS_CODEPAGE_950= 472 | CONFIG_FATFS_CODEPAGE=850 473 | CONFIG_FATFS_LFN_NONE= 474 | CONFIG_FATFS_LFN_HEAP= 475 | CONFIG_FATFS_LFN_STACK=y 476 | CONFIG_FATFS_MAX_LFN=255 477 | CONFIG_FATFS_API_ENCODING_ANSI_OEM=y 478 | CONFIG_FATFS_API_ENCODING_UTF_16= 479 | CONFIG_FATFS_API_ENCODING_UTF_8= 480 | CONFIG_FATFS_FS_LOCK=0 481 | CONFIG_FATFS_TIMEOUT_MS=10000 482 | CONFIG_FATFS_PER_FILE_CACHE=y 483 | CONFIG_FATFS_ALLOC_PREFER_EXTRAM=y 484 | 485 | # 486 | # Modbus configuration 487 | # 488 | CONFIG_MB_QUEUE_LENGTH=20 489 | CONFIG_MB_SERIAL_TASK_STACK_SIZE=2048 490 | CONFIG_MB_SERIAL_BUF_SIZE=256 491 | CONFIG_MB_SERIAL_TASK_PRIO=10 492 | CONFIG_MB_CONTROLLER_SLAVE_ID_SUPPORT= 493 | CONFIG_MB_CONTROLLER_NOTIFY_TIMEOUT=20 494 | CONFIG_MB_CONTROLLER_NOTIFY_QUEUE_SIZE=20 495 | CONFIG_MB_CONTROLLER_STACK_SIZE=4096 496 | CONFIG_MB_EVENT_QUEUE_TIMEOUT=20 497 | CONFIG_MB_TIMER_PORT_ENABLED=y 498 | CONFIG_MB_TIMER_GROUP=0 499 | CONFIG_MB_TIMER_INDEX=0 500 | 501 | # 502 | # FreeRTOS 503 | # 504 | CONFIG_FREERTOS_UNICORE= 505 | CONFIG_FREERTOS_NO_AFFINITY=0x7FFFFFFF 506 | CONFIG_FREERTOS_CORETIMER_0=y 507 | CONFIG_FREERTOS_CORETIMER_1= 508 | CONFIG_FREERTOS_HZ=1000 509 | CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION= 510 | CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE= 511 | CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL= 512 | CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY=y 513 | CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y 514 | CONFIG_FREERTOS_INTERRUPT_BACKTRACE=y 515 | CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1 516 | CONFIG_FREERTOS_ASSERT_FAIL_ABORT=y 517 | CONFIG_FREERTOS_ASSERT_FAIL_PRINT_CONTINUE= 518 | CONFIG_FREERTOS_ASSERT_DISABLE= 519 | CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=1024 520 | CONFIG_FREERTOS_ISR_STACKSIZE=1536 521 | CONFIG_FREERTOS_LEGACY_HOOKS= 522 | CONFIG_FREERTOS_MAX_TASK_NAME_LEN=16 523 | CONFIG_SUPPORT_STATIC_ALLOCATION= 524 | CONFIG_TIMER_TASK_PRIORITY=1 525 | CONFIG_TIMER_TASK_STACK_DEPTH=2048 526 | CONFIG_TIMER_QUEUE_LENGTH=10 527 | CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 528 | CONFIG_FREERTOS_USE_TRACE_FACILITY= 529 | CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS= 530 | CONFIG_FREERTOS_DEBUG_INTERNALS= 531 | CONFIG_FREERTOS_TASK_FUNCTION_WRAPPER=y 532 | 533 | # 534 | # Heap memory debugging 535 | # 536 | CONFIG_HEAP_POISONING_DISABLED= 537 | CONFIG_HEAP_POISONING_LIGHT=y 538 | CONFIG_HEAP_POISONING_COMPREHENSIVE= 539 | CONFIG_HEAP_TRACING= 540 | CONFIG_HEAP_TASK_TRACKING= 541 | 542 | # 543 | # libsodium 544 | # 545 | CONFIG_LIBSODIUM_USE_MBEDTLS_SHA=y 546 | 547 | # 548 | # Log output 549 | # 550 | CONFIG_LOG_DEFAULT_LEVEL_NONE= 551 | CONFIG_LOG_DEFAULT_LEVEL_ERROR=y 552 | CONFIG_LOG_DEFAULT_LEVEL_WARN= 553 | CONFIG_LOG_DEFAULT_LEVEL_INFO= 554 | CONFIG_LOG_DEFAULT_LEVEL_DEBUG= 555 | CONFIG_LOG_DEFAULT_LEVEL_VERBOSE= 556 | CONFIG_LOG_DEFAULT_LEVEL=1 557 | CONFIG_LOG_COLORS= 558 | 559 | # 560 | # LWIP 561 | # 562 | CONFIG_L2_TO_L3_COPY= 563 | CONFIG_LWIP_IRAM_OPTIMIZATION= 564 | CONFIG_LWIP_MAX_SOCKETS=10 565 | CONFIG_USE_ONLY_LWIP_SELECT= 566 | CONFIG_LWIP_SO_REUSE=y 567 | CONFIG_LWIP_SO_REUSE_RXTOALL=y 568 | CONFIG_LWIP_SO_RCVBUF=y 569 | CONFIG_LWIP_DHCP_MAX_NTP_SERVERS=1 570 | CONFIG_LWIP_IP_FRAG= 571 | CONFIG_LWIP_IP_REASSEMBLY= 572 | CONFIG_LWIP_STATS= 573 | CONFIG_LWIP_ETHARP_TRUST_IP_MAC=y 574 | CONFIG_ESP_GRATUITOUS_ARP=y 575 | CONFIG_GARP_TMR_INTERVAL=60 576 | CONFIG_TCPIP_RECVMBOX_SIZE=32 577 | CONFIG_LWIP_DHCP_DOES_ARP_CHECK= 578 | CONFIG_LWIP_DHCP_RESTORE_LAST_IP=y 579 | 580 | # 581 | # DHCP server 582 | # 583 | CONFIG_LWIP_DHCPS_LEASE_UNIT=60 584 | CONFIG_LWIP_DHCPS_MAX_STATION_NUM=8 585 | CONFIG_LWIP_AUTOIP= 586 | CONFIG_LWIP_NETIF_LOOPBACK=y 587 | CONFIG_LWIP_LOOPBACK_MAX_PBUFS=8 588 | 589 | # 590 | # TCP 591 | # 592 | CONFIG_LWIP_MAX_ACTIVE_TCP=16 593 | CONFIG_LWIP_MAX_LISTENING_TCP=16 594 | CONFIG_TCP_MAXRTX=12 595 | CONFIG_TCP_SYNMAXRTX=6 596 | CONFIG_TCP_MSS=1436 597 | CONFIG_TCP_MSL=60000 598 | CONFIG_TCP_SND_BUF_DEFAULT=5744 599 | CONFIG_TCP_WND_DEFAULT=5744 600 | CONFIG_TCP_RECVMBOX_SIZE=6 601 | CONFIG_TCP_QUEUE_OOSEQ=y 602 | CONFIG_ESP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES= 603 | CONFIG_TCP_OVERSIZE_MSS=y 604 | CONFIG_TCP_OVERSIZE_QUARTER_MSS= 605 | CONFIG_TCP_OVERSIZE_DISABLE= 606 | 607 | # 608 | # UDP 609 | # 610 | CONFIG_LWIP_MAX_UDP_PCBS=16 611 | CONFIG_UDP_RECVMBOX_SIZE=6 612 | CONFIG_TCPIP_TASK_STACK_SIZE=2560 613 | CONFIG_TCPIP_TASK_AFFINITY_NO_AFFINITY= 614 | CONFIG_TCPIP_TASK_AFFINITY_CPU0=y 615 | CONFIG_TCPIP_TASK_AFFINITY_CPU1= 616 | CONFIG_TCPIP_TASK_AFFINITY=0x0 617 | CONFIG_PPP_SUPPORT=y 618 | CONFIG_PPP_PAP_SUPPORT=y 619 | CONFIG_PPP_CHAP_SUPPORT=y 620 | CONFIG_PPP_MSCHAP_SUPPORT=y 621 | CONFIG_PPP_MPPE_SUPPORT=y 622 | CONFIG_PPP_DEBUG_ON= 623 | 624 | # 625 | # ICMP 626 | # 627 | CONFIG_LWIP_MULTICAST_PING= 628 | CONFIG_LWIP_BROADCAST_PING= 629 | 630 | # 631 | # LWIP RAW API 632 | # 633 | CONFIG_LWIP_MAX_RAW_PCBS=16 634 | 635 | # 636 | # mbedTLS 637 | # 638 | CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y 639 | CONFIG_MBEDTLS_EXTERNAL_MEM_ALLOC= 640 | CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC= 641 | CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC= 642 | CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN=16384 643 | CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN= 644 | CONFIG_MBEDTLS_DEBUG= 645 | CONFIG_MBEDTLS_HARDWARE_AES=y 646 | CONFIG_MBEDTLS_HARDWARE_MPI= 647 | CONFIG_MBEDTLS_HARDWARE_SHA= 648 | CONFIG_MBEDTLS_HAVE_TIME=y 649 | CONFIG_MBEDTLS_HAVE_TIME_DATE= 650 | CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT=y 651 | CONFIG_MBEDTLS_TLS_SERVER_ONLY= 652 | CONFIG_MBEDTLS_TLS_CLIENT_ONLY= 653 | CONFIG_MBEDTLS_TLS_DISABLED= 654 | CONFIG_MBEDTLS_TLS_SERVER=y 655 | CONFIG_MBEDTLS_TLS_CLIENT=y 656 | CONFIG_MBEDTLS_TLS_ENABLED=y 657 | 658 | # 659 | # TLS Key Exchange Methods 660 | # 661 | CONFIG_MBEDTLS_PSK_MODES=y 662 | CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y 663 | CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_PSK=y 664 | CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_PSK=y 665 | CONFIG_MBEDTLS_KEY_EXCHANGE_RSA_PSK=y 666 | CONFIG_MBEDTLS_KEY_EXCHANGE_RSA=y 667 | CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_RSA=y 668 | CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE=y 669 | CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA=y 670 | CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA=y 671 | CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA=y 672 | CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA=y 673 | CONFIG_MBEDTLS_SSL_RENEGOTIATION=y 674 | CONFIG_MBEDTLS_SSL_PROTO_SSL3= 675 | CONFIG_MBEDTLS_SSL_PROTO_TLS1=y 676 | CONFIG_MBEDTLS_SSL_PROTO_TLS1_1=y 677 | CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=y 678 | CONFIG_MBEDTLS_SSL_PROTO_DTLS= 679 | CONFIG_MBEDTLS_SSL_ALPN=y 680 | CONFIG_MBEDTLS_SSL_SESSION_TICKETS=y 681 | 682 | # 683 | # Symmetric Ciphers 684 | # 685 | CONFIG_MBEDTLS_AES_C=y 686 | CONFIG_MBEDTLS_CAMELLIA_C= 687 | CONFIG_MBEDTLS_DES_C= 688 | CONFIG_MBEDTLS_RC4_DISABLED=y 689 | CONFIG_MBEDTLS_RC4_ENABLED_NO_DEFAULT= 690 | CONFIG_MBEDTLS_RC4_ENABLED= 691 | CONFIG_MBEDTLS_BLOWFISH_C= 692 | CONFIG_MBEDTLS_XTEA_C= 693 | CONFIG_MBEDTLS_CCM_C=y 694 | CONFIG_MBEDTLS_GCM_C=y 695 | CONFIG_MBEDTLS_RIPEMD160_C= 696 | 697 | # 698 | # Certificates 699 | # 700 | CONFIG_MBEDTLS_PEM_PARSE_C=y 701 | CONFIG_MBEDTLS_PEM_WRITE_C=y 702 | CONFIG_MBEDTLS_X509_CRL_PARSE_C=y 703 | CONFIG_MBEDTLS_X509_CSR_PARSE_C=y 704 | CONFIG_MBEDTLS_ECP_C=y 705 | CONFIG_MBEDTLS_ECDH_C=y 706 | CONFIG_MBEDTLS_ECDSA_C=y 707 | CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED=y 708 | CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED=y 709 | CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y 710 | CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED=y 711 | CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED=y 712 | CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED=y 713 | CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED=y 714 | CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED=y 715 | CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED=y 716 | CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED=y 717 | CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED=y 718 | CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED=y 719 | CONFIG_MBEDTLS_ECP_NIST_OPTIM=y 720 | 721 | # 722 | # mDNS 723 | # 724 | CONFIG_MDNS_MAX_SERVICES=10 725 | 726 | # 727 | # ESP-MQTT Configurations 728 | # 729 | CONFIG_MQTT_PROTOCOL_311=y 730 | CONFIG_MQTT_TRANSPORT_SSL=y 731 | CONFIG_MQTT_TRANSPORT_WEBSOCKET=y 732 | CONFIG_MQTT_TRANSPORT_WEBSOCKET_SECURE=y 733 | CONFIG_MQTT_USE_CUSTOM_CONFIG= 734 | CONFIG_MQTT_TASK_CORE_SELECTION_ENABLED= 735 | CONFIG_MQTT_CUSTOM_OUTBOX= 736 | 737 | # 738 | # NVS 739 | # 740 | 741 | # 742 | # OpenSSL 743 | # 744 | CONFIG_OPENSSL_DEBUG= 745 | CONFIG_OPENSSL_ASSERT_DO_NOTHING=y 746 | CONFIG_OPENSSL_ASSERT_EXIT= 747 | 748 | # 749 | # PThreads 750 | # 751 | CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT=5 752 | CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT=2048 753 | CONFIG_PTHREAD_STACK_MIN=768 754 | CONFIG_ESP32_DEFAULT_PTHREAD_CORE_NO_AFFINITY=y 755 | CONFIG_ESP32_DEFAULT_PTHREAD_CORE_0= 756 | CONFIG_ESP32_DEFAULT_PTHREAD_CORE_1= 757 | CONFIG_ESP32_PTHREAD_TASK_CORE_DEFAULT=-1 758 | CONFIG_ESP32_PTHREAD_TASK_NAME_DEFAULT="pthread" 759 | 760 | # 761 | # SPI Flash driver 762 | # 763 | CONFIG_SPI_FLASH_VERIFY_WRITE= 764 | CONFIG_SPI_FLASH_ENABLE_COUNTERS= 765 | CONFIG_SPI_FLASH_ROM_DRIVER_PATCH=y 766 | CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS=y 767 | CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_FAILS= 768 | CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED= 769 | 770 | # 771 | # SPIFFS Configuration 772 | # 773 | CONFIG_SPIFFS_MAX_PARTITIONS=3 774 | 775 | # 776 | # SPIFFS Cache Configuration 777 | # 778 | CONFIG_SPIFFS_CACHE=y 779 | CONFIG_SPIFFS_CACHE_WR=y 780 | CONFIG_SPIFFS_CACHE_STATS= 781 | CONFIG_SPIFFS_PAGE_CHECK=y 782 | CONFIG_SPIFFS_GC_MAX_RUNS=10 783 | CONFIG_SPIFFS_GC_STATS= 784 | CONFIG_SPIFFS_PAGE_SIZE=256 785 | CONFIG_SPIFFS_OBJ_NAME_LEN=32 786 | CONFIG_SPIFFS_USE_MAGIC=y 787 | CONFIG_SPIFFS_USE_MAGIC_LENGTH=y 788 | CONFIG_SPIFFS_META_LENGTH=4 789 | CONFIG_SPIFFS_USE_MTIME=y 790 | 791 | # 792 | # Debug Configuration 793 | # 794 | CONFIG_SPIFFS_DBG= 795 | CONFIG_SPIFFS_API_DBG= 796 | CONFIG_SPIFFS_GC_DBG= 797 | CONFIG_SPIFFS_CACHE_DBG= 798 | CONFIG_SPIFFS_CHECK_DBG= 799 | CONFIG_SPIFFS_TEST_VISUALISATION= 800 | 801 | # 802 | # TCP/IP Adapter 803 | # 804 | CONFIG_IP_LOST_TIMER_INTERVAL=120 805 | CONFIG_TCPIP_LWIP=y 806 | 807 | # 808 | # Unity unit testing library 809 | # 810 | CONFIG_UNITY_ENABLE_FLOAT=y 811 | CONFIG_UNITY_ENABLE_DOUBLE=y 812 | CONFIG_UNITY_ENABLE_COLOR= 813 | CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=y 814 | CONFIG_UNITY_ENABLE_FIXTURE= 815 | 816 | # 817 | # Virtual file system 818 | # 819 | CONFIG_SUPPRESS_SELECT_DEBUG_OUTPUT=y 820 | CONFIG_SUPPORT_TERMIOS=y 821 | 822 | # 823 | # Wear Levelling 824 | # 825 | CONFIG_WL_SECTOR_SIZE_512= 826 | CONFIG_WL_SECTOR_SIZE_4096=y 827 | CONFIG_WL_SECTOR_SIZE=4096 828 | --------------------------------------------------------------------------------