continuous_streaming

Example of the component carlos-lorenzo/ads1299 v0.1.6
# ADS1299 Continuous Streaming Example

This example demonstrates how to perform continuous, high-speed data acquisition from the ADS1299 and stream the raw samples as binary frames over the ESP32's native USB Serial/JTAG interface.

## How It Works

To achieve high throughput without dropping samples, the application utilizes a dual-core architecture and Inter-Process Communication (IPC):

1. **Acquisition (Core 0):** The ADS1299 driver continuously reads data via SPI. When a chunk of samples is ready, it is wrapped in a custom binary header, checksummed, and pushed to a FreeRTOS ring buffer.
2. **Telemetry Streaming (Core 1):** A dedicated task constantly drains the ring buffer and writes the raw bytes directly to the USB hardware FIFO.

Standard ESP-IDF logging is silenced during execution to prevent ASCII log text from corrupting the raw binary stream.

### Binary Frame Format

Data is streamed out of the ESP32 in discrete binary packets. If you are writing a PC-side script (e.g., in Python) to read this data, parse the incoming byte stream using the following structure:

*   **Header (8 bytes)**
    *   `Sync 0`: `0xAA` (1 byte)
    *   `Sync 1`: `0x55` (1 byte)
    *   `Length`: Payload length in bytes (uint16_t, little-endian)
    *   `Sequence`: Monotonically increasing chunk number (uint32_t, little-endian)
*   **Payload (Variable)**
    *   An array of raw `ads1299_sample_t` structs matching the `Length` specified in the header.
*   **Checksum (1 byte)**
    *   A simple XOR checksum of all bytes within the **Payload** section.

## Quick Start

The hardware setup requires standard SPI connections (MISO, MOSI, SCLK) alongside ADS1299 control pins (CS1, DRDY, START, RESET) and power management (ANPWREN). Ensure your ESP32 target matches the definitions at the top of `main.cpp`.

To run the example, navigate to this directory and build the project:

```console
idf.py set-target esp32s3
idf.py build flash

To create a project from this example, run:

idf.py create-project-from-example "carlos-lorenzo/ads1299=0.1.6:continuous_streaming"

or download archive (~5.13 KB)