Hi xiangjun.rong, Andrew DeLiso,
we use KSDK2.0 with K64 in a design with TLV320DAC3120 (Sound: Mono Audio DAC with amplifier).
I have a working code with SDK1.3. --> Hardware and setup of the codec are working.
But with KSDK2.0 I have real Problems to set up an I2S audio data stream.
I want to use the following setup:
config.protocol = kSAI_BusI2S;
config.syncMode = kSAI_ModeAsync;
config.mclkOutputEnable = true;
config.mclkSource = kSAI_MclkSourceSysclk;
config.bclkSource = kSAI_BclkSourceMclkDiv;
config.masterSlave = kSAI_Master;
SAI_TxInit(...)
format.sampleRate_Hz = kSAI_SampleRate16KHz;
format.bitWidth = kSAI_WordWidth16bits;
format.Stereo = kSAI_MonoLeft;
format.masterClockHz = 6144000;
format.watermark = 4;
format.channel = 0;
format.protocol = kSAI_BusI2S;
SAI_TxSetFormat(...)
When I send out data with SAI_TransferTxSetFormatEDMA(...), there is no Information on I2S0_TXD0.
I changed "fsl_sai.c" SAI_TxSetFormat() as suggested by Andrew DeLiso.
I think, there is an additional error in SAI - setup SAI - module I2S_TCR4_SYWD.
SYWD is set to 0x1f regardless of the real bitWith of the sound - data. I think SYWD should be set to bitWith-1.
Questions:
- Can you provide a newer Version of fsl_sai.c?
- Has anyone get the I2S Hardware on K64 running with KSDK2.0? -- and probably share his knowledge about erros in fsl_sai.c?
Best regards
Manfred