This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2652R7: Interfacing external PDM to PCM converter to CC2652R7 via i2s line

Part Number: CC2652R7
Other Parts Discussed in Thread: TIDA-01236

Hi,

We are trying to detect ultrasonic signal using MEMS PDM mic and external PDM to PCM converter (ADAU7118). The PCM audio data is output on a serial audio interface port in either I2S or time domain
multiplexed (TDM) format. We further need to process the data received on MCU I2S line and transmit wirelessly. 

Are there any reference code available to start with our application ?

The converter supports different sampling frequency from 4 kHz to 192 kHz that can be set through LR clock. How can we change sampling frequency from MCU ?

Regards

Pratik

  • Hi Pratik,

    You can start with the i2secho example and further reference the I2S.h TI Drivers Runtime APIs.  The sampling frequencies supported are 8kHz, 16kHz, 32kHz and 44.1kHz.

    Regards,
    Ryan

  • Hi Ryan,

    Thank you for the reply.

    In our application we need to detect ultrasonic signals from 22Khz to 80Khz. For this sampling frequency need to be 190Khz, but the i2s driver you mentioned supports max 44.1Khz. Can we change the sampling freq in existing i2s driver to 190Khz and verify ultrasonic signal ?

    We found TIDA-01236 reference design using CC1301 MCU. In i2s.c file we saw below note

    * The I2S clocks are configured to be as close to 192kHz sampling rate as
    * possible without requiring use of the codec's internal PLL (to save power).
    * The clock settings are as follows:
    *
    * - System Clock = 48 MHz
    * - I2S Master Clock (MCLK) = 24 MHz
    * - I2S Sampling Frequency (WCLK) = 187.5 kHz
    * - I2S Bit Clock = WCLK * 16 = 6 MHz

    Can we use the same i2s driver for our application ?

  • The I2S driver is shared between CC13XX /CC26XX devices and you can set the I2S_Params MCLKDivider, phaseType, and SD[0/1]Channels.  Therefore you should be able to achieve the same effect as the Reference Design when using its codec resources.

    Regards,
    Ryan

  • Hi Ryan,

    We tried to modify I2S echo simplelink_cc13x2_26x2_sdk_5_20_00_52 SDK example code to achieve sampling frequency higher than 44.1Khz. We have set following parameters in application to achieve 75Khz sampling frequency.

    i2sParams.samplingFrequency = 75000;
    i2sParams.bitsPerWord = 16;
    i2sParams.fixedBufferLength = 256;
    i2sParams.writeCallback = writeCallbackFxn ;
    i2sParams.readCallback = readCallbackFxn ;
    i2sParams.errorCallback = errCallbackFxn;

    and rest are kept as default parameters as mentioned in I2S.h file

    * params.memorySlotLength = I2S_MEMORY_LENGTH_16BITS;
    * params.moduleRole = I2S_MASTER;
    * params.trueI2sFormat = (bool)true;
    * params.invertWS = (bool)true;
    * params.isMSBFirst = (bool)true;
    * params.isDMAUnused = (bool)false;
    * params.samplingEdge = I2S_SAMPLING_EDGE_RISING;
    * params.beforeWordPadding = 0;
    * params.afterWordPadding = 0;
    * params.fixedBufferLength = 1;
    * params.SD0Use = I2S_SD0_OUTPUT;
    * params.SD1Use = I2S_SD1_INPUT;
    * params.SD0Channels = I2S_CHANNELS_STEREO;
    * params.SD1Channels = I2S_CHANNELS_STEREO;
    * params.phaseType = I2S_PHASE_TYPE_DUAL;
    * params.startUpDelay = 0;
    * params.MCLKDivider = 40;

    With above parameters and PRCM (ti.com) calculations we see WS CLK as 75Khz

    WS CLK = MCUCLK / BDIV *(2*WDIV)

                   = 48Mhz / 20 * (2 * 16)

                   = 75000 Hz

    After flashing code with above configuration we tried to probe WS pin to verify the 75Khz sampling freq, but we could not see any signal on WS pin.

    Are we missing any other settings to be done in code ?

  • Please verify that the system works with a slower clock (like 32 kHz) so that you can confirm that the WS pin signal is correct with a known setup. The SCK clock you've initialized is 75 000 * 2 * 16 = 2.4 MHz which is slightly under the maximum 4MHz achievable by the driver.  You could put breakpoints in errCallbackFxn to determine whether any errors are raised, and also verify whether the read and write callbacks are triggered.  That way you can determine if the driver works but output nothing, or basically does not work as expected.

    Regards,
    Ryan