Using PWM for Audio with PPI

Hi,

I want to implement an audio feature via the nRF52, using PWM, I want to play a audio sequence, changing the PWM definitions in a fast rate, and thus would like to use PPI, is there an example of something like that, is that even possible?

Thanks!

  • Hi Eran

    It is certainly possible to do what you describe, yes. The question is what kind of sample rate and bitrate you need for the audio? 

    I implemented some code a while back to do music generation in the nRF52. This wasn't for playback of audio files, but for sound generation, but the principle for setting up the PWM could be the same. You can have a look at the PWM setup here

    I didn't use a timer to control the PWM over PPI, but rather relied on the PWM module to advance the buffer after every PWM period. When doing this the sample rate will be dictated by the PWM top value. In my case I used a top value of 255 (for 8 bit audio), which in turn gives me a sample rate of roughly 62kHz. 

    Best regards
    Torbjørn

Related