Close
0%
0%

DS-Pi | RP2040 Audio DSP Board

An audio DSP platform based on the Raspberry Pi RP2040

YJYJ
Public Chat
Similar projects worth following
The DS-Pi is an open-source RP2040-based audio digital signal processing platform that can be used to perform filtering and other DSP processes on audio inputs and outputs. It leverages the low-cost and highly accessible platform that is the RP2040 and a powerful audio codec from Texas Instruments, the TLV320AIC3254.

Check out my other projects, stay up to date, and support me on Ko-fi. (ko-fi.com/elektrothing)

The DS-Pi is an open-source RP2040-based audio digital signal processing platform that can be used to perform filtering and other DSP processes on audio inputs and outputs.

Before diving further, I have to thank JLCPCB for sponsoring this project. They have been a crucial part of the process by enabling me rapid prototype without any compromises in quality. All of the PCBAs related to this project were prototyped and assembled by them.  I highly recommend them as they are high quality, cost, and time-efficient, if you do intend to design and build any boards of your own.

What is it

The DS-Pi leverages the low-cost and highly accessible platform that is the RP2040 with a powerful audio codec from Texas Instruments, the TLV320AIC3254.

The RP2040 is compatible with Arduino, Micropython, and CircuitPython which makes it accessible to all tinkerers with an interest in audio signal processing.

Key Features;

  • Raspberry Pi RP2040 Microcontroller
  • TI TLV320AIC3254, Very Low-Power Stereo Audio CODEC with programmable miniDSP
  • On-board MAX97220BETE+T Headphone Amplifier
  • 3.5mm connectors for inputs and outputs as well as screw terminals for rapid prototyping
  • Fully functional header outputs - same as Pi Pico

Use cases

Guitar FX

Standing on the shoulders of giants, one of the aims of this project is to make the platform fully compatible with the work that Blackaddr has worked on for the Teensy platform. While there might be some limitations with hardware, the dual-core M0s on the RP2040 should be able to cope with some interesting processing.

Customizable Guitar Amp Modeler (WIP)

Driven by a personal interest/need, this platform could be used for bedroom guitarist who wants to jam into the wee hours of the evening with their headphones and hopefully an amp model that they can customize.

