#pysigrok
1 messages Β· Page 1 of 1 (latest)
like that:
Available serial ports:
/dev/cu.BLTH - n/a
/dev/cu.Bluetooth-Incoming-Port - n/a
/dev/cu.usbmodem1444401 - Neokey Shortcut Bar - CircuitPython CDC data
/dev/cu.usbmodem1444403 - Neokey Shortcut Bar - CircuitPython CDC data
/dev/cu.usbmodem1444101 - RP2040-Zero - CircuitPython CDC data
/dev/cu.usbmodem1444103 - RP2040-Zero - CircuitPython CDC data
/dev/cu.usbmodem146443301 - Feather RP2040 - CircuitPython CDC data
/dev/cu.usbmodem146443131 - Pico
because the few maintainers there are on pyserial only do the minimal, if anything, and the tools don't seem to be part of it
we didn't have any feedback, but there is very little activity in the pyserial repo
sounds a bit like the sigrok project
Adafruit_Board_Toolkit has a fixed versions of list_ports for mac and windows
i have a very boring GPIO16 trace π
π
same
so you can do up to 4 with no compression loss
the data is run length encoded in the pico so for boring signals it is easy to keep up
(despite running a loop reading a seesaw encoder on I2C on a feather connected to pin 16)
you may need a longer capture
try increasing the number of samples
though the value should be high....
aha
-C GPIO16 GPIO15 or -C GPIO16 -C GPIO15 for multiple channels?
the pins have to be consecutive ?
that's most efficient but it should be ok if not
I added support yesterday but didn't test it π
it uses pio to capture the range of pins
and then masks to keep enabled channels
pulseview has an i2c decoder that you should be able to add
you can also stack decoders for deeper protocol decoding
unfortunately new ones would need to be compiled into pulseview though...
pulseview has a reload button if you recapture to the same file
This is related to the Scorpio logic analyzer, right? :0
Yay! I want to test!
you may want to use a different rp2040 if you only have one scorpio
or use the pins on the side of the scorpio
So you could see the registers written that you are writing and toubleshoot a sensor library?
yup!
I got 2 of the Scorpio :3
Nice workkkk
Omg this is amazing
very nice
Indeed
I've tried to keep a quick start documented here: https://github.com/pysigrok/pysigrok#quick-start
there will need to be different uf2s for each board
Got it
had to set something up for real data. this qt py rp2040 reading BME680.
I think I'll dedicate a Waveshare Zero 2040 or a Pimoroni tiny2040 to it, like on a half breadboard, leaves place for another board or wires
I'll try and add cli protocol decoding today too
and let me know if you have suggestions
/ bugs
anyway to trigger?
haha
I haven't added support for it. It isn't that critical if you are just waiting for a signal to start because of the run length compression
but adding a third trigger pin could be nice
it'd be done on the host side
would want to trigger on signal line as well.
the firmware spits out a little debugging on gpio0 (or 1) whichever is tx
would the trigger be falling edge?
my typical trigger for i2c acquires is a hi/lo on SDA
and then miss a clock?
that's what i do in saleae logic. i think it retains some of the signal buffer prior to actual trigger. so it doesn't end up losing any signal in the output.
π
it's a pretty critical feature. let's you "arm" the logic analyzer and then initiate whatever code you're using to investigate things that then does whatever actual i2c traffic
sure
I guess I'm assuming you just set it up to capture a bunch of samples
on the cli side it'll just be clipping
its not a lot of data to store when nothing is happening
basic acquisition looks good though! what it did capture looks good.
this is a 1 second capture. the code reading the BME680 has a time.sleep(1) in the loop, so that's the majority of the trace. but it did capture actual traffic at the end.
right, the trigger ensures you get what you wanted
I'm attempting on Windows and just getting a flat signal
Nevermind, working now, wrong pin π
@dark adder I can push trigger support shortly
ok pysigrok 0.3.0 and 0.2.0 of pysigrok-hardware-raspberrypi-pico support "simple" triggers
I think technically sigrok-cli allows you to do P=010f sorts of stuff
firmware is the same
@pearl garden can test this. does it also need a new UF2 pushed to pico?
nope, same uf2 @dark adder
pysigrok-cli does the actual triggering and uses a continuous data mode from the existing firmware
pysigrok-cli -d raspberrypi-pico:conn=/dev/ttyACM0 -C GPIO16,GPIO17 -t GPIO17=f --samples 100000 -c samplerate=1000000 -o test.sr
that correct for 100ms of data triggered on GPIO17 falling?
ok, that explains why i got 13secs of data
same, but with -w
it sort of works. it's def waiting for a trigger. but it then ends up capturing more than 100ms worth of data. which is maybe OK? better than missing data.
I get an error if I don't give a trigger:
β― pysigrok-cli -d raspberrypi-pico:conn=/dev/cu.usbmodem146443301 -C GPIO0,GPIO1,GPIO2 --samples 50000 -c samplerate=1000000 -o test.sr
Traceback (most recent call last):
File "venv/bin/pysigrok-cli", line 8, in <module>
sys.exit(main())
File "venv/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "venv/lib/python3.9/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "venv/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "venv/lib/python3.9/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "venv/lib/python3.9/site-packages/sigrokdecode/cli.py", line 120, in main
triggers = triggers.split(",")
AttributeError: 'NoneType' object has no attribute 'split'
Same error here, wondering if it was because of python 3.10. tks Neradoc
it streams the data off the device
I'll fix that now. just hasty coding from me
PIP newb here π«€ I've run pip install --upgrade pysigrok-hardware-raspberrypi-pico but I just get the message:
Requirement already satisfied: pysigrok-hardware-raspberrypi-pico in c:\scorpio\sigrok\lib\site-packages (0.2.0)
How do I update to 0.3.1 ?
got it π pip install --upgrade pysigrok==0.3.1
π
just pip install --upgrade pysigrok
the thing is that upgrading "pysigrok-hardware-raspberrypi-pico" does not upgrade the dependencies if not necessary, and there is no simple way to do that, nor to "pip upgrade all"
I've been troubleshooting the Zero2W neopixel issue with my new digital logic analyzer π. Making progress that would not have been possible without it.
fyi I'm pushing new versions of everything
changed the output call a bit so that outputs can get data from the input and decoders
will push a vcd output too and π€ wavedrom too
@pearl garden I did a websearch for "pysigrok" initially. But I'm confused about the actual name "pysigrok", which appears in much older places like https://www.sigrok.org/api/libsigrok/0.5.0/bindings/python/. Are you building on that, or is the naming a coincidence?
Coincidence
I would have found it if it was on pypi
Not the same
Looks like the import they use is βsigrokβ:
@waxen cloak I think I will build on it to support their existing hardware. π
it does cause some confusion, but I'm not sure what to call it otherwise
I hadnβt seen that before. Could rename
AdaPySigrok?
If I understand the purpose of pysigrok correctly, it's supposed to be a reimplementation of core sigrok but being able to reuse its protocol decoders and infra without actually depending on the binary sigrok releases, correct?
yup! and use python plugins for hardware, file formats and decoders
I see! Has adafruit also released a logic analyzer hardware based on the pico for which this effort is happening?
Kind of, Iβm using a Scorpio with the two solder pads cut and bridged to make it 3v and input
The hardware looks perfect for the application with a 8-channel 245, and the price as well
I am trying to experiment with the Python files. Is there an example for the use of runtc.py? I get an error:
Message=Got unexpected extra arguments (- P u a r t - i " i n p u t . s r ")
The source code fot the experiment is:
sr = "input.sr"
args = '-P uart -i "{}"'.format(sr)
main(args)
I know nothing about this codebase, but possibly args should be a list like sys.argv instead of a single string.
Thanks, the args must be prepared in this way: args = ['-P', 'uart', '-i', '{}'.format(sr)]
Next error: "Decoder is ambiguous: " This is not really true. There are not to much decoders found, but no decoder. The function get_decoder(decoder_id) doesn't find anything. How do I provide the path to the decoders? I already added the search path. But it looks like "from importlib_metdata import entry_points" doesn't get anything. What's that importlib thing?
I'm using it the CI testing of the existing sigrok decoders: https://github.com/pysigrok/libsigrokdecode/actions/runs/4088886215/jobs/7051015627#step:5:1
You'll want to install your decoder into a virtual env. pip install -e . for an editable install
(Sorry for the late reply. I'm only here during the week usually.)
"testing of the existing sirgrok decoders"
That's exactly what I am doing with an own python substitute of the sigrokdecode base class. But implemented only the bare minimum what was necessary to run the decoder coder in a plan Python environment. This allows me to do it on Windows. I can single step the code and evaluate variables.
Nice! Thatβs what Iβve done too
(On Linux mostly)
But you did the job completely. Inclusive reading the .sr files. I develop mostly stacked decoders. I use the underlying UART decoder to generate a data.py file with the UART decoder PYTHON output. The test just uses this data as input.
In some other cases I used the unittest framework to generate artificial test data and a mock to capture the decoder output. This allows to call a single function with a specific set of input data. This makes it possible to test execution paths that are difficult to reach with real-world data.
I just found the first problem in the implementation of run_decoders: only the first decoder is called with metadata(SRD_CONF_SAMPLERATE,xxx).
There is a call to decoder.add_callback(output_type, output_filter, functools.partial(output.output, decoder)) in run_decoders() where output is SrZipOutput. This adds a callback for output_type=OUTPUT_ANN to the callbacks dictionary. This function SrZipOutput.output only accepts data from the input driver: "if source != self.driver".
How should the decoder's annotation be processed? Do I need to inherit from SrZipOutput and overwrite the output function?
@kindred wigeon srzip doesn't have a away to store annotations that I know of
I agree, there is no space for annotations in a srzip file. That's why I think that Output.output is not the best function to handle OUTPUT_ANN. My workaround is an inherited class the overwrites the output function of SrZipOuuput:
class MyOut(SrZipOutput):
def init(self, *args, **kwargs):
super(MyOut, self).init(*args, **kwargs)
def output(self, source, startsample, endsample, data):
if not isinstance(source,Pnet):
super(MyOut, self).output(source, startsample, endsample, data)
return
print("MyOut: {} {} {}".format(startsample, endsample, data))
output = MyOut("out.sr", driver)
srd.run_decoders(input, output, decoders)
Does this match your intention with OUTPUT_ANN?
Pnet is the decoder to test.
@kindred wigeon tests don't usually output to srzip
usually the tests use the TestOutput: https://github.com/pysigrok/pysigrok/blob/main/sigrokdecode/runtc.py#L10-L30
Great! With output = TestOutput(sys.stdout, srd.OUTPUT_ANN, Pnet) I get the output to the console.
@broken burrow which version of the uf2 did you copy onto the device?
I think the repo copies may be broken. What board do you have?
raspberry pico
I think that might be broken
which should i use instead?
I had to use an older version and haven't had a chance to figure out a fix
let me find one
thank you, got to go for now, but will test that later π
@broken burrow ping me directly if I miss it
Thanks!
π
works, thanks!!
great! I'll try to figure out why the newest version doesn't work this week
correction, works once than fails π
logging A0,A1 seems to cause it to fail
@pearl garden
hrm, I didn't do a ton with the analog lines
looks like I hadn't pushed my last commit
it has new uf2s in it
i'll try tat image
pysigrok-cli -d raspberrypi-pico:conn=/dev/cu.usbmodem101 -C A0,A1 --samples 10 -c samplerate=10000000 -o test.sr
hangs on that and doesn't proceed
do digital samples work?
when i abort and retry i get
File "/Users/mneuhaus/Library/Python/3.9/bin/pysigrok-cli", line 8, in <module>
sys.exit(main())
File "/Library/Python/3.9/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/Library/Python/3.9/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/Library/Python/3.9/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Library/Python/3.9/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/Users/mneuhaus/Library/Python/3.9/lib/python/site-packages/sigrokdecode/cli.py", line 121, in main
driver = driver_class(channels, **driver_options, **driver_configs)
File "/Users/mneuhaus/Library/Python/3.9/lib/python/site-packages/pysigrok_raspberrypi_pico.py", line 80, in __init__
raise RuntimeError("Didn't receive device info: " + repr(info))
RuntimeError: Didn't receive device info: b''````
yes, digital works
same with pysigrok-cli -d raspberrypi-pico:conn=/dev/cu.usbmodem101 -C GP26_A0 --samples 10 -c samplerate=10000000 -o test.sr
ok, what a pity, sadly that code is above my experience with c π
it outputs debug info to the uart
@pearl garden
that's what i get when i connect to serial before trying to capture analog
that happens if another device is already talking to the serial
i simply fired up arduino ide to connect to the serial output, or how should i do that?
that uses the same serial as the capture
for the debug output you need a usb to serial converter on the uart lines
(I'm gone once the baby wakes up soon and will be back tomorrow)
ah, ok, don't think i got that on hand
thanks for your time anyway, would've been cool to get this working, but i'll have to make due without i guess, have a good day! π
I'll try and look at analog this week. what are you capturing?
i'm working on a Part for a Voron Printer, specifically a optical light bridge sensor that is coupled/filtered by a schmitt trigger to emit stable pulse output
that pcb is used to measure the advancement of filament, would've been cool to measure/capture the stepper movements in sync with the analog sensor output and digital puls
the analog capture isn't very fast so I'm not sure it'd work for you
I mostly tested it for I2C capture
doens't need to be that fast, i can do "slow" movements
there sill seem to be some "missed" pulses/steps i'd like to investigate
still could use it for the digital signal at least
π
Hello @pearl garden I was looking into using the Pico with Sigrok and Pulseview and it has led me here, since it seems to be a bit of a pain to compile the py-pico driver into sigrok.
I'm looking to capture 19 digital signals + 2 analog signals (audio) simultaneously.
I'd like to be able to view them in Pulseview for inspection, and where I have already written a protocol decoder for the digital signals.
But I'd also like to be able to decode all signals, including the analog, in one go for analysis. I appreciate there is no way I'd be able to do this in Pulseview.
But if I used your pysigrok project, could I take the following steps?
- Capture all 19 digital + 2 analog (using an RPi Pico) with pysigrok to an srzip file
- Open the srzip file in Pulseview to inspect visually and therefore also use my existing PD for the digital data
- Write a decoder script in python using pysigrok, that would decode both analog and digital together and pump that into eg a CSV?
Apologies if that is a really obvious question, I read through the readme and this discord channel but don't have a total grasp yet.
Many thanks for your work on this project, particularly given the apparent difficulties in sigrok proper at the mo.
I don't think I've tried 19 digital + 2 analog
happy to help you get it sorted
will be a bit busy in the next hour or so
you definitely won't be able to capture very fast
That's very kind thank you, I'm not actually doing this today, waiting for the Pico to arrive. I've been using a cheapo 8 channel LA with Pulseview so far.
Just trying to understand what's possible.
The actual purpose is decoding the radio module in a children's toy, which has a little speaker and speaks various prerecorded phrases. I'd like to capture the audio sufficiently to try to recognise which phrase is being spoken. So I'm thinking I can get by with a low sample rate.
And by "recognise" I obviously don't mean Speech-To-Text π
Any suggestions of how I might analyse the analog signals in python? Actual sigrok protocol decoders can't do analog signals.
I've never done this so I don't know
Sorry I should have said "read" not analyse.
Actually I think I should be able to read the values by looking at the floats in the "analog" channel in the output (through OUTPUT_PYTHON).
Maybe
the srzip file format is very simple too
pysigrok isn't that much code that you can borrow
the decoder API is great for interoperability but it's a bit weird
Right, thanks.
Yes when I wrote a low-level decoder by modifying the stock SPI one I spent more time refactoring the existing driver to make it sane/pythonic than I did writing the new functionality.
π
I did make pysigrok plugins for saleae too if you need a higher end capture device
I've been meaning to add fx2 and fx3 support too but that's digital only
Thanks! I'm quite intrigued to see whether/how much could be done with the hilariously cheap pico, it would make it very accessible for other people to hack around with these toys too.
ya, totally. I did that first because it is cheap and available
I'm trying to generate some binary using pysigrok so that I can display them in PulseView, but am having issues getting pysigrok instaled.
Here's the error I'm getting... and as you see, I have pysigrok installed as far as PIP knows.
~$ pip3 show pysigrok
Name: pysigrok
Version: 0.4.2
Summary: Python implementation of sigrok tools
Home-page: None
Author: None
Author-email: Scott Shawcroft <scott@tannewt.org>
License: None
Location: /home/username/.local/lib/python3.8/site-packages
Requires: importlib-metadata, click
Required-by:
~$ python3
Python 3.8.10 (default, Nov 14 2022, 12:59:47)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pysigrok
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pysigrok'
I have tried this on windows, linux, in a virtualenv and without, I'm always getting the same exact results.
Help?
i think the module's called sigrokdecode
see this example https://github.com/pysigrok/hardware-raspberrypi-pico
I found this, and was trying to figure out what it was, but it sounds like it's only for raspberry-pi ... by the name at least
I thought it was to get the hardware drivers onto a raspberry pi. I only intend to generate files, not talk to any hardware
.... also I installed those to try... and had no luck
yeah, was just intending it as an example of importing the module that pip install pysigrok gets you
i'm not quite sure what you're trying to do but import pysigrok is not expected to work, that's all!
import pysigrok isn't suppose to work? oh.. well I'm misunderstanding something
Let's go a step further then in case I've got it all backwards .... is pip3 install pysigrok the right thing?
I was intending to use the API calls defined here:
https://sigrok.org/api/libsigrok/0.4.0/bindings/python/annotated.html
ok, i'm not 100% but this is my read: i think not.
this channel is about https://github.com/pysigrok/pysigrok
(which is the pip package)
but that there is the documentation for the python wrapper for libsigrok
which is also named pysigrok
someone please correct me if i'm wrong, but that's what i think i see! i imagine the python bindings for libsigrok (for use per those docs) come with libsigrok itself.
OK, so it sounds like there are two different things name pysigrok and I'm currently mixing up what is what...
Thanks for your help Asherah.
I'm going to dig into the sigrok-meter project as it is claimed to use the python bindings somehow, and I see some import sigrok.core code snippets, so there should be "something" there to learn. https://sigrok.org/wiki/Sigrok-meter
good luck!
Thanks, if I figure it out I'll share here for others
Oh, do you (or anyone else) know if any of the sigrok/PulseView input devices is a "virtual" device which is actually a TCP or UDP socket interface?
My first attempt was to feed data directly from my hardware into PulseView but proved to be too difficult for an experiment, so I decided to import files (bus CSV files with anything but logic data appear to not be handled and crash everything)
yup. I didn't realize that sigrok had python bindings it called pysigrok
sorry about that!
pysigrok (not the bindings) can write srzip files that you can open with pulseview
That might be useful, how do I do that, as I haven't been able to figure out how to use the "import" command in python to get any "sigrok" thing to work.
@pearl garden how do I install and use pysigrok? Can I "import pysigrok" in python? What is the intended use?
no, it installs the sigrokdecode module
it is mainly meant to be used from the CLI
pysigrok-cli reimplements sigrok-cli
sigrokdecode is what decoders import
https://github.com/pysigrok/pysigrok/blob/main/sigrokdecode/srzip.py is imported with import sigrokdecode.srzip for example
Hi @pearl garden I've just tried pysigrok with rpi-pico board and gotten myself all kinds of confused.
I wasn't sure which UF2 to use, so I tried them all. But only the pico_sdk_sigrok.uf2 file in pico-coder's repo leads to the Pico being recognised with pysigrok-cli --list-serial (installed via pip).
The firmwares in your fork (I tried generic and pico) don't show up with --list-serial.
But even though it shows up in the list with pico_sdk_sigrok.uf2 I get an error when trying to capture...
pysigrok_raspberrypi_pico.py", line 94, in __init__
self.pin_names = pin_names.decode("utf-8").strip().split(",")
AttributeError: 'str' object has no attribute 'decode'
...which is due to this line: https://github.2u2.cc/pysigrok/hardware-raspberrypi-pico/blob/main/pysigrok_raspberrypi_pico.py#L94
...which confuses me even more, because the code...
else:
board_name = "Pico"
pin_names = ""
self.pin_names = pin_names.decode("utf-8").strip().split(",")
...seems to set an empty string for pin_names then try to decode and split it, which is causing the error (and it would then throw an error when the string didn't split into 30 parts anyway).
Sorry if I'm back to front and loaded/installed the wrong thing!
@bold bay no worries. I think the checked in versions may be broken....
I think going back one commit does work. I've been meaning to revisit
https://github.com/pysigrok/sigrok-pico/blob/dfc7f43914e80f02caf03e46a679bcb3fc8f2b32/pico_sdk_sigrok/build/pico_sdk_sigrok.uf2 may be for scorpio
Thanks! Progress!
Although I still haven't managed to capture. I'm getting the error:
sigrokdecode/cli.py", line 225, in main
logic_channels=driver.logic_channels,
AttributeError: 'PicoDriver' object has no attribute 'logic_channels'
Running command:
pysigrok-cli -d raspberrypi-pico:conn=/dev/ttyACM0 --continuous -c samplerate=1000000 -o test.sr
Perhaps related, if I try to specify any pins (tried GP16 and D16) with -C [pin] I get Unknown pin: GP16 or Unknown pin: D16
ya, that build could be for the scorpio because I was using it
try NEOPIXEL0 for GP16
Thanks, I see now - yes that solves the pin problem.
However I still get the error 'PicoDriver' object has no attribute 'logic_channels'
hrm
lemme look
checks my local copy
@bold bay I don't think continuous mode works
you'll need to do a fixed number of samples
Okay, success! Thanks very much!
great! sorry it is early
Double thanks then π
Hi @pearl garden I've just been trying to build your version of sigrok-pico on my machine. In fact it builds fine, but when I load the uf2 onto a Pico it doesn't even show up as a serial device (ttyACM0). When I build the upstream pico-coder version, it does.
Stranger still, the prebuilt uf2 in your repo does work, and that's the one I've been using with pysigrok.
Looking at the code changes between your fork and upstream, I can't see anything that would make it fail to run. And obviously I know it runs, because I'm using your pre-built image fine!
It's a bit confusing. Does your checked-in uf2 definitely correspond to the current state of the code?
Any other ideas off the top of your head?
Thanks!
Hi @pearl garden a little update, I've isolated this commit as the one that stops the Pico even identifying as a serial device (on my machine):
https://github.com/pysigrok/sigrok-pico/commit/dfc7f43914e80f02caf03e46a679bcb3fc8f2b32
I've tried building both with and without ADAFRUIT_KB2040 defined.
There are quite a lot of changes in this commit and I've been trying to understand what the purpose is, are you able to give a short summary?
I see you've made some changes to the pin definitions too - does this effect which pins can be used for sampling? I'm quite interested in understanding how many Pico pins can be used for what (eg analog/digital).
Thanks in advance for any insight that you can spare!
Sorry to get back to you late. I was away for the US holiday weekend.
the boot issues could be incorrect flash config
that commit is meant to enable non-continuous bit sampling. it'll read the bit(s) but then mask them before doing the RLE
Thanks for the hints. I think it's unlikely to be flash config because that isn't directly changed in the commit - although the DMA buffer size is. The board boots fine when built on previous commits, so it's definitely something changed in this commit.
This is my first interaction with the Pico/RP2040 so I'm still finding my way. I'll tinker a bit and see what exactly about the commit is causing the fail. I could also check the serial debug output.
Hi @pearl garden, I already wrote a note in march. Unfortunately there was no response, so probably you just missed it..
The pysigrok doesn't call the decoders similar to the original implementation. There is a subtle difference. The function run_decoders calls only
first_decoder.metadata(SRD_CONF_SAMPLERATE, input_.samplerate)
But stacked decoders are also called from libsigrokdecode with the information about the sample rate. What about in changing this to this code?
if input_.samplerate > 0:
for d in all_decoders:
if d.metadata:
d.metadata(SRD_CONF_SAMPLERATE, input_.samplerate)
where did you post? that seems like a good change
I haven't done stacked decoders much
I posted only a short note here at 03.03.2023 09:43.
Most stacked decoders take the output of the previous decoder and interpret the logic. So you won't find much stacked decoders with the metadata function. But take a look at the dmx512 decoder. It will get a division by zero in "samples_to_usec" if the sample rate is not given as metadata.
My decoder also uses the UART decoder as input. But it decodes a protocol that uses the UART data as well as the timing constraints defined by the protocol.
Other examples for stacked decoders that require the sample rate: usb_request and usb_power_delivery are stacked on usb_packet.
@kindred wigeon I'm happy to review and merge a PR for it
I formerly just donwloaded a ZIP file with the code. Now I created afork at github and cloned that forked repository and use the code in the working tree. I get problems to import the 'uart' decoder. It does
import sigrokdecode as srd
and the metadata function checks for the key:
def metadata(self, key, value):
if key == srd.SRD_CONF_SAMPLERATE:
The commit 7fb8545b replaced SRD_CONF_SAMPLERATE with an enumclass MetadataKeys with the only member SRD_CONF_SAMPLERATE. This is not found anymore and any metadata function fails. Did you test the latest commit with decoders that implement metadata and must use this key? The decoder works with this change:
if key == srd.MetadataKeys .SRD_CONF_SAMPLERATE:
But we don't want to change all decoders, do we?
@kindred wigeon no we don't want to change anything. You may need to undo some of the enumclass changes to match the decoders
Sent a small PR with a fix for SRD_CONF_SAMPLERATE and the metadata calls.
Thank you!
@kindred wigeon where did you send the pr? I don't see it on github
@bold bay I just rebuilt the pico sigrok firmware and the uf2s seem to work
will push them shortly
I had sent the PR to the wrong repo "flaviut". Now I've sent a new PR https://github.com/pysigrok/pysigrok/pull/6.
Sorry for the confusion.
Thanks!
I got a notification from Github "Python Linting and Type Checking, Attempt #2: Some jobs were not successful". This is related to my main branch: https://github.com/pysigrok/pysigrok/actions/runs/5207457804 Unfortunately I don't understand what has actually failed. Is there a way to do this checks outside of Github? I would like to commit something that will pass the checks.
I think you can run scripts/lint.sh locally
it'll run black and ruff
totally ok to use your own github branch to test it with actions too
Hi! I'm having a bit of trouble with pysigrok on a pico - I know that it's a very new thing overall, so no worries if it's not ready yet.
raise ValueError(f"Unknown pin: {channel}")
ValueError: Unknown pin: D16
If I'm running into errors, should I build from source, or is the command here supposed to tie to a functional branch? pip install pysigrok-hardware-raspberrypi-pico pysigrok-libsigrokdecode
I'm using uf2 from here: https://github.com/pysigrok/sigrok-pico/tree/main/pico_sdk_sigrok/build
Thanks!
which board do you have and what did you load? If pico, try GP16
I think the released versions will work but use the dev versions myself
Ok, will do! In the meantime, I got the pico driver working... π
Nice! Is that with the pysigrok version of the firmware?
It was.... not very fun compiling sigrok for macOS
Ya, I dislike compiling sigrok. hence pysigrok
Yeah, I wish I had found pysigrok before wasting so much time on it, but at least I've got a functional logic analyzer and now I can get up to speed with pysigrok at a more lesiurely pace
I am not particularly fond of how the sigrok devs decided to handle everything... their build scripts were idiotproof 8 years ago, but now they've apparently lost the core competency needed to keep the scripts up to date...
the project is basically dead with only one person doing minor changes
I'm going to merge what I changed with DSview to get the pico working with their GUI instead... and I think I might make a vcp driver for pysigrok to pipe in all the sigrok supported hw to dsview too. My gui crashes sometimes since QT5.5 is so dang old
(and it is built with qt5.5, not 6.5 despite what pulseview says... my package manager was begging for mercy by the end of this)
i was writing a little blog article on my experience writing a sigrok decoder before i basically discovered the project is dead(?) or at least struggling for maintainers. are decoders for sigrok compatible with psyigrok? should i retarget my efforts?
The sigrok project has a discord bridge on the 1bitsquared server. https://discord.com/invite/7BHAPvWpkU
i made a decoder for the intel 8088 CPU
Most of the sigrok decoders run under pysigrok just fine. The intention is that they should do fixes are welcome
Seems like there is a bit more activity from abraxa on sigrok proper
I just found this room - I hav a lot of catching up to do
off topic: trying to get pulseview to build for android, anyone have success lately
or a better place for discussion?
There is a sigrok irc channel that might be better
Hi, is anyone working on a plotting moduel for pysigrok already?
don't think so. I haven't done much with it in a while
I am testing for hours to get the AppImage for Salaea and extracting the firmware for use in sigrok, but it just shows this error:
~/SIGROK/sigrok-util/firmware/saleae-logic16$ ./sigrok-fwextract-saleae-logic16 Logic
Error: 'gLogic16HexFileLinesCount'
Anyone knows what I'm doing wrong?
I'm using this guide: https://sigrok.org/wiki/Firmware - my feeling is probably they updated the Logic binary, so it's not that easy to extract the firmware out of it any longer?
Nevermind, found a better wiki article, which is sadly down due AI bots: https://web.archive.org/web/20250927105348/https://sigrok.org/wiki/Saleae_Logic_Pro_16
Too bad it says it doesn't support analog yet - anyone working on it?
Now at least I got the firmware
I found a problem while reading .sr data files with pysigrok. I get an exception "ValueError: bytes length not a multiple of item size" in SrZipInput::wait() at line 143:
self.data = array.array(self.typecode, self.data)
The typecode is 'Q'.
I assume the problem is with the special analyzer that has created the .sr files. You can find them in the sigrok-dumps repository:
https://sigrok.org/gitweb/?p=sigrok-dumps.git;a=tree;f=sdcard/sd_mode/card_reader/unknown_card;h=f19439f4d4aa052b28915b1cb42119f6e5985750;hb=HEAD
Do you see an option to add support for .sr files with 34 probes?