I am trying to get the sai_dma_demo app to work with a DAC3120 codec. Based on the example I came up with this code
ioctl(g_I2S_fd, IO_IOCTL_I2S_GET_TX_STATISTICS, &stats);
phraseDataToRead = ((phraseDataLength - phraseDataPlayed) > stats.SIZE) ? stats.SIZE : (phraseDataLength - phraseDataPlayed);
SPI1_ReadAudioFlash(temp_buffer, (phraseDataOffset + phraseDataPlayed), phraseDataToRead);
memcpy(stats.IN_BUFFER, temp_buffer, phraseDataToRead);
if(phraseDataPlayed == 0)
ioctl(g_I2S_fd, IO_IOCTL_I2S_START_TX, NULL);
ioctl(g_I2S_fd, IO_IOCTL_I2S_UPDATE_TX_STATUS, &phraseDataToRead);
phraseDataPlayed += phraseDataToRead;
} while (phraseDataPlayed < phraseDataLength);
but this does not create the clean sinewave I am trying to play. It's off frequency by a factor of three and barely looks like a sine wave.
I noticed that when I inspect stats the second time through the loop,
are all 4096
IN_BUFFER & OUT_BUFFER both point to the same address and BUFFER_ERROR is incremented by 1. Any ideas as to what causes the DMA BUFFER_ERROR?