-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add RP2 PIO background read #9659
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this, I'm excited!
I did have some review comments & requested changes. I also didn't actually test the code. Any suggestion on something that would be useful to try/test if I don't have a TAC5xxx codec?
For testing with no codec, I'm getting together a loopback example similar to https://github.com/adafruit/Adafruit_CircuitPython_PIOASM/blob/main/examples/pioasm_i2s_codec.py that will send a |
I've added a loopback example at https://github.com/timchinowsky/tac5 which you should be able to run as is on a Feather RP2040 if you connect DOUT (D9) to DIN (D10). |
The last two commits add double buffering and a with open(filename, 'w') as f:
while True:
f.write(self.pcm.pio.last_read) With the double-buffering and The four-line sections starting with |
b5019a4
to
10dfea4
Compare
Background playback of 8-channel audio from SD card to a 4-codec TAC5212 setup now working! Details at https://github.com/timchinowsky/tac5. |
Hey @timchinowsky ! I've been loving this new feature and have recently implemented in a simple general purpose I2S library: https://github.com/relic-se/CircuitPython_I2SInOut. So far so good, but if you need any assistance with reviewing these updates further, let me know how I can help. |
@relic-se that's great, thanks for letting me know! |
I'm not certain exactly what your goals in the recent updates are, but rather than building bespoke audio DSP processes for the rp2pio module, it would likely be better to find a way to integrate it into the existing audio systems of CircuitPython using the audiosample API. That way the existing processing modules could be used with custom PIO systems (ie: Alternatively, a separate |
It's also possible to feed data from rp2pio into an |
Yes, totally. I was thinking when I started this that I would be leaning more on That said, I also like the idea of enabling I'm also planning to continue filling out the API for the TAC5212 codec. For instance, the part has built in biquad filters on both ADCs and DACs (up to 3 per channel) and optional loopback between ADC and DAC, so the part can be used to implement 6-stage biquad analog-in/analog out filtering without any microcontroller involvement at all. |
Okay, I see where you're coming from here. Multi-channel output is fairly niche, so I don't think it's at the forefront of development in those areas. Yet, I don't see why one could operate with multiple mono/stereo outputs simultaneously as you've described for the time being. As I've been playing around more with the API, I do think it's possible to connect an object like
Currently, the new I'd really like to see the new |
SGTM 🚀 |
Not sure why the
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are three regressions in submodule versions. See the first three entries in "Files changed". There shouldn't be any submodules listed in there for this PR> You can update submodules locally and then push again. The submodules don't get updated automatically necessarily when you merge from upstream.
Thanks @dhalbert! I can update locally with |
75501d4
to
b83a1d7
Compare
You commit the changed commits for the submodules. |
@dhalbert thanks, but we would have had to get into details to debug what I was seeing. I was trying to do as you say, but things were not acting as expected. For now, I short-cut the process by cloning a fresh copy of main and re-applying the changes. Now it looks like the build is too large for some boards? |
I update submodules using this alias (for convenience):
Yes, the Wiznet boards were very close to full. Let's turn off USB host on those two boards. Add this to
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some review comments. Thanks you in advance for addressing them!
There is trailing whitespace on line 148 of StateMachine.c |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, that addressed my requested changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
submodule skew is fixed
I did a quick test of adafruit_neopxl8 which uses the old single buffered background write and it still functioned properly with Adafruit CircuitPython 9.2.0-38-g8d561a0b0e-dirty (this PR) |
just testing the built in neopixel on rp2350: >>> import adafruit_neopxl8
>>> import board
>>> n = adafruit_neopxl8.NeoPxl8(board.NEOPIXEL, 1, num_strands=1)
>>> n.fill(0)
>>> n.fill(0xff00) |
Thanks for the test @jepler! |
This PR adds a
background_read
method torp2pio.StateMachine
to complement the existingbackground_write
.