While studying Bluetooth (BLE) I found myself getting stuck. I couldn't follow the documentation and was getting errors I couldn't understand. I did some digging and found that the ESP32 Bluetooth stack is built on top of an existent bluetooth stack called "Bluedroid". That then took me into the world of Bluedroid (still swimming and looking around there) ... however very quickly I found that Bluedroid provides additional diagnostics that can be compiled (or enabled) into the environment. One way to achieve this is to edit the "component.mk" file found in the <ESP-IDF>/components/bt directory. This is the control file that describes how the bluetooth stack is compiled. If we then add the following:
Code: Select all
CFLAGS+= -DGATT_INITIAL_TRACE_LEVEL=6 \
-DSMP_INITIAL_TRACE_LEVEL=6 \
-DAPPL_INITIAL_TRACE_LEVEL=6 \
-DHID_INITIAL_TRACE_LEVEL=6 \
-DMCA_INITIAL_TRACE_LEVEL=6 \
-DAVRC_INITIAL_TRACE_LEVEL=6 \
-DAVCT_INITIAL_TRACE_LEVEL=6 \
-DAVDT_INITIAL_TRACE_LEVEL=6 \
-DA2D_INITIAL_TRACE_LEVEL=6 \
-DPAN_INITIAL_TRACE_LEVEL=6 \
-DBNEP_INITIAL_TRACE_LEVEL=6 \
-DGAP_INITIAL_TRACE_LEVEL=6 \
-DSDP_INITIAL_TRACE_LEVEL=6 \
-DRFCOMM_INITIAL_TRACE_LEVEL=6 \
-DL2CAP_INITIAL_TRACE_LEVEL=6 \
-DBTM_INITIAL_TRACE_LEVEL=6 \
-DHCI_INITIAL_TRACE_LEVEL=6 \
-DRFCOMM_INITIAL_TRACE_LEVEL=6 \
-DL2CAP_INITIAL_TRACE_LEVEL=6 \
-DBTM_INITIAL_TRACE_LEVEL=6
and re-build, we will find that trace is enabled and we get a ton of new diagnostics from the insides of the Bluetooth stack. I'm still studying "what this means" ... but I wanted to share in case it is of use to others as we make progress in understanding what we have here.