2020-01-14 01:04 PM
Hello,
my waveplayer works, nearly....
For every half transfer and complete transfer, i read the next 256 byte in a 16bit array "uint16_t DAC_Buff" . done.
while(1)
{
volatile ITStatus it_st;
it_st = RESET;
while(0 == (DMA1->HISR ,DMA_HISR_HTIF5)) ;
f_read(&file,&DAC_Buff[0],256,&cnt);
DMA1->HISR |= DMA_HISR_HTIF5;
if(cnt<256)break;
it_st = RESET;
while(0 == READ_BIT(DMA1->HISR ,DMA_HISR_TCIF5)) ;
f_read(&file,&DAC_Buff[256],256,&cnt);
DMA1->HISR |= DMA_HISR_TCIF5;
if(cnt<256)break;
}
Before I starting the Timer and the DAC DMA. It works "great"... but it doesn't sound right.
The key parameter here is the length of data transferred from memory to DAC.
This parameter changes the sound of my 16bit wave file. I tried different things.
16bit, 32bit, 256,512 but nothing sound as it should.
HAL_DAC_Start_DMA(&hdac, DAC_CHANNEL_1, (uint32_t*) DAC_Buff, ???, DAC_ALIGN_12B_R );
So what mean exactly by this parameter?