I am configuring the SAI pins and enabling external clock like so:
IOMUXC_SetPinMux(IOMUXC_SAI3_TXFS_SAI3_TX_SYNC, 0U);
IOMUXC_SetPinMux(IOMUXC_SAI3_TXC_SAI3_TX_BCLK, 0U);
IOMUXC_SetPinMux(IOMUXC_SAI3_TXD_SAI3_TX_DATA0, 0U);
IOMUXC_SetPinMux(IOMUXC_SAI3_MCLK_SAI3_MCLK, 0U);
// Set Pin Config
IOMUXC_SetPinConfig(IOMUXC_SAI3_TXFS_SAI3_TX_SYNC, value);
IOMUXC_SetPinConfig(IOMUXC_SAI3_TXC_SAI3_TX_BCLK, value);
IOMUXC_SetPinConfig(IOMUXC_SAI3_TXD_SAI3_TX_DATA0, value);
IOMUXC_SetPinConfig(IOMUXC_SAI3_MCLK_SAI3_MCLK, value);
// Enable extern MCLK
IOMUXC_GPR->GPR[2] |= IOMUXC_GPR_GPR2_GPR_SAI3_EXT_MCLK_EN(1);
Then i create the transfer Tx handle which contains the SAI Tx callback like so:
SAI_Init(SAI_I2S);
SAI_TransferTxCreateHandle(SAI_I2S, &saiHandle, sai_tx_callback, saiBuffer);
saiHandle.bitWidth = 32U;
saiHandle.channel = 0;
saiHandle.channelMask = SAI_CHANNEL_MASK;
saiHandle.channelNums = 2;
saiHandle.endChannel = 1;
I configure the imx as slave
sai_fifo_t fifo;
sai_fifo_packing_t packing;
packing = kSAI_FifoPacking8bit;
SAI_TxSetFIFOPacking(SAI_I2S, packing);
sai_transceiver_t config;
SAI_GetClassicI2SConfig(&config, SAI_BIT_WIDTH, SAI_MONO_STEREO, SAI_CHANNEL_MASK);
config.fifo = fifo;
config.masterSlave = kSAI_Slave;
config.syncMode = kSAI_ModeAsync;
config.bitClock.bclkSource = kSAI_BclkSourceMclkOption1;
SAI_TxSetConfig(SAI_I2S, &config);
Do a fifo reset before preparing my data and sending the data using
SAI_TxSoftwareReset(SAI_I2S, kSAI_ResetTypeSoftware);
// Prepare transfer
sai_transfer_t xfer =
{
.data = (uint8_t *)saiBuffer,
.dataSize = sizeof(uint32_t) * SAI_BUFFER_SIZE,
};
if ((ret = SAI_TransferSendNonBlocking(SAI_I2S, &saiHandle, &xfer)) == kStatus_Success)
{
}
else
{
//Do some debugging
}
The weird part is, the interrupt fires, the callback is called and I am printing out the TFR and TDR registers which all show 0x00. What am i doing wrong here? Is EDMA the only way or something else? Any help or pointers would be appreciated!