examples/peripherals/parlio/parlio_rx/logic_analyzer/README.md
| Supported Targets | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-H4 | ESP32-P4 |
|---|
(See the README.md file in the upper level 'examples' directory for more information about examples.)
This example demonstrates how to implement a logic analyzer via Parallel IO RX peripheral. The main implementation is extracted as esp_probe component for portability.
Parallel IO is a peripheral that can sample data on multiple GPIOs in parallel at a high rate, which in its basic form is exactly the functionality of a logic analyzer.
This example uses the "software delimiter mode" of the Parallel IO RX driver, so that the Parallel IO RX peripheral can be driven by the internal clock and keep sampling continuously.
Under the default configuration, this example will probe the signals on several GPIOs, meanwhile these GPIOs will generate some signals by GPIO driver. The probed raw data will be stored temporary on the heap. When the allocated heap is run out or the probing time expires, the probing will stop and output the stored raw data to the output stream.
PulseView for visualizing the captured signalRun idf.py menuconfig under this example director to configure the example.
The esp_probe component can probe either internal signals or external signals, choose this configuration to select:
"Select signal source": to select where the signals come from.
"Probing the internal signals": the signals come from the chip itself (i.e., internal). The output signals on the GPIO will be feed back to the Parallel IO RX via GPIO matrix. This example only simulates some signals by GPIO driver, you can also modify the example code to probe the signals that produced by other peripherals (like I2C, I2S, SPI, etc).
"Probing the External signals": the signals come from external source that connected to the probing GPIOs.
The esp_probe component support Flash or TCP stream to output the raw data, choose this configuration to select:
"Select ESP probe dump stream": to select the output stream
"Dump data into FLASH": the data will be dumped into the Flash, it requires you to allocate a FAT partition in the partition table. In this example, there is a storage partition for saving the probed raw data. Then we can use esptoolto read this partition on the host side. Normally we read the whole storage partition, because we don't know the exact start address that the raw data saved.
"Dump data to the host using TCP": the data will be dumped to the host directly via the TCP stream. Target should support connecting to the network via WiFi or Ethernet.
To change the probing GPIOs, modify the s_probe_gpio array in the logic_analyzer_example_main.c
If we choose to dump into flash, please make sure the data partition label we set in the menuconfig is same as what we set in the partition.csv
partition.csv file. Defaults to storage.If we choose to dump via TCP, please specify the WiFi or Ethernet configurations in the menu "Example Connection Configuration", and then specify the TCP server information in "ESP probe configurations > Select ESP probe dump stream" menu:
(If you're using TCP stream, please go to Step 3 first)
Build the project and flash it to the board, then run monitor tool to view serial output:
idf.py -p PORT build flash monitor
And then waiting until the main task finished
I (2625) main_task: Returned from app_main()
(To exit the serial monitor, type Ctrl-].)
See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects.
Before conversion, we need to know how many channels in the raw data. In this example, we probed 4 GPIOs that set in s_probe_gpio, so we need to specify the channel number for the conversion.
Exit the serial monitor and use esptool to read the flash partition to the host:
For the default partition in this example:
parttool.py -p <serial_port> -b 406800 -f partitions.csv read_partition -h -n storage --output probe_raw.dat
Convert the raw data into VCD format:
(Run the following command under the example directory)
python components/esp_probe/host/vcd_dumper.py -n 4 -i probe_raw.dat -o probe_vcd_data.vcd
-n: the channel number that probed-i: the the input raw data file-o: the output vcd file name (optional)Then you can get the VCD file on the host.
Note: This example converted the whole partition into VCD file for demonstration, you can also adopt some methods to extract the saved file in this partitions like:
/esp_probe/probe_raw.dat;Start the TCP server on the host:
(Run the following command under the example directory)
python components/esp_probe/host/tcp_server -n 4 -p 8888 -o probe_vcd_data.vcd
-n: the channel number that probed-p: the TCP port (default 8888)-o: the output vcd file name (optional)Then you can see the TCP server is on, log printed like:
TCP listening at 192.168.1.106:8888
Jump back to the Step 2 to flash and monitor the target
If the TCP client connected successfully, there will be data received, you can see the log like:
Client 192.168.1.183:49626 joined
data received 1440 bytes
data received 1440 bytes
data received 2880 bytes
...
Client 192.168.1.183:49626 left
Then you can get the VCD data on the host.
Open PulseView and import the file probe_vcd_data.vcd with Value Change Dump data option:
esp_probeStream mode will output the raw data via the output stream without storing. Stream mode can be selected by the helper macro ESP_PROBE_DEFAULT_STREAM_CONFIG (the probe GPIOs need to be set additionally).
Buffer mode store the raw data on the heap storage temporary before sending them. Buffer mode can be selected by the helper macro ESP_PROBE_DEFAULT_BUFFER_CONFIG (the probe GPIOs need to be set additionally).
Buffer Stream mode store the raw data on the heap storage temporary but the storage will be used as Ping-Pong buffer to send the data in the storage. Buffer Stream mode can be selected by the helper macro ESP_PROBE_DEFAULT_BUFFER_STREAM_CONFIG (the probe GPIOs need to be set additionally).
Currently esp_probe supports Flash and TCP stream.
Requires a built-in Flash or external Flash and a data partition in FAT format.
Advantages:
Disadvantages:
esptool to read the raw data from the partition and then dump it into VCD format additionally;Requires WiFi or Ethernet supported on the target and accessible network.
Advantages:
25MB/s on C6 with Buffer Mode, and 700+ KB/s with Stream mode without data dropped;Disadvantages:
Client 192.168.1.183:56208 left log).
Ctrl + C and wait for a while util the port is releasedFor any technical queries, please open an issue on GitHub. We will get back to you soon.