lpcware

Voice message with DAC

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by npiergi on Fri Apr 11 13:46:09 MST 2014
Hi all.
I used the DAC to generate voice messages with 8-bit per samples at 8KHz rate. The samples are stored in RAM as 32 bits. I used DMA transfer from memory to the DAC. Everything works perfectly.
But using 32bit for 8-bit samples is too much! So I tried to store in RAM only 16bit (BIAS bit is excluded) per sample and to program the DMA with 16-bit size as source  and 32-bit size as destination. It does not work. This is the piece of code used:



    DMACC0CONTROL = 0xFFF             // transfer size (0 - 11) = 4096
                  | (0 << 12)         // source burst size (12 - 14) = 1
                  | (0 << 15)         // destination burst size (15 - 17) = 1
                  | (1 << 18)         // source width (18 - 20) =  2=32 bit 1=16bit
                  | (2 << 21)         // destination width (21 - 23) = 32 bit
                  | (0 << 24)         // source AHB select (24) = AHB 0
                  | (0 << 25)         // destination AHB select (25) = AHB 0
                  | (1 << 26)         // source increment (26) = increment
                  | (0 << 27)         // destination increment (27) = no increment
                  | (0 << 28)         // mode select (28) = access in user mode
                  | (0 << 29)         // (29) = access not bufferable
                  | (0 << 30)         // (30) = access not cacheable
                  | (0 << 31);        // terminal count interrupt disabled

    DMACC0CONFIGURATION = 1
                  | (0 << 1)       // source peripheral (1 - 5) = none
                  | (7 << 6)       // destination peripheral (6 - 10) = DAC
                  | (1 << 11)      // flow control (11 - 13) = mem to per
                  | (0 << 14)      // (14) = mask out error interrupt
                  | (0 << 15)      // (15) = mask out terminal count interrupt
                  | (0 << 16)      // (16) = no locked transfers
                  | (0 << 18);        // (27) = no HALT


    /* DACclk = 25 MHz, so 125 usec interval-> 25 * 125 = */
    DACCNTVAL = 3125;
    /* DMA, timer running, dbuff */
    DACCTRL = 1<<3 | 1<<2 | 1<<1;

Where is the error? It's a mission impossible?

Thank in advance

Outcomes