Specification

  • Microcontroller | RP2040
    • Processor | Dual-core ARM Cortex M0+ processor, flexible clock running up to 133 MHz
    • FLASH | 4MB
    • Programming | Drag & drop over USB or Serial Wire Debug (SWD)
    • I/Os | 2×SPI, 2×I2C, 2×UART, 3×12-bit ADC, 16×controllable PWM channels
    • 8×Programmable IO (PIO) state machines for custom peripheral support
  • Audio Codec | TLV320AIC3254
  • Connectors
    • MicroUSB | Programming/UART
    • Microphone Input | 2x Screw Terminals
    • Headphone Input & Output | 1x 4-Conductor 3.5mm Female & Screw Terminal
    • Line Out | 1x 3-Conductor 3.5mm Female & Screw Terminal
    • PWM Out | 1x 3-Conductor 3.5mm Female & Screw Terminal
    • Headers | 2x Headers featuring standard pinouts from Raspberry Pi Pico
  • Power | 1A 3.3V LDO - AMS1117
  • Mounting Options | 3x M.2.Screws

  • Announcement and project update!

    YJ11/14/2022 at 12:22 0 comments

    ANNOUNCEMENT 

    Thank you all for the support I have received over the past year. 

    I really appreciate the comments and feedback through this forum and I fully intend to update my content here frequently with useful content as soon as they become available. However due to the format of this platform, it is quite difficult to present small yet important updates, therefore I am creating an Instagram page where I will post my content more regularly and also demonstrate more of the "behind-the-scenes" work that goes into creating my projects. 

    You can access my Instagram page here, elektroThing (@elektrothing) • Instagram photos and videos.  For those of you who do not want to use Instagram, I am also launching my website, elektrothing.com, which will serve as the landing page for all things elektroThing. :) 

    PROJECT UPDATE

    Progress has been slow and it is all my fault. I want to give a shoutout to gluons's Profile | Hackaday.io again because his help has been invaluable in proving that the hardware is working.  He wrote the initial drivers needed to set up the DAC and generate sounds. 

    Next up for DS-Pi is to;

    1. Migrate the existing firmware to C++
    2. Sample using I2S. 
    3. Hardware design changes - connectors, better analog/digital isolation, fixing the MEMS mic amp, adding a pot to the headphone amp, etc.
    4. Write firmware that allows for the use of the dual M0 core on the RP2040. One for sampling, one for DSP, and generating sounds.

    Do reach out if there is something on this list that you would like to help with. I am more than happy to send over a board and in return get some work off my shoulders.

  • Audio Generation...Success! :)

    YJ06/12/2022 at 17:50 0 comments

    Hi all, 
    Thank you so much for all of your support and interest into this project so far and no credit to me at all, I have some great news. 

    Hackaday user, gluons, has been working on writing the I2C drivers to correctly setup the TLV320AIC Audio Codec as well as the I2S drivers to generate sound and they were all written in MicroPython. The reason we wanted to do this is to build more confidence in the hardware design quickly so that we can now start software development  in C++ in hopes to perhaps write wrappers to already existing audio processing libraries. I have sent over a version of the DS-Pi to him and you can see what he's been able to do with it in the video linked to this post.

    So the plan now is to clean up the hardware design and begin to try to use it in more typical applications. Will update you guys in due course, I will be off this summer on travel but will pick up the work again in late summer/ early autumn. When I am happy with where the hardware is, I will put the hardware up on Tindie for you guys to get your hands on it! :) 

    Thank you again gluons and enjoy!

  • Boards up and running! (Also a call for help)

    YJ04/27/2022 at 21:59 0 comments

    Hi all,
    Just a small update for you. 

    I have gotten the board up and running and tested some of the capabilities to date so I am confident that the hardware design doesn't have any major flaws and all of the components are working as they should. My plan for the coming month of May is to slowly chip away at the datasheet to configure the TLV320AIC3254 Codec over I2C. I have been able to read and write its registers but am still trying to write the drivers for it on the RP2040. 

    This leads to my call for help, does anybody know of any available drivers for this IC (TLV320AIC3254) out there? Also on a similar note, thoughts on how to generate the MCLK line using the RP2040? 

    I am open to having a chat about perhaps sending over a sample PCB if you have the experience with what I am trying to do here. 

    Thanks. 

View all 3 project logs

Enjoy this project?

Share

Discussions

tywy wrote 06/13/2022 at 08:40 point

please add for example esp and show wifi radio device (or ethernet or ... normal antena)

  Are you sure? yes | no

MDC Service wrote 05/12/2022 at 16:25 point

