Verdin iMX8 audio development

Hi everyone!

In our team, we’re starting a development that will require to design a carrier coard for iMX8 plus.
We need to use the audio output to drive a small speaker (less than 5W of output power).
In Verdin, there’s no analogue output, there’s an I2S digital output.
So, we have to convert this digital signal to analogue first, then amplify for driving an speaker.

At this point, we realised that there are different options we can take.

  • Option 1: to use an audio Codec to convert digital/analogue, and then use an analogue amp with fixed gain.
    For this option, i’ve been reading this article and it seems that Codecs WM8904 and NAU8822 are the best options because there are already integrated in Linux (and are mounted in Dahlia and Verdin Dev Board). Another one we could probably use is SGTL5000.
    However, these 3 codecs are quite “old” (+10 years), and we are afraid that could become obsolete in a few years.

  • Option 2: to use a Digital Amplifier that perform both actions, convert digital/analogue and drive the speaker.
    In this case, there are several options in the market, but lot of them are highly complex and our application doesn’t require too much complexity. On the contrary, we prefer the solution to be as simple as possible.
    Looking in the web, i’ve found a few options that could suit our needs. For instance, MAX98357A or TAS2563.
    I’ve also saw that there are drivers available for these amps (on torvalds git “linux/sound/soc/codecs”).

For the digital amp option, i have a few doubts:

  • Is it possible to perform a volume control in a digital amp with fixed gain (like MAX98357A)?
  • Does someone has been using an digital amp solution for some application? What amp do you recommend to me? Linux drivers’ are functional?

Thanks!
Best regards,
Juan

I have implemented the digital gain control with MAX using SW running on M7 core.

Hi @IngenieriaCuffia ,

Both options may work for your needs, about the WM8904 and NAU8822 becoming obsolete, I’m verifying internally if our development team has some worries about this too, I will let you know as soon as I find any information.

About the second option, I suggest you look into this question where this was already implemented on the same family.

Best regards,
Daniel Morais

Hi @Vladimir!
Thank you for your answer.

Could you give me a few details about your implementation?
I mean, a brief description of how do you implemented that digital gain control.

Also, how was in general your experience with MAX98357A?

I’m waiting for some MAX’s dev boards to arrive in the next weeks (SparkFun and Adafruit ones), so i’ve couldn’t test it yet.

Best regards,
Juan

Hi @daniel_m.tx!
Thank you for your answer too.

First of all, any information about codecs’ obsolescence will be very useful to me! Hardware design nowadays is like the word itself… hard! :rofl:

Secondly, I checked that question you suggested and i’m sure it will be helpful when we start the software development. We are waiting for some MAX’s dev boards and Verdin’s carrier boards to arrive.
I have one doubt… In that case, how could I perform a volume control? Does MAX98357A driver have this feature?

Best regards,
Juan

Pretty simple: One ring buffer maintained by I2S tx interrupt. The samples are scaled before write to I2S tx FIFO. On the disk all samples are normalized to 0 dB and attenuated by scaling. Using 16 bit signed signal samples scaling performed using 32 bit signed integer arithmetic in 32767 steps. This is simple method and works in this use case. For more complex scenarios (and/or offload) I will try to write one SDMA task (copy + scaling) or activate DSP unit.

1 Like

Hi @IngenieriaCuffia ,

I’ve searched internally with the team, and we have some expectations that the WM8904 and NAU8822 can become EOL between 4 ~ 8 years, but this is totally dependent on the suppliers.

About the volume control, I’ve verified the drivers and didn’t find any information regarding this, so you will have to implement one solution by software, you can use the example that @Vladimir mentioned above.

Please let me know if you need any further assistance.

Best regards,
Daniel Morais

Thank you very much @Vladimir !!!
I’ll try this when the dev boards arrive!

Best regards,
Juan

Hi @daniel_m.tx,

Thanks for the hardware EOL research! This information will help us define which option best suits our needs.

About MAX drivers, I’ve also reviewed them and I understand the same as you. No volume control.
So, I’m afraid we’ll have to implement it “by hand”. I think Vladimir solution will be helpful then.

You’ll probably see me again here when we start development in dev boards! :smile:

Best regards,
Juan