Hello, Many thanks for the replies, some - I realize - I should have figured by myself, but some were good for clarification.
I should point out that I'm totally new to Python so there is a lot of guessing going on when working on the decoder. What seems a bit odd to me is that there appears to be variables and functions that are default or inherited by sigrokdecoder? Is there any way to figure out what variables and properties/functions that are available? One example is self.has_channel. Maybe it's already somewhere in the documentation, but it's not apparent to me. I would very much like to use the pulseview log window that you mention. Is there any way I there can generate a list (through print() for example) of available variables and properties? I have tried the print statement in a protocol decoder, but don't get really expected result. in pd.py for Parallel, right at the beginning of decode(self), I inserted the following: def decode(self): print(123) but it gives no apparent output in the PV log window, which looks like this (beginning of log is irrespective of whether I include any decoder or not in PV): SyntaxError: Failed to load decoder signature: import by name failed: invalid syntax (pd.py, line 138) srd: Traceback (most recent call last): srd: File "D:\Program Files (x86)\sigrok\PulseView\share\libsigrokdecode\decoders\signature\__init__.py", line 25, in srd: from .pd import Decoder srd: File "D:\Program Files (x86)\sigrok\PulseView\share\libsigrokdecode\decoders\signature\pd.py", line 138 srd: incoming = (bin(shiftreg & 0b0000_0010_1001_0001).count('1') + data) & 1 srd: ^ SyntaxError: invalid syntax SyntaxError: Failed to load decoder signature: import by name failed: invalid syntax (pd.py, line 138) srd: Traceback (most recent call last): srd: File "D:\Program Files (x86)\sigrok\PulseView\share\libsigrokdecode\decoders\signature\__init__.py", line 25, in srd: from .pd import Decoder srd: File "D:\Program Files (x86)\sigrok\PulseView\share\libsigrokdecode\decoders\signature\pd.py", line 138 srd: incoming = (bin(shiftreg & 0b0000_0010_1001_0001).count('1') + data) & 1 srd: ^ SyntaxError: invalid syntax pv: Acquisition took 0.00 s pv: "Parallel": "There are no channels assigned to this decoder" "Parallel": Error cleared sr: log: libsigrok loglevel set to 4. srd: libsigrokdecode loglevel set to 4. sr: log: libsigrok loglevel set to 5. srd: libsigrokdecode loglevel set to 5. srd: Terminating instance parallel-1 srd: parallel-1: Joining decoder thread. srd: parallel-1: Raising want_term, sending got_new. srd: parallel-1: Running join(). srd: parallel-1: Decoder_wait: Will return from wait(). srd: parallel-1: decode() terminated. srd: parallel-1: Thread done (!res, want_term). srd: parallel-1: Call to join() done. srd: parallel-1: Resetting decoder state. srd: parallel-1: Releasing initial pin state. srd: Calling reset() of instance parallel-1 srd: Setting session 5 samplerate to 100000000. srd: Freeing instance parallel-1. srd: parallel-1: Resetting decoder state. srd: Destroyed session 5. srd: Creating session 6. srd: Creating new parallel instance parallel-1. srd: Setting channels for instance parallel-1 with list of 5 channels. srd: Setting channel mapping: d3 (PD ch idx 4) = input data ch idx 4. srd: Setting channel mapping: d2 (PD ch idx 3) = input data ch idx 3. srd: Setting channel mapping: d1 (PD ch idx 2) = input data ch idx 2. srd: Setting channel mapping: clk (PD ch idx 0) = input data ch idx 0. srd: Setting channel mapping: d0 (PD ch idx 1) = input data ch idx 1. srd: Final channel map: srd: - PD ch idx 0 (clk) = input data ch idx 0 (optional) srd: - PD ch idx 1 (d0) = input data ch idx 1 (optional) srd: - PD ch idx 2 (d1) = input data ch idx 2 (optional) srd: - PD ch idx 3 (d2) = input data ch idx 3 (optional) srd: - PD ch idx 4 (d3) = input data ch idx 4 (optional) srd: - PD ch idx 5 (d4) = input data ch idx -1 (optional) srd: - PD ch idx 6 (d5) = input data ch idx -1 (optional) srd: - PD ch idx 7 (d6) = input data ch idx -1 (optional) srd: - PD ch idx 8 (d7) = input data ch idx -1 (optional) srd: Initial pins: 2, 2, 2, 2, 2, 0, 0, 0, 0. srd: Setting session 6 samplerate to 100000000. srd: Registering new callback for output type OUTPUT_ANN. srd: Registering new callback for output type OUTPUT_BINARY. srd: Calling start() of all instances in session 6. srd: Calling start() of instance parallel-1. srd: Instance parallel-1 creating new output type OUTPUT_PYTHON as oid 0 (parallel-1). srd: Instance parallel-1 creating new output type OUTPUT_ANN as oid 1 (parallel-1). srd: Decoding: abs start sample 0, abs end sample 3232 (3232 samples, 3232 bytes, unitsize = 1), instance parallel-1. srd: No worker thread for this decoder stack exists yet, creating one: parallel-1. srd: parallel-1: Starting thread routine for decoder. srd: parallel-1: Calling decode(). srd: Done, handled all samples (abs cur 3232 / abs end 3232). Can you please give an example - for example in the pd.py for Parallel - how print() would work? Is there any way to import sigrokdecode to a regular python console and experiment from there? I'm running windows. Is it possible to modify a protocol decoder while PV is running or is PV only loading these at start? Right now I seem to have to restart PV each time. Looking at git-hub, I find the 'install-decoders'. Is this installing all decoders in a ram disk once PV is started? Any comments or suggestions would be greatly appreciated! Regards, Staffan On Fri, Nov 13, 2020 at 11:40 PM Soeren Apel <soe...@apelpie.net> wrote: > Hello, > > > I'm doing a first attempt at writing a decoder to capture reads from an > > EPROM and need to decode address and data. This will be quite a few pins. > > Is it possible to suggest default locations/names for each pin? When I > run > > the hantek 4032 logic analyzer, the pins are labelled A0 - A15 and B0 - > > B15. It would be good to be able to have default values within the > decoder > > so I don't have to enter this each time I start a new session in > PulseView. > > Or, is this possible to configure within PulseView in any way? > > You could configure the protocol decoder once and save the session > configuration to a file. That way, you can restore those settins whenever > you need. > > https://sigrok.org/doc/pulseview/unstable/manual.html#_other_features > > > > I'm starting from the 'parallel' decoder. When I select that with data > from > > the Hantek, no pin is preselected (they are all '-'). On the other hand, > > when I import raw binary data where pins are labelled 0 - 31, D0 - D7 > are > > assigned to 0 - 7. Is this by chance only or can it be controlled? > > PulseView tries to guess the assignment based on the signal names. A0 will > never match with D0 whereas 0 does as the string "0" is a subset of "D0". > > > > When building a decoder, it would be great to be able to run it in a > debug > > mode. Is this possible in any way? I have only PulseView installed now, > but > > could install sigrok-cli also if that would simplify things - any > > suggestions appreciated! > > You can certainly use sigrok-cli to develop PDs and I know that some people > do just that. It's probably most useful to cut specific parts from your > acquired data and save them to .sr files that you can feed through sigrok- > cli. > > Alternatively, you can use print() statements in your PD which then will > show up in the log output within PV (and on the console if you're on > Linux/OSX). > > > > Looking at the wiki Protocol decoder API/Queries, there are several > > references to the API v2, but where can documentation about that be > found? > > I'm assuming you mean the "works as in v2" remarks. Those refer to > https://sigrok.org/wiki/Protocol_decoder_API which documents those parts. > Thanks for the hint, I'll make it clearer. > > Regards, > -Soeren > > > > > > > Regards, > > Staffan > > _______________________________________________ > > sigrok-devel mailing list > > sigrok-devel@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/sigrok-devel > >
_______________________________________________ sigrok-devel mailing list sigrok-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sigrok-devel