lpcware

How to efficiently use GPDMA to generate audio waveform on DAC output pin

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by giusloq on Fri May 08 03:39:23 MST 2015
I need to play some simple audio signals on DAC output pin and I'd like to use GPDMA so I can save CPU cycles.
I don't need hi-fi, so I'm going to store audio signals as 8-bits const unsigned char arrays.

The single 8-bit sample should be written to DACR register, but it must be manipulated. I don't need to save power (BIAS flag could be set to 0), so I have to only shift the 8-bit sample value by 8 bits:

  const unsigned char samples[] = { ... };
  ...
  DACR = samples[idx] << 8;


In other words, I have to write the 8-bits sample to address 0x4008 C001 and not the base DACR register 0x4008 C000.

Is it possible with GPDMA and LPCOpen libraries?

Outcomes