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
do {
I2S_STATISTICS_STRUCT stats;
ioctl(g_I2S_fd, IO_IOCTL_I2S_WAIT_TX_EVENT,NULL);
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,
PACKETS_PROCESSED
PACKETS_QUEUED
PACKETS_REQUESTED
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?
Hi Ryan Lush
Could you share what MCU and Drivers are you using?
Best regards
This is the processor
MK24FN1M0VLQ12
I am using MQX 4.2 along with KSDK
On Mon, May 7, 2018 at 1:39 PM, jorge_a_vazquez <admin@community.nxp.com>