Jump to content
  • 1

TDM Protocol with Digital Discovery


Douglas

Question

I am trying to interface a MEMS microphone ICS-52000 with the Digital Discovery board.  The microphone outputs data using Time Domain Multiplexed (TDM) signaling. TDM is somewhat similar to I2S but without the left and right channel.  The Digital Discovery board has I2S listed under Logic.  I want to make a Protocol for TDM.  Is it possible to use the Digital Discovery board to develop a protocol that will generate a clock signal (output) along with a word select (output) synchronous to the clock signal and then read data (input) from a connected microphone?  Data would be streamed to a file.

Thanks,

Douglas

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

Hi @Douglas

The attached project generates SCK/WS signals on DIO25/24, 64/1 clocks from 128 custom samples at 6.25MHz, 48.8khz sample rate. Remove the DIO26 from pattern and connect it to SD. The Logic Analyzer is configured to store the SCK transitions and custom interpreter to decode the first 24 SD bits on SCK falling edge after WS. To see only the decoded data open View/Events and select TDM. This data can also be exported.
With this method you could record up to 500k samples. The decoding of such number of samples (64M raw data) with custom script could take a few minutes.
For longer streaming to file a custom application based on WaveForms SDK is needed.

tdm.dwf3work

i1.thumb.png.5fedbf4a207694cbee0919f4ef1e2da4.png

Decoder:

// rgData: input, raw digital sample array
// rgValue: output, decoded data array
// rgFlag: output, decoded flag array

var c = rgData.length // c = number of raw samples
var pClock = false; // previous cock signal level
var iStart = 0;     // used to keep track on word start index
var cByte = 0;      // byte count per transmission
var cBits = -1;     // bit counter
var bValue = 0;     // value variable

for(var i = 0; i < c; i++){ // for each sample
    var s = rgData[i]; // current sample
    var fSelect = 1&(s>>0); // pin0 is the select signal
    var fClock = 1&(s>>1); // pin1 is the clock signal
    var fData = 1&(s>>2); // pin2 is the data signal
    
    if(pClock==fClock) continue; // no clock edge
    pClock = fClock; // previous clock level

    if(fClock==0 && cBits>=0 && cBits<24){ // sample data on clock falling edge, first 24 bits
        bValue <<= 1; // serial data bit, MSBit first
        if(fData)  bValue |= 1;
        cBits++;
    } 
    if(fClock!=0 && fSelect!=0){ // select high on clock rising edge
        if(cBits>0){ // store earlier collected data
            cByte++;
            // store rgValue/Flag from word start index to current sample position
            for(var j = iStart; j < i; j++){
                // Flag change will be visible on plot even when data remains constant.
                // This is useful in case we get more consecutive equal values.
                rgFlag[j] = cByte;
                rgValue[j] = bValue;
            }
        }
        // reset our counters/variables
        iStart = i;
        cByte = 0;
        cBits = 0;
        bValue = 0;
    }
}

Value to Text for hex:

// value: value sample
// flag: flag sample

function Value2Text(flag, value){
  switch(flag){
    case 0: return "X";
    default: return "0x"+value.toString(16)
  }
}
Value2Text(1,66)

 

Link to comment
Share on other sites

On 10/13/2017 at 2:49 AM, attila said:

Hi @Douglas

I just notice the I2S decoder can also process TDM data and decoding with this is much faster.
Just add a filter to the Event view to show the values for one channel, like starts with L.

tdm2.dwf3work

i3.png.6f0de446613a1cb88eaf605d74e72a77.png

i2.thumb.png.aa77294f1aefac21d97a8dcd92e74d64.png

 

 

I loaded up tdm2 that you provided above, ran it on my hardware, and captured some data with my oscilloscope.  Interestingly, with the Parameter1 setting of 6.25MHz provided in tdm2 SCK (DIO25) outputs at 3.125MHz as shown in the first screen shot. 

tek00001.png

If I increase the bus frequency of Parameter1 to 12.5MHz then SCK outputs at 6.25MHz, however, if I leave the sample size in the bus settings at 128, Select (DIO24) outputs at 96kHz.  In screen shot below Parameter1 is set to 12.5MHz and I have edited the bus increasing the sample size to 256.  I now get Select outputting at 48kHz but SCK is zero half the time.

What am I missing in the configuration settings that I need to set to get SCK to output continuously?

Thanks,

Douglas

tek00002.png

Link to comment
Share on other sites

Hi Attila,

I'm actually working with Doug on this project.

I managed to get an AD2 driving the microphones and reading the bitstream in a similar manner as you suggest, but the I2S decoder can only gather the samples for the first microphone. Our development boards have 4x mics, and we eventually want to go up to the max of 16x.

I tried adjusting the I2S parameters so that I could grab multiple microphones at a time (e.g. mics 1+2 in L channel, 3+4 in R channel), and then parse them myself afterwards, but could not set the word length greater than 32 - I would need 64 for each channel to get the 2x 32-bit windows for each mic pair.

I looked inside the Waveforms application to see if the I2S decoder script was available for me to duplicate/modify for our purposes, but did not see something like that.

Do you know if/where that might be available?

Thanks,
Jit

Link to comment
Share on other sites

On 10/13/2017 at 3:49 AM, attila said:

Hi @Douglas

I just notice the I2S decoder can also process TDM data and decoding with this is much faster.
Just add a filter to the Event view to show the values for one channel, like starts with L.

tdm2.dwf3work 3.49 kB · 157 downloads

i3.png.6f0de446613a1cb88eaf605d74e72a77.png

i2.thumb.png.aa77294f1aefac21d97a8dcd92e74d64.png

 

 

Are these files still available? They are zero bytes when I download them.

Thanks,

T

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...