Mongoose OS in ESP32, is posible to enable BlueTooth and WiFi at the same time?

If you are asking a question, please follow this template:

  1. My goal is: [describe your goal]
    Goal, enable bluetooth and wifi at the same time using Mongoose OS and the ESP32
  2. My actions are: [describe your actions - code, commands, etc]
    I have tested bluetooth with a scanner running in the ESP32 then, after that i set up wifi using the console “mos wifi xxxx yyyy” and the bluetooh section is not working any more
  3. The result I see is: [show the result - log, etc]
[Feb 28 11:03:20.284] mgos_freertos.c:175     2app2 1.0 (20200228-153718/2.13.0-ge44f822-dirty)
[Feb 28 11:03:20.284] mgos_freertos.c:177     Mongoose OS 2.17.0 (20200227-180831/2.17.0-gc31a745)
[Feb 28 11:03:20.284] mgos_freertos.c:181     CPU: 160 MHz, FreeRTOS 8.2.0, heap: 217696 total, 185556 free
[Feb 28 11:03:20.292] mgos_freertos.c:183     Newlib 2.2.0
[Feb 28 11:03:20.292] esp32_main.c:116        ESP-IDF v3.3-r2
[Feb 28 11:03:20.297] esp32_main.c:119        Boot partition: app_0; flash: 4M
[Feb 28 11:03:20.302] mg_lwip_ev_mgr.c:77     Mongoose 6.16, LwIP 2.0.3
[Feb 28 11:03:20.306] mg_ssl_if_mbedtls.c:57  mbed TLS 2.16.3-cesanta9
[Feb 28 11:03:20.313] mgos_vfs_dev.c:73       fs_0: esp32part ({"label": "fs_0"}), size 262144
[Feb 28 11:03:20.320] mgos_vfs_dev.c:73       fs_1: esp32part ({"label": "fs_1"}), size 262144
[Feb 28 11:03:20.327] mgos_vfs.c:174          /: SPIFFS @ fs_0, opts {"bs":4096,"ps":256,"es":4096}
[Feb 28 11:03:20.413] mgos_vfs.c:347          /: size 233681, used: 133783, free: 99898
[Feb 28 11:03:20.494] mgos_sys_config.c:232   Loading conf9.json
[Feb 28 11:03:20.503] mgos_sys_config.c:366   MAC: d8:a0:1d:41:c6:64
[Feb 28 11:03:20.507] mgos_sys_config.c:374   WDT: 30 seconds
[Feb 28 11:03:20.513] esp32_bt.c:114          Bluetooth is disabled
[Feb 28 11:03:20.518] mgos_ota_shadow_lib:116 OTA over shadow initialised
[Feb 28 11:03:20.527] mgos_wifi.c:88          WiFi STA: Using config 0 (FibraETBB260)
[Feb 28 11:03:20.527] mgos_wifi.c:468         WiFi mode: STA
[Feb 28 11:03:20.531] esp32_wifi.c:196        WiFi mode: STA
[Feb 28 11:03:20.539] I (586) wifi: wifi driver task: 3ffc76a8, prio:23, stack:3584, core=0
[Feb 28 11:03:20.549] I (596) wifi: wifi firmware version: aeed694
[Feb 28 11:03:20.557] I (596) wifi: config NVS flash: enabled
[Feb 28 11:03:20.557] I (596) wifi: config nano formating: disabled
[Feb 28 11:03:20.561] I (606) wifi: Init dynamic tx buffer num: 32
[Feb 28 11:03:20.566] I (606) wifi: Init data frame dynamic rx buffer num: 64
[Feb 28 11:03:20.571] I (616) wifi: Init management frame dynamic rx buffer num: 64
[Feb 28 11:03:20.576] I (616) wifi: Init management short buffer num: 32
[Feb 28 11:03:20.580] I (626) wifi: Init static rx buffer size: 1600
[Feb 28 11:03:20.584] I (626) wifi: Init static rx buffer num: 10
[Feb 28 11:03:20.588] I (636) wifi: Init dynamic rx buffer num: 0
[Feb 28 11:03:20.678] I (716) phy: phy_version: 4102, 2fa7a43, Jul 15 2019, 13:06:06, 0, 0
[Feb 28 11:03:20.678] I (716) wifi: mode : sta (d8:a0:1d:41:c6:64)
[Feb 28 11:03:20.687] I (726) wifi: Set ps type: 0
[Feb 28 11:03:20.687] 
[Feb 28 11:03:20.687] esp32_wifi.c:635        WiFi STA: protocol BGN (0x7)
[Feb 28 11:03:20.690] I (736) wpa: WPA2: already disabled
[Feb 28 11:03:20.695] mgos_wifi.c:270         WiFi STA: Connecting to FibraETBB260
[Feb 28 11:03:20.701] mgos_http_server.c:343  HTTP server started on [80]
[Feb 28 11:03:20.710] mgos_provision_btn.c:75 Factory reset button: pin 0, pull up, hold_ms 0 (hold on boot)
[Feb 28 11:03:20.725] mgos_provision_stat:119 Max state: 2
[Feb 28 11:03:20.730] mgos_rpc_channel_mq:203 0x3ffb4cc4 esp32_41C664/rpc
[Feb 28 11:03:20.731]  mgos_rpc_channel_ua:313 0x3ffb5124 UART0
[Feb 28 11:03:20.744] E (786) GATTC_DEMO: mgos_app_init initialize controller failed: ESP_ERR_INVALID_STATE
[Feb 28 11:03:20.744] 
[Feb 28 11:03:20.752] E (796) GATTC_DEMO: mgos_app_init enable controller failed: ESP_ERR_INVALID_STATE
[Feb 28 11:03:20.752] 
[Feb 28 11:03:20.760] E (796) GATTC_DEMO: mgos_app_init init bluetooth failed: ESP_ERR_INVALID_STATE
[Feb 28 11:03:20.760] 
[Feb 28 11:03:20.769] E (806) GATTC_DEMO: mgos_app_init enable bluetooth failed: ESP_ERR_INVALID_STATE
[Feb 28 11:03:20.769] 
[Feb 28 11:03:20.776] E (816) GATTC_DEMO: mgos_app_init gap register failed, error code = 103
[Feb 28 11:03:20.776] 
[Feb 28 11:03:20.784] E (826) GATTC_DEMO: mgos_app_init gattc register failed, error code = 103
[Feb 28 11:03:20.784] 
[Feb 28 11:03:20.792] E (836) GATTC_DEMO: mgos_app_init gattc app register failed, error code = 103
[Feb 28 11:03:20.792] 
[Feb 28 11:03:20.807] E (836) GATTC_DEMO: set local  MTU failed, error code = 103
[Feb 28 11:03:20.807] I (846) GATTC_DEMO: adv data: last
[Feb 28 11:03:20.807] I (846) GATTC_DEMO: adv data: last not YET
[Feb 28 11:03:20.814] mgos_init.c:36          Init done, RAM: 257416 total, 195424 free, 189132 min free
[Feb 28 11:03:20.943] I (986) wifi: new:<2,0>, old:<1,0>, ap:<255,255>, sta:<2,0>, prof:1
[Feb 28 11:03:21.792] I (1836) wifi: state: init -> auth (b0)
[Feb 28 11:03:21.798] I (1846) wifi: state: auth -> assoc (0)
[Feb 28 11:03:21.811] I (1856) wifi: state: assoc -> run (10)
[Feb 28 11:03:21.835] I (1876) wifi: connected with FibraETBB260, channel 2, HT20, bssid = 14:60:80:cd:b2:60
[Feb 28 11:03:21.838] I (1886) wifi: pm start, type: 0
[Feb 28 11:03:21.838] 
[Feb 28 11:03:22.053] LED on -> false 
[Feb 28 11:03:22.110] mgos_mongoose.c:66      New heap free LWM: 155844
[Feb 28 11:03:22.116] mgos_ota_core.c:1318    UID: 0fcb37ad255e6f7b, license: none
[Feb 28 11:03:22.124] mgos_wifi.c:136         WiFi STA: Connected, BSSID 14:60:80:cd:b2:60 ch 2 RSSI -65
[Feb 28 11:03:22.128] mgos_net.c:86           WiFi STA: connecting
[Feb 28 11:03:22.132] mgos_provision_state:43 Current state: 0 -> 1
[Feb 28 11:03:22.136] mgos_net.c:90           WiFi STA: connected
[Feb 28 11:03:25.184] I (5226) event: sta ip: 192.168.0.8, mask: 255.255.255.0, gw: 192.168.0.1
[Feb 28 11:03:25.193] mgos_net.c:102          WiFi STA: ready, IP 192.168.0.8, GW 192.168.0.1, DNS 192.168.0.1
[Feb 28 11:03:25.197] mgos_provision_state:43 Current state: 1 -> 2
[Feb 28 11:03:26.175] mgos_sntp.c:95          SNTP query to time.google.com
[Feb 28 11:03:26.281] mgos_sntp.c:59          SNTP reply from 216.239.35.4: time 1582905806.926601, local 1582905806.718603, delta 0.207998

here in the logs you can see we got IP SNTP etc… but some the BT was not working…

  1. My expectation & question is: [describe your expectation and your question]

I think that could be fix modifing a .c dile inside the folder “deps” allowing to work BT and WIFI at the same time, i have been just lookong where but not yet found a clue where i have to chance it… please let me know i you have face this situation…

regards

Juan

It looks like you are not using Mongoose OS’s bluetooth, but you can try to set

  - ["bt.keep_enabled", true]

in your mos.yml (if bt-common is included)

PS. I don’t use BT.