2009-03-19 10:39 PM
DAC: 8bits vs 12bits
2011-05-17 04:07 AM
I want to use the DAC to output some audio samples.
I have configure the DAC like this: ---------------------------------------------- DAC_StructInit (&dac_init); dac_init.DAC_Trigger = DAC_Trigger_T6_TRGO; dac_init.DAC_WaveGeneration = DAC_WaveGeneration_None; dac_init.DAC_OutputBuffer = DAC_OutputBuffer_Enable; DAC_Init (DAC_Channel_1, &dac_init); ---------------------------------------------- I am using DMA to output the samples. I have one version for 8 bit samples: ---------------------------------------------- dma_init.DMA_PeripheralBaseAddr = reinterpret_cast(&(DAC->DHR8R1)); dma_init.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte; dma_init.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte; ---------------------------------------------- And one for 12 bit samples. ---------------------------------------------- dma_init.DMA_PeripheralBaseAddr = reinterpret_cast(&(DAC->DHR12R1)); dma_init.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Word; dma_init.DMA_MemoryDataSize = DMA_MemoryDataSize_Word; ---------------------------------------------- If I output the same samples (the samples are shifted by 4 for the 12 bit version), the 12 bit version is much louder (higher amplitude). Reading the reference manual I would expect both variants to create the same amplitude.