pico-coder / sigrok-pico

Use a raspberry pi pico (rp2040) as a logic analyzer and oscilloscope with sigrok
727 stars 83 forks source link

PicoW #21

Open tony1tf opened 2 years ago

tony1tf commented 2 years ago

With the new PicoW release last week, this seems like an ideal time to upgrade this logic analyser. Since the WiFi chip uses SPI for communication, I guess it is going to be faster than the USB serial port. Any thoughts about this Shawn?

pico-coder commented 2 years ago

Rough, off-the-cuff response. Per the Raspberry PI PICO W datasheet the SPI interface to the WiFi chip is only single lane SPI, and per section 3.8 typically runs at 33Mhz.
The CYW43439 datasheet indicates support for up to 2KB data transfers per SPI operation if you use the special wifi functions, with only a 4B command overhead. So in theory the SPI link might reach ~30Mbit/sec of raw data rate. But there could be all sorts of bottlenecks (Hardware and Software) in the ability of the PICO to send the packets.

IIRC, your ideal use case was something like 16 channels at 3Msps with fairly low run length encoding success due to needing to sample a clock and due to all the variable delay line circuits etc. With no RLE, you need 48 Mbit/sec raw bandwidth, so you would still come up a bit short, but 30 is a bit higher than the 12Mbit/sec raw USB bandwidth.

Also, the RP2040 says SPI clock can reach half of sys_clk and the CYW43439 says it can support 50Mhz, so I think you might be able to boost the 33Mhz based to 50, but with a product that was just release a week ago I wouldn't start pressing my luck. Further we are still in the era of the chip shortage and these seem to be built from the typical rare earth metal "unobtanium" ;=). It's also fishing season so my screen time has been pretty light these days....

Side note: As I was looking into the broadcom specs for the CPUs used on the Raspberry Pi Model 3/Model 4, they all seem to have a DMA engine that can access their GPIOs, and thus in theory you should be able to build a logic analyzer with fast and well spaced sample rates without even using a PICO. Granted you lose analog sampling, though with the right parallel interface of a PICO feeding the GPIOs of the Model 3/4 you could likely get analog signals (up to 500Khz limited by the PICO) and higher digital sample rates.
But, what is strange is that I can't seem to find any reference to a DMA based raspberry pi model 3/4 logic analyzer on the internet, and it just seems strange that nobody has every done it. Perhaps people are just scared of programming DMA engines and just throw down the $16 for a logic analyzer and call it a day....

normanr commented 2 years ago

https://iosoft.blog/2020/06/11/fast-data-capture-raspberry-pi/ uses DMA, but seems to be for doing SPI to an ADC.

Amazingly these projects have the same name, but completely different code (and neither of them using DMA as far as I can tell)

pico-coder commented 2 years ago

FWIW, I put in a backorder for a PICO W to spark fun, no ETA provided, and they no longer even allow backorders.
Note that I'm not sure I want to go through the efforts of creating a sigrok wifi driver, so at best this might have the PICO W export a webpage to download a file. But first need to prove we can actually get a noticeable bw increase over USB....

tony1tf commented 2 years ago

Hi Shawn

One of my colleagues at EDSAC is working on a WiFi version of a Pico logic analyser. His design is very different from yours, and is considerably more complex, using external RAM chips, but at least I might be able to get the WiFi code and graft it into your design. I got my order in to Pimoroni on the day it was announced, but I guess stocks emptied very quickly.

Tony

On Fri, 8 Jul 2022 at 15:02, pico-coder @.***> wrote:

FWIW, I put in a backorder for a PICO W to spark fun, no ETA provided, and they no longer even allow backorders. Note that I'm not sure I want to go through the efforts of creating a sigrok wifi driver, so at best this might have the PICO W export a webpage to download a file. But first need to prove we can actually get a noticeable bw increase over USB....

— Reply to this email directly, view it on GitHub https://github.com/pico-coder/sigrok-pico/issues/21#issuecomment-1179025350, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJKGTWSMJCNWCSFDNVD6K3VTAYHVANCNFSM52TKGMLQ . You are receiving this because you authored the thread.Message ID: @.***>

AapoTahkola commented 2 years ago

You might have better luck getting an pico w from local sellers or small business. Couple random emails here and there. I would guess it is just temporary because there are shops with over 100 in stock here EU or nordic contries. Did the calculations and got 3 for 4.5e piece. I guess I will be using them mostly for home assistant stuff.

Anyway, I have played with esp32 wifi stuff for a long time and I can tell from experience that if pico w is anything like esp32 this stuff is fairly easy. It takes like 20 lines of code to open a port and start doing some stuff over the wifi. As this is a new chip though I might wait a bit and look at what is happening from a distance until most of the bugs are dealt with. I can see that pulseview has tcp/ip option.

mtk11 commented 1 year ago

An interesting ESP32 based project - esp32_sigrok which uses Rigol emulation to communicate via WiFi with pulseview. Also would it be possible to add support for external high speed ADC/s ? As well as use the overcloking of mcu for faster sampling ?