You could take a look, how nuttx implemented the I2S driver. Or just use nuttx, it supports the RP2040, and people actively develop on the RP2040-I2S (https://www.mail-archive.com/commits@nuttx.apache.org/msg33600.html). This at least generates a phase aligned MCLK signal, and play audio. And nuttx have a whole audio sub-system with audio player, etc.

In contrast what gluons suggest, I would not use the PIOs because it will not be phase aligned with the SCK signal, and only be a source of all kinds of problems.

Additional to just play audio, you will need to program all the DSP register to make full use of the 2 DSPs on that TLV320AIC3254. If you can't find other porting sources, I would suggest you kindly ask TI direct, they may have that MCU C code for one of there Eval boards. 

Maybe interesting:

https://www.researchgate.net/profile/Masayuki-Ishikawa/publication/316921696_Developing_Audio_Products_with_Cortex-M3NuttXC11/links/59192c00aca27200fe52f809/Developing-Audio-Products-with-Cortex-M3-NuttX-C-11.pdf?origin=publication_detail

  Are you sure? yes | no

gluons wrote 05/14/2022 at 19:22 point

Hi there, thanks a lot for the insight!
I didn't really think about the phase difference between clock signals, however I suggested this approach because I saw other STM32 designs with similar codecs that generated the MCLK signal with the MCU. If it doesn't work maybe an external crystal might be needed.

I got in touch with YJ and helped develop basic firmware to configure the codec and generate a sine wave. You can see the code here: https://github.com/elektroThing/DS-Pi/pull/1

If you've got experience with DSP systems maybe you can take a look at the code, this firmware will be tested soon on the hardware so any advice would be appreciated. The code is also open source so if you find an issue or want to contribute then by all means do.

  Are you sure? yes | no

MDC Service wrote 05/16/2022 at 06:10 point

Hi YJ and gluons, I have to correct my self. I had the imagination, that the RP2040 have already a I2S block in hardware,  but recheck the DS, it does not. So using the PIO is the only way to go.

A quick search brought up, that the Arduino core for the RP2040 have already a PIO implementation of I2S. See here

https://github.com/earlephilhower/arduino-pico/tree/master/libraries/I2S/src

It is active developed, last commit was 11 days ago. You could base on this code for the beginning, its LGPL, and focus on getting the MiniDSP configuration up and running. If needed, you could then port it to the C++ SDK of the Pico.

From you problems you stated

1. Real frequency of the MCLK signal: By using the arduino-I2S is suggested, should solve this problem. It also adds DMA, different I2S frequencies, different bit width and so on

2. I2C protocol for the TLV320AIC3254: I would suggest, you ask in the TI forum. These TI engineers are very helpful, and you get an expert answer within a few days. They sure have a bare metal. You program in Python, what I am not familiar with, so I can't help here.

3. init_aic3254(): same as above, the TI forum would be the fastest help.

4. I2S audio output: The correctness of these signals can easily be heared by head phone. A fast logic analyzer (maybe again a RP2040?) could confirm it.

Wish you best success!

  Are you sure? yes | no

MDC Service wrote 05/16/2022 at 06:35 point

Setting up the TLV320AIC3254-MiniDSP via I2C and setting up the right values into the register, is supported by the TI GUI Tool PurePath™ Studio. You can download it for free from TI, and it generate the *.h file with all correct values.

There is even an application note, explaining step by step how this is done with a MSP430 MCU: https://www.ti.com/lit/an/slaa605a/slaa605a.pdf?ts=1652681851943&ref_url=https%253A%252F%252Fwww.ti.com%252Fproduct%252FTLV320AIC3254

It should be easy to port this from MSP430 to the RP2040, if you use C/C++. I have no idea about Python.

  Are you sure? yes | no

Patrik Källback wrote 05/09/2022 at 12:07 point

Hello, sounds like a nice project! I found following code for linux drivers: https://www.ti.com/tool/TLV320AIC32X4SW-LINUX. I guess you can extract things out of the code to fit your project.

  Are you sure? yes | no

gluons wrote 05/02/2022 at 18:18 point

I'm really looking forward to see how this project goes! Regarding your question about generating the MCLK line with the RP2040, I took a quick glance at the datasheet and found out that the MCLK input should be around an integer multiple of the sampling rate (I imagine it will be the standard 44.1 kHz or 48 kHz). The datasheet links to an application reference guide (https://www.ti.com/lit/an/slaa408a/slaa408a.pdf, p. 79) which has some examples on what frequency the MCLK should/could be set. This clock is usually set at around 2 to 5 MHz. Given these frequencies I would try to use the PIOs of the RP2040 to generate precise clocks (I think PWMs signals generated by the RP2040 are a lot less precise and can't generate such high frequencies).

  Are you sure? yes | no

Dean wrote 04/18/2022 at 08:05 point

Superb, which EDA package did you use? there's a current lack of RP2040 projects using EASYEDA

  Are you sure? yes | no

YJ wrote 04/27/2022 at 15:04 point

Hi, I used Kicad. 

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates