Record RF signal pulses from IN1/IN2 and replay them on OUT1/OUT2 using Deep Memory Acquisition/Generation
- Dual Channel Processing: Independent IN1→OUT1 and IN2→OUT2 signal recording/playback
- Deep Memory Mode: High-speed acquisition using Red Pitaya's DMA capabilities
- Split Trigger Mode: Isolated trigger handling for each channel
- Configurable Parameters: Flexible trigger levels, buffer sizes, and burst patterns
- Real-time Operation: Low-latency signal processing with threaded architecture
- Auto-start: Automatic startup on Red Pitaya boot
This application captures RF signal pulses from Red Pitaya's analog inputs (IN1/IN2) and immediately replays them on the corresponding outputs (OUT1/OUT2). It leverages Deep Memory Acquisition for high-speed recording and Deep Memory Generation for precise playback.
- Acquisition: Each channel independently monitors its input for trigger conditions
- Recording: When triggered, captures the signal using DMA for minimal latency
- Generation: Immediately replays the captured signal with configurable burst patterns
- Loop: Continues indefinitely until stopped
- Not compatible with Red Pitaya Web Interface simultaneously
- Requires proper termination of analog inputs/outputs (50 Ω)
- Resource intensive - dedicated real-time signal processing
- Any Red Pitaya device
- Properly terminated analog inputs/outputs (50 Ω impedance matching)
- OS: Red Pitaya Linux 2.07 or higher
- Build: Nightly Build 637 or higher
This application consumes significant system resources and cannot run simultaneously with the Red Pitaya Web Interface. The web interface will be severely slowed down or unresponsive.
Please make sure that Red Pitaya inputs and outputs are properly terminated (matched impedance). Failure to do so may lead to undefined behaviour of the Record and Playback application due to the ringing on the transmission line. Red Pitaya fast analog inputs have input impedance of 1 MΩ. The fast analog outputs have output impedace of 50 Ω.
- Connect to your Red Pitaya via SSH
- Clone the repository:
git clone https://github.com/RedPitaya/rec_and_play.git - Enable running scripts
chmod +x ./rec_and_play/setup.sh - Run setup:
cd rec_and_play && ./setup.sh - Reboot Red Pitaya
- Done! Application starts automatically on boot
# 1. Connect via SSH to your Red Pitaya
ssh root@rp-xxxxxx.local
# 2. Download and setup
cd /root
git clone https://github.com/RedPitaya/rec_and_play.git rap
cd rap
# 3. Make scripts executable and run setup
chmod +x setup.sh
./setup.sh
# 4. Reboot Red Pitaya
reboot# 1. Enable read-write mode
rw
# 2. Copy files to system directory
cp main.py /opt/redpitaya/bin/
cp config.ini /opt/redpitaya/bin/
# 3. Add to startup (optional)
echo "export PYTHONPATH=/opt/redpitaya/lib/python/:\$PYTHONPATH" >> /opt/redpitaya/sbin/startup.sh
echo "/opt/redpitaya/bin/main.py" >> /opt/redpitaya/sbin/startup.sh
# 4. Reboot
rebootDownload the repository to your computer and copy to Red Pitaya:
scp -r /path-to-downloaded-repository/rec_and_play root@rp-xxxxxx.local:/rootThe application uses /opt/redpitaya/bin/config.ini for all settings. Each channel (ADC/DAC) is configured independently.
| Parameter | Description | Values | Unit |
|---|---|---|---|
trigger_level |
Voltage threshold for triggering | -1.0 to 1.0 | Volts |
trigger_mode |
Trigger condition | CH1_PE, CH1_NE, CH2_PE, CH2_NE |
- |
buffer_time |
Recording duration | 1-30 | µs |
| Parameter | Description | Values | Unit |
|---|---|---|---|
signal_source |
Input channel to record | IN1, IN2 |
- |
count_burst |
Cycles per burst (NCYC) | ≥1 | count |
repetition |
Number of bursts (NOR) | ≥1 | count |
repetition_delay |
Delay between bursts | ≥ (buffer_time × count_burst + 1) | µs |
[ADC1]
; IN1 Trigger Level in volts
trigger_level=0.1
; Trigger source (Values: CH1_PE, CH1_NE)
trigger_mode=CH1_PE
; Record signal Buffer size in microseconds (min 1 µs)
buffer_time=20
[ADC2]
; IN2 Trigger Level in volts
trigger_level=0.1
; Trigger source (Values: CH2_PE, CH2_NE)
trigger_mode=CH2_PE
; Record signal Buffer size in microseconds (min 1 µs)
buffer_time=20
[DAC1]
; OUT1 Gen signal from source (IN1, IN2). Which input to use for recording data.
signal_source=IN1
; Number of signal repetitions without delays (NCYC - number of cycles/periods in a single burst).
count_burst=1
; Number of repetitions with delay (NOR - Number of Repetitions/Bursts). Each repetition includes `count_burst` (NCYC) recordings without delay.
repetition=3
; Delay between repetitions.
; If there is a "repetition" number of repetitions, then the minimum allowed delay must be no less than:
; buffer_time * count_burst + 1 µS
; Otherwise the signal may break. If there are no repetitions, the value is ignored
; For example. buffer_time = 20, count_burst=2. repetition_delay = 20 * 2 + 1 = 41 µS
repetition_delay=50
[DAC2]
; OUT2 Gen signal from source (IN1, IN2). Which input to use for recording data.
signal_source=IN2
; Number of signal repetitions without delays (NCYC - number of cycles/periods in a single burst).
count_burst=1
; Number of repetitions with delay (NOR - Number of Repetitions/Bursts). Each repetition includes `count_burst` (NCYC) recordings without delay.
repetition=3
; Delay between repetitions.
; If there is a "repetition" number of repetitions, then the minimum allowed delay must be no less than:
; buffer_time * count_burst + 1 µS
; Otherwise the signal may break. If there are no repetitions, the value is ignored
; For example. buffer_time = 20, count_burst=2. repetition_delay = 20 * 2 + 1 = 41 µS
repetition_delay=50- Cross-channel routing is supported but untested
- Buffer sizes should be identical for both channels
- Timing constraints must be respected to avoid signal corruption
The application starts automatically on boot if installed with setup.sh. For manual start:
cd /opt/redpitaya/bin
python3 main.py- Check system logs for status messages
- Use
toporhtopto monitor CPU usage - Application runs indefinitely until interrupted
- Temporary: To stop the application until the next boot press
Ctrl+Cin the terminal or kill the process intop(writekand the PID of the porcess).
- Permanent: First stop the application. Then remove it from
startup.shscript located in/opt/redpitaya/sbindirectory (you may have to enterrwmode). Either delete or comment the following lines of code:You can also remove the# Here you can specify commands for autorun at system startup export PYTHONPATH=/opt/redpitaya/lib/python/:$PYTHONPATH /opt/redpitaya/bin/main.pymain.pyandconfig.inifrom/opt/redpitaya/bin.
❌ "Error setting split trigger"
- Ensure you're using compatible Red Pitaya OS version
- Check system resources aren't exhausted
❌ "Invalid buffer size"
- Verify
buffer_timeis between 1-30 µs - Ensure integer values in configuration
❌ No signal output
- Check input signal levels and trigger settings
- Verify proper impedance termination (50 Ω)
- Confirm
signal_sourceconfiguration
❌ System slowdown
- This is normal - application uses most system resources
- Web interface will be unresponsive during operation
Add print statements to channel_processing_loop() for detailed diagnostics.
- Reduce
buffer_timefor faster response - Adjust
repetition_delayto prevent signal overlap - Monitor CPU usage with
topcommand - Reduce the value of
LOOP_DELAYto achieve faster trigger checking
Q: Can I use this with the Web Interface?
A: No, this application consumes all processing resources and will make the web interface unresponsive.
Q: What's the maximum buffer size?
A: 30 µs maximum, limited by Red Pitaya's DMA capabilities.
Q: Can I route IN1 to OUT2?
A: Yes, but this configuration is untested. Use signal_source=IN1 in DAC2 section.
Q: How do I change trigger sensitivity?
A: Adjust trigger_level in ADC sections (range: -1.0 to 1.0 Volts).
Q: Why does the signal break up?
A: Usually due to insufficient repetition_delay. Ensure it's ≥ (buffer_time × count_burst + 1) µs.
Disclaimer: This application is for advanced users. Ensure proper RF practices and impedance matching to avoid equipment damage.