All hail the RPi RP2040! |
BUT FIRST--A MESSAGE ABOUT MY SPONSOR
I don't do this sort of plug often, really almost never, but the good folks at PCBWAY have been going the extra mile for this blog for a long time now and deserve a bit of extra love.
They approached me a few years ago with a sponsorship deal--something I didn't think much about before I got their "is this real?" email.
The offer surprised me--this blog was my trail of crumbs to help me remember whatever new self-taught EE skills I stumbled upon....the blog can be extremely geeky and well off the beaten path at times....some of my posts have a ton of views but some not so many...I never considered any sort of sponsorship or monetization.
But, I said: sure.
I had used PCBWAY's services before the deal began and had really good interactions with them....PCBWAY offered services at a low price, things I couldn't find elsewhere--for instance, affordable sheet aluminum fabrication I used for front panels—yes, in a previous life I used aluminum sheet and a thermal decal process for electronics projects:
With a huge amount of PCBWAY's support my front panels are looking better I think--PCBWAY manufacturers the PCBs I use for this blog, provides the 3D printing for brackets and whatnot, as well fabricating as the front panels I use in my rack.
Anything I've ever gotten from PCBWAY has been super solid, of great quality, and they have always gotten the boards to me very quickly.
Most of all I've been impressed with how friendly their staff is. Super nice, very enthusiastic, very helpful. Funny, they're half a world away, but they feel a lot closer than that.
OK on with the post.
DMA
I've done zero work with DMA to date.
The elevator pitch: data is sent to or from memory to a peripheral without bogging down the processor--in fact, DMA involves little to no processor interaction at all.
Good general introductions to DMA are here and here--a million and one uses, especially since when processing digital audio we have to move data around fast.
So, where to start?
The DMA function calls from the Pico SDK and RPi's embedded C examples were a bit daunting. I needed to look elsewhere.
To this end I googled the stuffing out of "RPi Pico DMA" and its variations.
This led me to a wonderful series of videos by Cornell lecturer Hunter Adams. He took the content of one of the EE/CS courses he teaches--ECE 4760/5730--and put it on YouTube.
ECE 4760 covers DMA in depth but a whole lot more. Think of it like this: everything you ever wanted to know about RP2040s....as well as other far ranging topics....extremely useful for all kinds of things we do...rolled into a single semester blow-out.
This guy is a terrific, top-notch explainer, he's enthusiastic and encourages his students to get involved and passionate about projects, he's entertaining, and his example code is useful and exceptionally well documented.
Begs the question--back in my day, why the hell didn't Cal have anyone on staff who took teaching undergraduate EE seriously?
Run, don't walk, and check out his videos, starting here.
Makes me wish I was young again.....
OK....after emailing Mr Adams to get permission to use the his code (he said OK) I got my first DMA bench experiment working, get the embedded C here.
Here is the wiring I used:
Victory! Sine wave at output, derived from DMA--with no code in processor main() loop.
Very Nice.
I went through the code, trying to understand what each part of it did. Fortunately Hunter's documentation is extremely thorough so this wasn't too onerous.
Again, you can get his code and documentation here. Unasked for advice: Don't just compile the code and upload it--to paraphrase Michael jackson--just Read It! I won't repeat what Mr. Hunter's notes here, rather, present some of the takeaways of my own.
No comments:
Post a Comment