FRDM-KL43Z Rev. A
MCUXpresso IDE v10.2.0
MCUXpresso SDK for FRDM-KL43Z V2.4.1(2018-06-18)
- Create new project in MCUXpresso IDE
select [New project...], there will pop the SDK Wizard panel, then select [frdmkl43z]:
Then, click [Next] will enter into [Configure the project] panel, we can set the [Project name] and select [flexio_i2s] in [driver]:
Click [Finish], the new project was created.
In general, the project is based on [hello_world] project with board default console available.
In [Project Explorer], we could find the <fsl_flexio_i2s.c> & <fsl_flexio_i2s.h> & <fsl_flexio.c> & <fsl_flexio.h> files in drivers folder:
- Edit the code
The application note AN5397 detailed introduce how FlexIO emulate I2S bus communication.
The MCUXpresso SDK <flexio_i2s> driver using the AN5397 showed second solution to use two timers and two shifters.
Please check here to get more detailed info.
The I2S signal was below, we need to use four FlexIO pins to provide: BCLK, Fss, TxData & RxData.
In <pin_mux.c> file, it need to config pin function, we use
PTD7 pin provide I2S BCLK clock;
PTD6 pin as I2S Frame_sync pin;
PTD5 pin as Tx data pin;
PTD6 pin as Rx data pin;
In <frdmkl43z_flexio_i2s_interrupt_tx.c>, config flexio_i2s and config the audio frame format:
Please check attached source code for the detailed project info.
- Test result
From the actual measured I2S signal, it shows the 8 bytes was sent out: