#pysigrok

1 messages Β· Page 1 of 1 (latest)

pearl garden
#

why hasn't pyserial merged in the bug fix?

final hamlet
#

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
pearl garden
#

ah, the names after are the same

#

this only has one cdc endpoint so it should be ok

final hamlet
#

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

pearl garden
#

sounds a bit like the sigrok project

final hamlet
#

Adafruit_Board_Toolkit has a fixed versions of list_ports for mac and windows

dark adder
#

i have a very boring GPIO16 trace πŸ™‚

pearl garden
#

πŸ™‚

final hamlet
#

same

pearl garden
#

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

final hamlet
#

(despite running a loop reading a seesaw encoder on I2C on a feather connected to pin 16)

pearl garden
#

you may need a longer capture

#

try increasing the number of samples

#

though the value should be high....

final hamlet
dark adder
#

-C GPIO16 GPIO15 or -C GPIO16 -C GPIO15 for multiple channels?

pearl garden
#

-C GPIO16,GPIO17,GPIO18,GPIO19

#

needs to add help text

final hamlet
#

the pins have to be consecutive ?

pearl garden
#

that's most efficient but it should be ok if not

#

I added support yesterday but didn't test it πŸ™‚

final hamlet
#

look at that beautiful clock

pearl garden
#

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

final hamlet
#

❀️

pearl garden
#

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

open kite
#

This is related to the Scorpio logic analyzer, right? :0

pearl garden
#

yup! they are testing it out for me

#

happy to have more testers πŸ™‚

open kite
#

Yay! I want to test!

pearl garden
#

you may want to use a different rp2040 if you only have one scorpio

#

or use the pins on the side of the scorpio

topaz pollen
#

So you could see the registers written that you are writing and toubleshoot a sensor library?

pearl garden
#

yup!

topaz pollen
#

Amazing

#

Ill try it tonight

open kite
#

I got 2 of the Scorpio :3

final hamlet
topaz pollen
#

Nice workkkk

final hamlet
topaz pollen
#

Omg this is amazing

final hamlet
#

very nice

topaz pollen
#

Indeed

pearl garden
pearl garden
#

there will need to be different uf2s for each board

topaz pollen
#

Got it

pearl garden
#

the only difference is the pin names

dark adder
#

had to set something up for real data. this qt py rp2040 reading BME680.

final hamlet
#

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

pearl garden
#

I'll try and add cli protocol decoding today too

#

and let me know if you have suggestions

#

/ bugs

dark adder
#

anyway to trigger?

final hamlet
#

can it record on a trigger ?

#

oh πŸ˜„

pearl garden
#

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

dark adder
#

would want to trigger on signal line as well.

pearl garden
#

the firmware spits out a little debugging on gpio0 (or 1) whichever is tx

#

would the trigger be falling edge?

dark adder
#

my typical trigger for i2c acquires is a hi/lo on SDA

pearl garden
#

and then miss a clock?

dark adder
#

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.

pearl garden
#

πŸ‘

dark adder
#

any of the useful signal

#

(sort of like a DSO)

pearl garden
#

haha, ok I can look into that

#

pulls up the sigrok-cli man page

dark adder
#

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

pearl garden
#

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

dark adder
#

basic acquisition looks good though! what it did capture looks good.

pearl garden
#

that's the cli I'm copying

#

so I can add -t

#

and -w

dark adder
#

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.

pearl garden
#

right, the trigger ensures you get what you wanted

dark adder
#

and that all looks good

#

nicely decoded

#

yah, so something like -t GPIO17=f

pearl garden
#

kk, will look into it

#

shouldn't be toooo bad

dark adder
#

cool

#

anything else you want tested?

bitter lake
#

I'm attempting on Windows and just getting a flat signal

#

Nevermind, working now, wrong pin πŸ˜„

pearl garden
#

@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

dark adder
#

@pearl garden can test this. does it also need a new UF2 pushed to pico?

pearl garden
#

nope, same uf2 @dark adder

#

pysigrok-cli does the actual triggering and uses a continuous data mode from the existing firmware

dark adder
#

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?

pearl garden
#

I think so. it won't drop data before the trigger though

#

-w does that I think

dark adder
#

ok, that explains why i got 13secs of data

pearl garden
#

πŸ˜„

#

-w will loosely crop it

