mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-01 18:50:34 +03:00
Modular backend for the BLE log console rewrite:
- Frame parser with sync state machine and checksum auto-detection
(4 modes: XOR/Sum x Full/Header-only); handles incomplete frames
during re-sync search when previously synced
- Internal frame decoder (INIT_DONE, ENH_STAT, FLUSH, INFO)
- Data models: SourceCode, FrameByteCount, FunnelSnapshot, LossType
- Stats package with composition-root StatsAccumulator orchestrating:
- TransportMetrics (RX bytes, lifetime-average throughput)
- FirmwareLossTracker / FirmwareWrittenTracker (ENH_STAT deltas
with first-report absolute value initialization)
- SNGapTracker (sliding window reorder-tolerant SN gap detection)
- PeakBurstTracker (per-source sliding window burst density)
- TrafficSpikeDetector (wire utilization spike detection)
- Wall-clock burst tracker for non-timestamped sources (REDIR)
- Torn-read guard on ENH_STAT reports (baudrate-based plausibility)
with prev-state update on discard to prevent cascading drops
- Console-local metrics (TransportMetrics, PeakBurstTracker) preserved
across INIT_DONE resets; only ENH_STAT-coupled components reset
- UART transport with port validation and exclusive serial access
- Comprehensive test suite (17 test files, 223 tests)
BLE Log Console
Introduction
BLE Log Console is a Python utility for capturing and displaying BLE logs from UART DMA output, which is able to
- Output normal ASCII logs to console in runtime
- Capture binary BLE logs from UART DMA output in background
- Live status panel showing data transfer statistics
- Automatic detection of frame loss
It would provide users and developers with convenience using this tool when CONFIG_BLE_LOG_PRPH_UART_DMA is enabled for the purpose of capturing BLE logs.
Usage
cd <esp-idf-path>
. ./export.sh
cd tools/bt/ble_log_console
python ble_log_console.py --port <UART_PORT> [--output <OUTPUT_FILE>] [--baudrate <BAUD_RATE>]
Notes
Please check the baud rate of the UART port in menuconfig when CONFIG_BLE_LOG_PRPH_UART_DMA is enabled. It's recommended to set the baud rate to 921600 or higher to avoid BLE log frame loss.
Arguments
--port(mandatory): The UART port to connect to (e.g.,/dev/ttyUSB0on Linux orCOM3on Windows)--output(optional): Output filename for binary capture (default:uart_data.bin)--baudrate(optional): Baud rate for UART communication (default:115200)