|
logic-analyzer
|
Hardware-timed 8 bit parallel GPIO capture for the original ESP32, using the I2S0 peripheral's undocumented "camera" (LCD) mode + DMA - the same trick used by the esp32-camera driver and by the EUA/ESP32_LogicAnalyzer project (both credited below) to sample a parallel bus with zero CPU involvement per sample. More...
#include <capture_esp32_i2s.h>
Public Member Functions | |
| CaptureESP32I2S (int pinStart=19, int clkOutPin=32, int clkInPin=34) | |
| Default Constructor - uses GPIO19..GPIO26 as the 8 bit data bus. | |
| void | setDataPins (const int pins[8]) |
| Defines the 8 data pins individually if they are not contiguous. | |
| void | capture () override |
| starts the capturing of the data | |
| void | captureAll () override |
| Used to measure the speed - capture into memory w/o dump. | |
| float | frequencyMeasured () |
| Provides the measured capturing frequency (based on the last capture) | |
Public Member Functions inherited from logic_analyzer::AbstractCapture | |
| AbstractCapture () | |
| Default Constructor. | |
| ~AbstractCapture () | |
| Destructor. | |
| LogicAnalyzer & | logicAnalyzer () |
| Provides access to the LogicAnalyzer. | |
| virtual PinReader & | pinReader () |
| Provides access to the PinReader. | |
| virtual void | setStatus (Status status) |
| Sets the status. | |
Protected Member Functions | |
| void | setupOnce () |
| One-time GPIO/I2S peripheral setup. | |
| void | allocDma (uint32_t sampleCount) |
| (Re)allocates the DMA descriptor chain for the requested sample count | |
| void | freeDma () |
| void | enableSampleClock (uint32_t freqHz) |
| Drives the sample clock via LEDC PWM on clk_out_pin, looped back into clk_in_pin. | |
| void | start () |
| void | waitForResult () |
| void | dump () |
Protected Member Functions inherited from logic_analyzer::AbstractCapture | |
| virtual void | setLogicAnalyzer (LogicAnalyzer &la) |
Static Protected Member Functions | |
| static void | gpioSetupIn (int gpio, int sig) |
| static void | i2sConfReset () |
Protected Attributes | |
| int | data_pins [8] |
| int | clk_out_pin |
| int | clk_in_pin |
| uint32_t | n_samples = 0 |
| unsigned long | start_time = 0 |
| unsigned long | run_time_us = 0 |
| bool | is_setup = false |
| lldesc_t * | dma_desc = nullptr |
| uint8_t ** | dma_buf = nullptr |
| size_t | dma_desc_count = 0 |
Protected Attributes inherited from logic_analyzer::AbstractCapture | |
| LogicAnalyzer * | logic_analyzer_ptr = nullptr |
Static Protected Attributes | |
| static const size_t | desc_size = 2000 |
Hardware-timed 8 bit parallel GPIO capture for the original ESP32, using the I2S0 peripheral's undocumented "camera" (LCD) mode + DMA - the same trick used by the esp32-camera driver and by the EUA/ESP32_LogicAnalyzer project (both credited below) to sample a parallel bus with zero CPU involvement per sample.
Unlike the RP2040 PIO, the ESP32's I2S0 can only be driven by an external clock in this mode (I2S0.conf.rx_slave_mod = 1) - it does not sample on its own internal clock. So this class generates the sample clock itself with the LEDC PWM peripheral on clk_out_pin and expects it to be looped back with a jumper wire into clk_in_pin, which is configured as the I2S input clock. Default pins: clk_out=GPIO32 -> jumper -> clk_in=GPIO34.
Data pins default to GPIO19..GPIO26 (8 bits), matching START_PIN/PIN_COUNT in config_esp32.h.
This capture path does not support triggering (same limitation as PicoCapturePIO) - it always captures readCount samples starting immediately on arm.
Credit: register sequence adapted from https://github.com/EUA/ESP32_LogicAnalyzer (GPLv3) and https://github.com/igrr/esp32-cam-demo
|
inlineoverridevirtual |
starts the capturing of the data
Implements logic_analyzer::AbstractCapture.
|
inlineoverridevirtual |
Used to measure the speed - capture into memory w/o dump.
Implements logic_analyzer::AbstractCapture.