dark adder
#

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.

final hamlet
#

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'
topaz pollen
pearl garden
pearl garden
final hamlet
#

ok I won't try to do a PR then πŸ˜‰

#

(this time)

pearl garden
#

ok, 0.3.1 published

#

(of pysigrok)

bitter lake
#

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 ?

bitter lake
#

got it 😁 pip install --upgrade pysigrok==0.3.1

pearl garden
#

πŸ‘

final hamlet
#

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"

bitter lake
#

I've been troubleshooting the Zero2W neopixel issue with my new digital logic analyzer 😁. Making progress that would not have been possible without it.

pearl garden
#

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

waxen cloak
pearl garden
#

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. πŸ™‚

waxen cloak
#

it does cause some confusion, but I'm not sure what to call it otherwise

pearl garden
#

I hadn’t seen that before. Could rename

open kite
#

AdaPySigrok?

woeful tendon
#

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?

pearl garden
woeful tendon
#

I see! Has adafruit also released a logic analyzer hardware based on the pico for which this effort is happening?

pearl garden
#

Kind of, I’m using a Scorpio with the two solder pads cut and bridged to make it 3v and input

woeful tendon
#

The hardware looks perfect for the application with a 8-channel 245, and the price as well

kindred wigeon
#

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)

bronze quiver
kindred wigeon
#

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?

pearl garden
#

(Sorry for the late reply. I'm only here during the week usually.)

kindred wigeon
pearl garden
#

(On Linux mostly)

kindred wigeon
#

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.

kindred wigeon
#

I just found the first problem in the implementation of run_decoders: only the first decoder is called with metadata(SRD_CONF_SAMPLERATE,xxx).

kindred wigeon
#

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?

pearl garden
#

@kindred wigeon srzip doesn't have a away to store annotations that I know of

kindred wigeon
#

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.

pearl garden
#

@kindred wigeon tests don't usually output to srzip

kindred wigeon
#

Great! With output = TestOutput(sys.stdout, srd.OUTPUT_ANN, Pnet) I get the output to the console.

broken burrow
#

hey, i'm trying to get pysigrok running here but currently i'm stuck on this:

pearl garden
#

@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?

broken burrow
#

raspberry pico

pearl garden
#

I think that might be broken

broken burrow
#

which should i use instead?

pearl garden
#

I had to use an older version and haven't had a chance to figure out a fix

#

let me find one

broken burrow
#

thank you, got to go for now, but will test that later πŸ™‚

pearl garden
#

@broken burrow ping me directly if I miss it

broken burrow
#

Thanks!

pearl garden
#

πŸ‘

broken burrow
pearl garden
#

great! I'll try to figure out why the newest version doesn't work this week

broken burrow
#

correction, works once than fails πŸ˜„

#

logging A0,A1 seems to cause it to fail

#

@pearl garden

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

broken burrow
#

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

pearl garden
#

do digital samples work?

broken burrow
#

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

pearl garden
#

ok nice! I haven't been doing analog much

#

must be a bug with it

broken burrow
#

ok, what a pity, sadly that code is above my experience with c πŸ˜„

pearl garden
#

it outputs debug info to the uart

broken burrow
#

@pearl garden

#

that's what i get when i connect to serial before trying to capture analog

pearl garden
#

that happens if another device is already talking to the serial

broken burrow
#

i simply fired up arduino ide to connect to the serial output, or how should i do that?

pearl garden
#

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)

broken burrow
#

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! πŸ™‚

pearl garden
#

I'll try and look at analog this week. what are you capturing?

broken burrow
#

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

pearl garden
#

the analog capture isn't very fast so I'm not sure it'd work for you

#

I mostly tested it for I2C capture

broken burrow
#

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

pearl garden
#

πŸ‘

bold bay
#

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?

  1. Capture all 19 digital + 2 analog (using an RPi Pico) with pysigrok to an srzip file
  2. Open the srzip file in Pulseview to inspect visually and therefore also use my existing PD for the digital data
  3. 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.

pearl garden
#

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

bold bay
#

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 πŸ™‚

pearl garden
#

what toy is it?

#

3 shouldn't be too hard but I haven't done it

bold bay
#

Any suggestions of how I might analyse the analog signals in python? Actual sigrok protocol decoders can't do analog signals.

pearl garden
#

will be back in 1 hour

#

(CP meeting time)

pearl garden
bold bay
#

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

pearl garden
#

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

bold bay
#

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.

pearl garden
#

πŸ˜„

#

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

bold bay
#

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.

pearl garden
#

ya, totally. I did that first because it is cheap and available

opal nymph
#

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?

desert epoch
#

i think the module's called sigrokdecode

opal nymph
#

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

desert epoch
#

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!

opal nymph
#

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?

desert epoch
#

ok, i'm not 100% but this is my read: i think not.

#

(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.

opal nymph
#

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

desert epoch
#

good luck!

opal nymph
#

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)

pearl garden
#

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

opal nymph
#

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?

pearl garden
#

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

bold bay
#

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).

GitHub

pysigrok hardware plugin for using a RP2040 as a logic probe - hardware-raspberrypi-pico/pysigrok_raspberrypi_pico.py at main Β· pysigrok/hardware-raspberrypi-pico

#

Sorry if I'm back to front and loaded/installed the wrong thing!

pearl garden
#

@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

bold bay
#

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

pearl garden
#

ya, that build could be for the scorpio because I was using it

#

try NEOPIXEL0 for GP16

bold bay
#

Thanks, I see now - yes that solves the pin problem.
However I still get the error 'PicoDriver' object has no attribute 'logic_channels'

pearl garden
#

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

bold bay
#

Okay, success! Thanks very much!

pearl garden
#

great! sorry it is early

bold bay
#

Double thanks then πŸ˜„

pearl garden
bold bay
#

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!

bold bay
#

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!

pearl garden
#

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

bold bay
#

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.

kindred wigeon
#

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)
pearl garden
#

I haven't done stacked decoders much

kindred wigeon
#

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.

pearl garden
#

@kindred wigeon I'm happy to review and merge a PR for it

kindred wigeon
#

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?

pearl garden
#

@kindred wigeon no we don't want to change anything. You may need to undo some of the enumclass changes to match the decoders

kindred wigeon
#

Sent a small PR with a fix for SRD_CONF_SAMPLERATE and the metadata calls.

pearl garden
#

@kindred wigeon where did you send the pr? I don't see it on github

pearl garden
#

@bold bay I just rebuilt the pico sigrok firmware and the uf2s seem to work

#

will push them shortly

kindred wigeon
#

Sorry for the confusion.

bold bay
kindred wigeon
#

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.

GitHub

Python reimplementation of sigrok core. Contribute to pysigrok/pysigrok development by creating an account on GitHub.

pearl garden
#

it'll run black and ruff

#

totally ok to use your own github branch to test it with actions too

unreal spoke
#

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!

GitHub

Use a raspberry pi pico (rp2040) as a logic analyzer and oscilloscope with sigrok - sigrok-pico/pico_sdk_sigrok/build at main Β· pysigrok/sigrok-pico

pearl garden
#

I think the released versions will work but use the dev versions myself

unreal spoke
#

Ok, will do! In the meantime, I got the pico driver working... πŸ˜„

pearl garden
unreal spoke
#

It was.... not very fun compiling sigrok for macOS

pearl garden
#

Ya, I dislike compiling sigrok. hence pysigrok

unreal spoke
unreal spoke
pearl garden
#

It doesn't have a gui of its own either

#

pulseview crashes on linux for me now too

unreal spoke
#

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...

pearl garden
#

the project is basically dead with only one person doing minor changes

unreal spoke
#

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

unreal spoke
#

(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)

magic epoch
#

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?

narrow pebble
magic epoch
#

i made a decoder for the intel 8088 CPU

pearl garden
#

Seems like there is a bit more activity from abraxa on sigrok proper

nimble mirage
#

I just found this room - I hav a lot of catching up to do

thick galleon
#

eww sigrok updates

#

cool

visual lantern
#

off topic: trying to get pulseview to build for android, anyone have success lately

#

or a better place for discussion?

pearl garden
#

There is a sigrok irc channel that might be better

fallow root
#

Hi, is anyone working on a plotting moduel for pysigrok already?

pearl garden
#

don't think so. I haven't done much with it in a while

finite arch
#

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?

#

Too bad it says it doesn't support analog yet - anyone working on it?

#

Now at least I got the firmware

kindred wigeon
#

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'.

#

Do you see an option to add support for .sr files with 34 probes?