/
030: Multi-Processing

030: Multi-Processing

It's tricky to handle the audio and the potentiometers – both time-sensitive tasks – with one processor.  We've been pausing every 256 audio samples to handle the user interface, which works okay, but requires that we pay attention and not wait too long before returning to the audio, lest we underrun the I2S write buffer.

Fortunately, the RP2040 has a built-in solution: a second processor.  We'll dedicate that processor to handling the audio sample data, and use the first processor for the user interface.

Here is PicoADKChirpPots modified to use the second processor:



That change was almost too easy.  A professional piece of code would use the existing inter-processor buffers and semaphores that are built into the RP2040 hardware, but in truth, since the data flow is always from the UI processor to the audio processor, simply cutting the tasks up and relying on shared memory works well enough.

Related content

050: High-Accuracy ADC
050: High-Accuracy ADC
More like this
040: Adding MIDI
040: Adding MIDI
More like this
200: Analog -> Digital -> Analog on the PicoADK2
200: Analog -> Digital -> Analog on the PicoADK2
More like this
080: Wavetable Synth
080: Wavetable Synth
More like this
070 Sample Player
070 Sample Player
More like this
Demo 5: Custom SAMD51 processor
Demo 5: Custom SAMD51 processor
More like this

Copyright © 2024 The President and Fellows of Harvard College * Accessibility * Support * Request Access * Terms of Use