8 ms·
Raspberry Pico-based 100-Msps logic analyzer
- deleted 4y ago[deleted]
- Sanzig 4y agoThe Pico's PIO peripheral is actually a really innovative feature in a microcontroller. It plugs the gap where you need some sort of fast custom I/O but you don't want to go to the complexity and cost of an FPGA. I'd love to see more mainstream vendors offer something similar.
- JustFinishedBSG 4y agoIt has been a feature of many TI microcontrollers ( and CPUs ) for quite a while under the name “PRU”
- grawp 4y agoExactly. And people have been also using them for this exact purpose. https://hackaday.com/2015/02/19/turn-your-beagleboneblack-in-to-a-14-channel-100msps-logic-analyzer/ https://hackaday.com/2015/02/19/turn-your-beagleboneblack-in... But hey, put 'Raspberry' or 'Arduino' label on it and suddenly it's so new and innovative it makes me sick.
- tpmx 4y agoProgrammable Real-Time Unit Subsystem and Industrial Communication Subsystem (PRUICSS). Documentation: Pages 198-521 out of this 5118 page PDF: https://www.ti.com/lit/ug/spruh73q/spruh73q.pdf https://www.ti.com/lit/ug/spruh73q/spruh73q.pdf
- sbf501 4y ago> But hey, put 'Raspberry' or 'Arduino' label on it and suddenly it's so new and innovative it makes me sick. I get why you feel that way. I think that's the nature of the huge internet and younger folk learning every day. I totally get pissy every time I see someone repost a "discovery" that is 20~30 years old and I've seen many times, just to farm clicks, karma, or whatever internet points their platform rewards. But I think that's just life now: everything is "look at me!" tiktok-ified, even engineering. But the dude really is pushing the limits of the PICO here, always nice to see someone doing something other than blinking LEDs and jizzing about it on reddit, right?
- colejohnson66 4y agoFor one thing, the PRUs require TI’s bloated mess called CCS and knowing C whereas the PIO assembly can be written in Python. What’s really innovative is the ability to get PRU-like functionality on a literal $1 IC. Sure, you only get 32 instructions per state machine, but not everyone needs full blown ARM cores for real-time.
- rcxdude 4y agoThey don't require it. When I used it, everything was just written in assembly (you get a few more instructions but you're still basically doing bitbanging with cycle counting, so using C is a bit awkward anyway). The PIOs are a pretty neat trimmed down version of the idea though, clearly someone put a fair amount of effort into making them as flexible as they are for how minimalist they are.
- jrockway 4y agoI think C is a trap, honestly. I have used the PRUs before and wrote my code in C. 99% of the time, I was just reading the assembly outputs trying to figure out how many instructions some C statement actually compiles to. Should have just written raw assembly for the timing-sensitive parts.
- JustFinishedBSG 4y agoIt's getting better: https://simppru.readthedocs.io/en/latest/ https://simppru.readthedocs.io/en/latest/
- funstuff007 4y agoMaybe because the primary markets for TI and Raspberry are different.
- gchadwick 4y agoBit of a difference between a cheap microcontroller board and a BeagleBone Black. Superficially the PRU and the PIO do indeed look similar. Look more closely and you'll see the PRU is both more complex and more capable than the PIO. It's a small CPU core in its own right with predictable timing. PIO is significantly simpler, almost more of a programmable state machine than a proper CPU. So yes less capable but also integrated into a cheap micro-controller rather than a Linux booting SoC with all the complexity and cost that brings. That really is why the PIO is interesting, it's the significant capabilities they bring combined with the low price point and simple chip.
- reportingsjr 4y agoOr, more like TI locked you in to their garbage IDE that cost quite a lot of money to unlock fairly standard debugging and compilation features. They entirely shot themselves in the foot with that one.
- IshKebab 4y agoAnd let's not forget poor XMOS.
- agapon 4y agoAlso, PSoC-s from Cypress. https://en.wikipedia.org/wiki/Cypress_PSoC https://en.wikipedia.org/wiki/Cypress_PSoC
- Sanzig 4y agoI thought the PRU was only available on their ARM A-series SoCs? I'm more referring to a bare metal microcontroller class part.
- tpmx 4y agoI would love a version of Pico PIO with analog out (along with a limited integer ALU, or perhaps just shifts and some logical ops). A fast DAC should be cheap in silicon, right?
- regularfry 4y agoThe pimoroni servo2040 uses the PIOs to PWM 18 servo channels: https://shop.pimoroni.com/products/servo-2040?variant=39800591679571 https://shop.pimoroni.com/products/servo-2040?variant=398005... I'm annoyed at the power arrangement on the board but they're fun to play with.
- tpmx 4y agoThat's a nice usecase. Servos are slow mechanical things. I wanted to make a CGA/EGA-to-VGA converter, possibly combined with a scandoubler. Maybe it's still possible using resistor arrays on the output side.
- petra 4y agoVendors won't offer that capability cheaply. That's against their business model of "differentiating" on peripherials and extracting value from that. So it would be interesting how this will affect the mcu market, long term.
- Dries007 4y agoLooks great, only question is why invent your own software when sigrok exists?
- slig 4y agoWhy build your own logic analyzer when you can buy one Banggood?
- iasay 4y agoThis. I own a shitty one from Aliexpress. That and sigrok are better than my old full 4U HP crate I had. But if you want to build one, why not?
- the_biot 4y agoFor one thing, the author could have avoided all the work of creating a GUI and lots of protocol analyzers, and thus got his project working faster. This could have been as simple as writing a sigrok driver, a process which is very easy thanks to some helper scripts and lots of examples.
- deleted 4y ago[deleted]
- analog31 4y agoI found the sigrok website hard to navigate, and never found these examples. I'd love to learn more, as I just threw a decent fast ADC together for fun.
- the_biot 4y agohttps://sigrok.org/wiki/Developers#Development_guidelines https://sigrok.org/wiki/Developers#Development_guidelines It's all there, and linked from the wiki's main page, it's just that there's so much of it. Examples: http://sigrok.org/gitweb/?p=libsigrok.git;a=tree;f=src/hardware;hb=HEAD http://sigrok.org/gitweb/?p=libsigrok.git;a=tree;f=src/hardw...
- geerlingguy 4y agoPeople sometimes dismiss the Pico in comparison to an ESP32 or other ESP-based devices (even the newer Pico W, which has wireless capabilities, with Bluetooth LE potentially added via software update in the future), but I've seen Picos running as N64 flash carts, logic analyzers, signal generators, etc. in places where formerly only more expensive FPGAs or low power ARM SoCs (not on the microcontroller level) were used before. It's not punching too much above it's weight, but the PIO does seem to be a very useful feature. I know there are still other advantages of the ESP32 (especially in some of the newer revisions, like upcoming Matter/Zigbee support built in), but I think some people are too quick to dismiss the Pico's RP2040 as overpriced compared to the alternatives.
- _Microft 4y agoThe mentioned N64 cartridge is most likely this project: https://github.com/kbeckmann/PicoCart64/ https://github.com/kbeckmann/PicoCart64/ The creator tweets about it frequently [0], in particular this thread [1]. [0] https://twitter.com/kbeckmann/ https://twitter.com/kbeckmann/ [1] https://twitter.com/kbeckmann/status/1538634588020424708 https://twitter.com/kbeckmann/status/1538634588020424708
- fnordpiglet 4y agoThat’s literally super cool.
- derefr 4y agoAnd on a similar note is the PicoBoot, a Pico-based modchip for the Gamecube (https://www.tomshardware.com/news/raspberry-pi-pico-gamecube-modchip https://www.tomshardware.com/news/raspberry-pi-pico-gamecube...).
- fpgaminer 4y ago> but the PIO does seem to be a very useful feature. Back in the early days of RasPi there was a competitor, the BeagleBone Black. It was similar to the Pi in many ways, but included embedded MCUs that were meant in much the same ways as the Pico's PIO. You could use them to bitbang protocols that would be difficult/impossible/unreliable to run on the SoC itself. I thought it was a brilliant idea, but the BeagleBones never got the same level of support that the Pi did. The few times I tried using my Black, I ran into numerous deal breaking bugs. It's great to see the spirit of this idea is still alive and well. I've got my fingers crossed that they somehow convince Broadcom to build PIO into their SoCs.
- bragr 4y agoI've previously used an Arduino mega as an ad hoc logic analyzer. Can anyone chime in with how the IO performance of the RP2040 differs from the ATMega range? I'm an amateur so can't really justify a real logic analyzer, but my hacked up sketches and python scripts for the Arduino have nothing on this level of polish so definitely going to give it a try next time!
- danhor 4y agoI'd really recommend an fx2 logic analyzer. Basically anything called logic analyzer on Amazon or Aliexpress with 24 MHz sample rate, 8 channels and for less than 15 bucks. They work with the open source sigrok software and basically just DMA the io to the host, thus the sampling rate and the cost, but can record for dozens of minutes.
- bpye 4y agoYou can do better with an FX3 dev kit - https://community.infineon.com/t5/Knowledge-Base-Articles/EZ-USB-FX3-Explorer-kit-as-16-channel-100-MHz-logic-analyzer-with-sigrok/ta-p/283993 https://community.infineon.com/t5/Knowledge-Base-Articles/EZ...
- balefrost 4y agoThe RP2040 has a programmable IO subsystem. This lets you define a simple state machine that manages the IO pins and can transfer data to/from memory. Here's what the project's README says: So, how the heck the pico is able to achieve this? Well, the key are the PIO units, these units are a wonder, they are coprocessors explicitly dessigned to handle IO, it uses a very restricted and deterministic assembler (only nine instructions that each take a single cycle to execuet) but extremely efficient, so efficient that with only two instructions is possible to create a loop that captures GPIO data up to 30 bits and redirects the program flow based in the status of one of these GPIOs.
- sbf501 4y agoThat's impressive. I was suspicious until I saw the quad-byte DMA ringbuffer with the super small PIO program. He's overclocking to 200 MHz (!!!) and the framing protocol does have bugs (see comments), but impressive all the same. Also the message buffer is pretty small but now I'm just being picky: streaming to UART while sampling wouldn't be possible without giving up some channels and slowing down the sample rate.
- ChuckMcM 4y agoThis kind of project is really nice, there is a great design document which talks about issues building logic analyzers out of Cortex-M boards here: https://sysprogs.com/w/how-we-turned-8-popular-stm32-boards-into-powerful-logic-analyzers/ https://sysprogs.com/w/how-we-turned-8-popular-stm32-boards-... which you may find helpful as well. Of note, the Teensy-4.1 uses the Cortex-M7 which is even more impressive than the Pico in terms of raw computer. A long time ago there was a company called "boulder creek engineering" which made a very clever logic analyzer where the trigger pattern was downloaded into an FPGA which made for a easier code (the FPGA would set a 'trigger' bit and software could use it as the store/don't store flag). The HP Logic Dart had a feature which I've yet to see reproduced on any logic analzer (even the multi thousand $$ ones) which is you could set the Vhigh and Vlow thresholds over a wide range which would let you work with everything from TTL to LVDS signaling all in the same instrument. Sadly I don't think anyone makes the 100MHz comparator pairs that would be needed for this.
- CamperBob2 4y agoSadly I don't think anyone makes the 100MHz comparator pairs that would be needed for this. A differential input is a comparator, in a sense, and an FPGA has plenty of those that are useful to 100 MHz+. A trimpot might be used to scale the voltage threshold as needed.
- ChuckMcM 4y agoThat would be a good hack.
- skybrian 4y agoNice! Looks like the protocol between the Pico and the Windows software is quite simple. Porting it to another OS shouldn't too hard. Here's an unusual approach to portability for this kind of software: since Chrome supports Web Serial, a web app could do the UI and then it would be portable across operating systems (though still Chromium specific) with no software to install (assuming you already have Chrome or Edge). Along those lines, I wrote a little web app that plots CSV data from a microcontroller board (which happens to be a Pico). There's not a lot to it, but I like it better than the Arduino plotter and it might be useful as an example: https://github.com/skybrian/serialviz https://github.com/skybrian/serialviz
- my123 4y ago> Here's an unusual approach to portability for this kind of software: since Chrome supports Web Serial, a web app could do the UI and then it would be portable across operating systems (though still Chromium specific) with no software to install (assuming you already have Chrome or Edge). Why even use that, might as well use the Pico W and regular HTTP(S). Web Serial is a bad idea...
- skybrian 4y agoI quite like using USB-connected microcontrollers and Web Serial. I'm working on a MIDI controller, so WiFi isn't a good idea due to the latency. (Not to mention the running a web server on a Pico would probably get in the way of real time stuff.) Firmware programming is a small niche, but it's been useful and I hope other browsers support Web Serial eventually.
- childintime 4y agoI've been wanting to do something like this, looks great.
- girvo 4y agoVery cool stuff! I recently bought a cheap-ish “Zaleae [sic] Logic 16” knock-off from eBay, but it’s still a lot more expensive than most of the other cheap ones out there. I was stoked to see it works perfectly with Saleae’s latest Logic software, and it ended up with my boss buying us all a set of real Logic Pro 8’s for work. Their software is by far the gold standard for logic probe capture and analysis, I wonder if it would be possible to hack on this project to get it to output to Logic? Being able to whip up quick protocol decoders in Python (which then get baked into our actual firmware as a driver by porting it to Nim in about 10 minutes of work) for some of the obscure protocols and peripherals we have to connect to has been fantastic, and Saleae’s software makes it super easy. Would be great to get the benefits of both cheap hardware and great software but aside from the knock off in front of me showing it can be done, I’ve no idea how you’d even begin to do it!
- MayeulC 4y agoSoftware-wise, there's also Sigrok, which is open, and the corresponding Pulseview UI. I've been very happy with it, together with cheap Saleae ex2law-based clones, but I have never tried Saleae's software, so I lack a point of reference.
- girvo 4y agoSigrok is decent too, very powerful, but Logic’s UX and workflow is just so much nicer, at least in my opinion anyway. It’s protocol decoder API is quite a bit easier to use, though I did not go anywhere near as deep in that with Sigrok, to be fair.
- MayeulC 4y agofx2lafw*, I blame autocorrect
- numpad0 4y agoTime to pull the low cost Lighthouse V1 tracker project back from the shelf. This is what I needed for one!
- gtsnexp 4y agoWho will be the hero that will port this from .NET to Python?