Page 1 of 1

sigrok/pulseview support

Posted: Sun Mar 04, 2018 6:57 pm
by dvc
Hi,

I started hacking on a sigrok redpitaya driver and I'm looking for a python example or scpi example for how to use the logic analyzer pro. I've seen `DIG:PIN? <pin>`, but am looking for something like `ACQ:START`. I looked for the logicanalyzer application in the redpitaya free applications directory, but it looks like the source code for the logic analyzer app isn't available.

Thanks,
David

Re: scpi logic analyzer

Posted: Tue Mar 20, 2018 2:48 pm
by dvc
So I decided to implement my own driver/tcp server
Screenshot from 2018-03-20 14-43-14.png
src is available here:
github.com/dvc94ch/libsigrok
github.com/dvc94ch/redpitaya-mercury

the only remaining problem is how to use interrupts. the python code doesn't use any. So currently I'm filling the buffer, sending the buffer, restarting state machine. there are missing samples during the sending the buffer part, so there should be some kind of half full interrupt somewhere.

Re: sigrok/pulseview support

Posted: Tue Mar 20, 2018 3:23 pm
by amike88
This bit of documentation can be helpful.

Re: sigrok/pulseview support

Posted: Tue Mar 20, 2018 4:25 pm
by dvc
The problem is that they aren't used anywhere. /dev/uio/ps2pl is the only device that allows enabling interrupts. echo 'x01' > /dev/uio/la gives an error. I'll have to decipher the dtso [0] and maybe the rtl. I'm not really fluent in system verilog...

[0] github.com/RedPitaya/RedPitaya/blob/master/fpga/prj/mercury/dts/fpga.dtso

Re: sigrok/pulseview support

Posted: Tue Mar 20, 2018 5:12 pm
by dvc
So I suspect that no interrupts are implemented yet, because it never terminates. Can someone please confirm?

```rust
let hwid = HwId::new();
hwid.show();

let mut ps2pl = Interrupt::new();
ps2pl.enable();

// setup logic analyzer
let mut la = LogicAnalyzer::new();
la.default();
la.set_input_mask(0xffff);
la.set_trigger_pre(la::BUFFER_SIZE / 2);
la.set_trigger_post(la::BUFFER_SIZE / 2);
la.set_decimation(1000);
la.set_sync_source(SyncSource::La);
la.set_trigger_source(TriggerSource::La);
la.show();

thread::sleep(time::Duration::from_millis(1000));

// reset and start
la.reset();
la.start_trigger();

println!("Wait for interrupt");
let res = ps2pl.wfi();
println!("Received interrupt {}", res);
```