I tried running OMG on ESP32-C3. Board is a Lolin C3 mini v2.1.0. I thought it would be nice to document the changes I needed to make for other users who might want to try the same. I also ran into a problem with, I believe, the watchdog. I would appreciate to hear if there is any advice, or if OMG simply can’t run on this board.
Changes needed. I compile the lastest version, git hash is03c83fb69c2bd9a36d043b323f1008d6802c961b. I used the env:esp32c3-dev-m1-ble environment definition in environments.ini and altered it as follows:
$ git diff
diff --git a/environments.ini b/environments.ini
index e2656304..d5819bda 100644
--- a/environments.ini
+++ b/environments.ini
@@ -1462,9 +1462,9 @@ build_flags =
'-DGateway_Name="OpenMQTTGateway_ESP32_BLE"'
custom_description = BLE gateway on the S3
-[env:esp32c3-dev-m1-ble]
+[env:lolin_c3_mini]
platform = ${com.esp32_c3_s3_platform}
-board = esp32-c3-devkitm-1
+board = lolin_c3_mini
board_build.partitions = min_spiffs.csv
lib_deps =
${com-esp.lib_deps}
@@ -1479,6 +1479,8 @@ build_flags =
'-DFASTLED_IND_TYPE=NEOPIXEL'
'-DFASTLED_IND_NUM_LEDS=1'
'-DRGB_INDICATORS=true'
+ '-DCONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=true'
+ '-DCONFIG_ESP_CONSOLE_UART=ESP_CONSOLE_USB_SERIAL_JTAG'
'-DNO_INT_TEMP_READING=true' ; Internal temperature reading not building on ESP32 C3 or S3
'-DGateway_Name="OpenMQTTGateway_ESP32_BLE"'
custom_description = BLE gateway on the C3
The first change is to select the right board, the additional build flags are to enable serial console debugging on the USB-C port.
I build and upload using pio run -e lolin_c3_mini -t upload --upload-port /dev/ttyACM3
. Why does the serial output say “Build:Feb 7 2021”?
Upon boot, OMG starts and reports BLE values on MQTT. Uptime is a few seconds. It then is killed (by the watchdog?) and reboots.
16:24:15.201 > ESP-ROM:esp32c3-api1-20210207
16:24:15.201 > Build:Feb 7 2021
16:24:15.201 > rst:0x3 (RTC_SW_SYS_RST),boot:0xd (SPI_FAST_FLASH_BOOT)
16:24:15.201 > Saved PC:0x40381e1c
16:24:15.202 > SPIWP:0xee
16:24:15.203 > mode:DIO, clock div:1
16:24:15.205 > load:0x3fcd6100,len:0x438
16:24:15.208 > load:0x403ce000,len:0x918
16:24:15.210 > load:0x403d0000,len:0x24e4
16:24:15.215 > entry 0x403ce000
16:24:15.445 > N:
16:24:15.445 > ************* WELCOME TO OpenMQTTGateway **************
16:24:15.446 > [ 246][E][esp32-hal-gpio.c:102] __pinMode(): Invalid pin selected
16:24:15.447 > E (253) gpio: gpio_set_level(226): GPIO output gpio_num error
16:24:15.447 > N: OpenMQTTGateway Version: version_tag
16:24:15.500 > {
16:24:15.501 > "mqtt_server": "192.168.1.XX",
16:24:15.501 > "mqtt_port": "1883",
16:24:15.501 > "mqtt_user": "",
16:24:15.501 > "mqtt_pass": "",
16:24:15.502 > "mqtt_topic": "home/",
16:24:15.502 > "gateway_name": "OpenMQTTGateway",
16:24:15.502 > "mqtt_broker_secure": false,
16:24:15.503 > "mqtt_broker_cert": "",
16:24:15.503 > "mqtt_ss_index": 0,
16:24:15.504 > "ota_server_cert": "",
16:24:15.504 > "ota_pass": "OTAPASSWORD"
16:24:15.504 > }*wm:[2] Added Parameter: server
16:24:15.505 > *wm:[2] Added Parameter: port
16:24:15.505 > *wm:[2] Added Parameter: user
16:24:15.505 > *wm:[2] Added Parameter: pass
16:24:15.505 > *wm:[2] Added Parameter: secure
16:24:15.505 > *wm:[2] Added Parameter: cert
16:24:15.505 > *wm:[2] Added Parameter: name
16:24:15.505 > *wm:[2] Added Parameter: topic
16:24:15.506 > *wm:[2] Added Parameter: ota
16:24:15.506 > N: Attempting Wifi connection with saved AP: 0
16:24:15.588 > E (394) wifi:Association refused temporarily, comeback time 1024 mSec
16:24:16.013 > N: Attempting Wifi connection with saved AP: 1
16:24:16.016 > E (822) wifi:sta is connecting, return error
16:24:16.016 > [ 816][E][WiFiSTA.cpp:317] begin(): connect failed! 0x3007
16:24:16.516 > N: Attempting Wifi connection with saved AP: 2
16:24:16.519 > E (1325) wifi:sta is connecting, return error
16:24:16.519 > [ 1319][E][WiFiSTA.cpp:317] begin(): connect failed! 0x3007
16:24:17.019 > N: Attempting Wifi connection with saved AP: 3
16:24:17.022 > E (1828) wifi:sta is connecting, return error
16:24:17.022 > [ 1822][E][WiFiSTA.cpp:317] begin(): connect failed! 0x3007
16:24:17.522 > N: Attempting Wifi connection with saved AP: 4
16:24:17.525 > E (2331) wifi:sta is connecting, return error
16:24:17.525 > [ 2325][E][WiFiSTA.cpp:317] begin(): connect failed! 0x3007
16:24:18.028 > N: Connect your phone to WIFI AP: OpenMQTTGateway_ESP32_BLE with PWD: your_password
16:24:18.028 > *wm:[1] AutoConnect
16:24:18.028 > *wm:[2] ESP32 event handler enabled
16:24:18.029 > *wm:[1] AutoConnect: ESP Already Connected
16:24:18.029 > *wm:[2] setSTAConfig static ip not set, skipping
16:24:18.029 > *wm:[1] AutoConnect: SUCCESS
16:24:18.029 > *wm:[2] Connected in 1 ms
16:24:18.029 > *wm:[1] STA IP Address: 192.168.1.XX
16:24:19.545 > [ 4344][E][Preferences.cpp:483] getString(): nvs_get_str len fail: BTConfig NOT_FOUND
16:24:19.545 > N: BT config loaded
16:24:19.545 > N: BT sys: {
16:24:19.545 > "bleconnect": true,
16:24:19.545 > "interval": 55555,
16:24:19.546 > "activescan": true,
16:24:19.546 > "intervalcnct": 3600000,
16:24:19.546 > "onlysensors": false,
16:24:19.546 > "hasspresence": false,
16:24:19.547 > "presenceTopic": "presence/",
16:24:19.547 > "presenceUseBeaconUuid": false,
16:24:19.548 > "minrssi": -100,
16:24:19.548 > "extDecoderEnable": false,
16:24:19.548 > "extDecoderTopic": "undecoded",
16:24:19.548 > "filterConnectable": false,
16:24:19.549 > "pubadvdata": false,
16:24:19.549 > "pubBeaconUuidForTopic": false,
16:24:19.549 > "ignoreWBlist": false,
16:24:19.550 > "btqblck": 0,
16:24:19.550 > "btqsum": 0,
16:24:19.550 > "btqsnd": 0,
16:24:19.550 > "btqavg": 0
16:24:19.550 > }
16:24:19.551 > N: BT config loaded
16:24:19.551 > N: BLE scans interval: 55555
16:24:19.551 > N: BLE connects interval: 3600000
16:24:19.552 > N: Publishing only BLE sensors: false
16:24:19.552 > N: Active BLE scan: true
16:24:19.552 > N: minrssi: -100
16:24:19.553 > N: Low Power Mode: 0
16:24:19.559 > N: OpenMQTTGateway modules: ["BT"]
16:24:19.559 > N: ************** Setup OpenMQTTGateway end **************
16:24:19.568 > W: MQTT connection...
16:24:19.604 > N: Connected to broker
16:24:19.664 > N: Send on /SYStoMQTT msg {"uptime":4,"version":"version_tag","freemem":108588,"mqttport":"1883","mqttsecure":false,"freestack":4528,"rssi":-57,"SSID":"XXX","BSSID":"00:11:32:9D:20:95","ip":"192.168.1.XX","mac":"XXX","lowpowermode":0,"interval":55555,"intervalcnct":3600000,"scnct":0,"modules":["BT"]}
16:24:19.666 > N: Send on /BTtoMQTT msg {"bleconnect":true,"interval":55555,"activescan":true,"intervalcnct":3600000,"onlysensors":false,"hasspresence":false,"presenceTopic":"presence/","presenceUseBeaconUuid":false,"minrssi":-100,"extDe
coderEnable":false,"extDecoderTopic":"undecoded","filterConnectable":false,"pubadvdata":false,"pubBeaconUuidForTopic":false,"ignoreWBlist":false,"btqblck":0,"btqsum":0,"btqsnd":0,"btqavg":0}
16:24:19.673 > N: [ MQTT->OMG ]: {"white-list":["XXX","XXX","XXX","XXXX","XXX"]}
16:24:19.674 > N: Send on /BTtoMQTT msg {"bleconnect":true,"interval":55555,"activescan":true,"intervalcnct":3600000,"onlysensors":false,"hasspresence":false,"presenceTopic":"presence/","presenceUseBeaconUuid":false,"minrssi":-100,"extDe
coderEnable":false,"extDecoderTopic":"undecoded","filterConnectable":false,"pubadvdata":false,"pubBeaconUuidForTopic":false,"ignoreWBlist":false,"btqblck":0,"btqsum":0,"btqsnd":0,"btqavg":0}
16:24:20.560 > [ 5359][E][esp32-hal-misc.c:128] disableCore0WDT(): Failed to remove Core 0 IDLE task from WDT
16:24:20.560 > N: Scan begin
16:24:20.571 > N: Device detected: XXX
16:24:20.578 > N: Device detected: XXX
16:24:20.618 > N: Device detected: XXX
16:24:20.635 > N: Device detected: XXX
16:24:20.640 > N: Device detected: XXX
16:24:20.671 > N: Device detected: XXX
16:24:20.833 > N: Device detected: XXX
16:24:20.979 > N: Device detected: XXX
16:24:20.997 > N: Send on /BTtoMQTT/XXX msg {"id":"XXX","name":"ATC_XXX","rssi":-63,"brand":"Xiaomi","model":"LYWSD03MMC","model_id":"LYWSD03MMC_PVVX","tempc":12.88,"tempf":55.184,"hum":88.23,"batt":49,"volt":2.
642}
16:24:21.233 > N: Device detected: XXX
16:24:21.312 > N: Device detected: XXX
16:24:21.499 > N: Device detected: XXX
16:24:21.517 > N: Send on /BTtoMQTT/XXX msg {"id":"XXX","name":"ATC_XXX","rssi":-70,"brand":"Xiaomi","model":"LYWSD03MMC","model_id":"LYWSD03MMC_PVVX","tempc":16.83,"tempf":62.294,"hum":64.04,"batt":78,"volt":2.
91}
16:24:21.748 > N: Device detected: XXX
16:24:21.961 > N: Device detected: XXX
16:24:22.081 > N: Device detected: XXX
16:24:22.311 > N: Device detected: XXX
16:24:22.332 > N: Send on /BTtoMQTT/XXX msg {"id":"XXX","name":"ATC_XXX","rssi":-46,"brand":"Xiaomi","model":"LYWSD03MMC","model_id":"LYWSD03MMC_PVVX","tempc":20.69,"tempf":69.242,"hum":59.89,"batt":78,"volt":2.
746}
16:24:22.641 > N: Device detected: XXX
16:24:22.688 > N: Device detected: XXX
16:24:23.298 > N: Device detected: XXX
16:24:23.302 > N: Device detected: XXX
16:24:28.051 > N: Device detected: XXX
16:24:28.716 > N: Device detected: XXX
16:24:30.564 > N: Device detected: XXX
16:24:30.564 > N: Device detected: XXX
16:24:30.581 > N: Device detected: XXX
16:24:30.582 > N: Device detected: XXX
16:24:31.245 > ESP-ROM:esp32c3-api1-20210207
16:24:31.245 > Build:Feb 7 2021
16:24:31.246 > rst:0x3 (RTC_SW_SYS_RST),boot:0xd (SPI_FAST_FLASH_BOOT)
16:24:31.246 > Saved PC:0x40381e1c
16:24:31.247 > SPIWP:0xee
16:24:31.248 > mode:DIO, clock div:1
16:24:31.250 > load:0x3fcd6100,len:0x438
16:24:31.252 > load:0x403ce000,len:0x918
16:24:31.255 > load:0x403d0000,len:0x24e4
16:24:31.260 > entry 0x403ce000
16:24:31.490 > N:
16:24:31.490 > ************* WELCOME TO OpenMQTTGateway **************