How to do audio with a DAC?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to do audio with a DAC?

Jump to solution
1,982 Views
q1220200
Contributor III

Hello,

I'm working with a FRDM-KL25Z and I need to produce analog audio output from the board.

Can anyone point me in the right direction for how this is typically done on a controller like this?

I've done this before on smaller 8-bit processors, but the Arm Core M0+ is quite different, plus I noticed there's DMA. My needs are fairly basic: single channel, 8-16 bit samples, 11-22khz sample rate should do it.

  • Can the DAC (more or less) directly retrieve its values from memory?
  • Callbacks aside, will the DAC with hardware buffer operate asynchronously to the main loop?
  • Can you recommend any good, clear example code or tutorials?

To be completely honest, I don't know what I don't know. Just need to be able to produce some basic audio (hopefully) without completely tying up the CPU core.

I'm currently working with MCUXpresso SDK, but I'll take any applicable code that I can compile and run.

All help will be greatly appreciated.

Paul Swanson

1 Solution
1,680 Views
nxf51211
NXP Employee
NXP Employee

Hi,

Yes, you can retrieve values from the memory by using DMA with DAC, and also it is possible to have the DAC operating asynchronously to the main loop. I recommend you check the following guide on how to implement audio output for kinetis: https://www.nxp.com/docs/en/application-note/AN4369.pdf 

Best Regards,

Ricardo Delsordo.

View solution in original post

2 Replies
1,680 Views
mjbcswitzerland
Specialist V

Hi Paul

For the ultimate solution see the uTasker project. It includes off-the-bat signal generation to DAC output using DMA (or to PWM outputs), or USB to DAC. It simulates operation to allow simplest understanding and further development, and the same code runs on any Kinetis processor (with USB / DAC) without needing different libraries and rewriting.

- http://www.utasker.com/kinetis/FRDM-KL25Z.html [sine wave generator binary for KL25 at the bottom]
- USB audio documentation: http://www.utasker.com/docs/uTasker/uTaskerUSB_Audio.pdf
- ADC/DAC (with DMA) documentation: http://www.utasker.com/docs/uTasker/uTaskerADC.pdf

Regards

Mark

Complete Kinetis solutions for professional needs, training and support: http://www.utasker.com/kinetis.html
uTasker: supporting >1'000 registered Kinetis users get products faster and cheaper to market
Request Free emergency remote desk-top consulting at http://www.utasker.com/services.html

Open Source version at https://github.com/uTasker/uTasker-Kinetis

1,681 Views
nxf51211
NXP Employee
NXP Employee

Hi,

Yes, you can retrieve values from the memory by using DMA with DAC, and also it is possible to have the DAC operating asynchronously to the main loop. I recommend you check the following guide on how to implement audio output for kinetis: https://www.nxp.com/docs/en/application-note/AN4369.pdf 

Best Regards,

Ricardo Delsordo.