Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 15 of 15

Thread: How to connect teensy 4.1 with the ICS52000 array

  1. #1

    How to connect teensy 4.1 with the ICS52000 array

    I have Teensy 4.1 and a four ICS52000 microphone array as shown in the figure
    Click image for larger version. 

Name:	nw_aud_ics52000.png 
Views:	18 
Size:	17.9 KB 
ID:	24500

    How to connect teensy 4.1 with the ICS52000 array?

    The Teensy audio design tool show the following suggestion for connection
    Click image for larger version. 

Name:	Capture.PNG 
Views:	22 
Size:	27.1 KB 
ID:	24501

    I do not know why pin 21 of Teensy 4.1 is used both as the BCLK and FS?

  2. #2
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,159
    Quote Originally Posted by feima0011 View Post

    I do not know why pin 21 of Teensy 4.1 is used both as the BCLK and FS?
    That information is a typo (aka wrong)

    AFAIK:
    T4.x:
    MCLK 23
    BCLK 21
    LRCLK 20
    IN1 8

  3. #3
    Quote Originally Posted by WMXZ View Post
    That information is a typo (aka wrong)

    AFAIK:
    T4.x:
    MCLK 23
    BCLK 21
    LRCLK 20
    IN1 8

    Thanks for the reply.

    I still do not understand, the pin configuration of a ICS52000 is shown in the figure
    Click image for larger version. 

Name:	Capture.PNG 
Views:	20 
Size:	114.5 KB 
ID:	24505
    which shows SD, WS, SCK, not the MCLK, BLCK, LRCLK.


    Should I connect the
    "MCLK 23
    BCLK 21
    LRCLK 20
    IN1 8"
    to which pins of the ICS52000?

  4. #4
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,159
    I would try

    BCLK - SCK
    LRCLK - WS
    IN1 - SD


    See also https://github.com/WMXZ-EU/microSoun...Hardware-setup
    for attachment of other MEMS microphones
    Edit: The pin numbers in reference are for T3.6, but should give an idea on how to use MEMS microphones with Teensy

  5. #5
    Thanks.

  6. #6
    We have tried you suggestion, but it does not work.

    Please help us figure out the connection between the ICS52000 and the teensy 4.1

  7. #7
    The ICS52000 does not have the LRCLK pin

  8. #8
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,243
    Quote Originally Posted by WMXZ View Post
    That information is a typo (aka wrong)
    Opps, yes, it is indeed a typo. I've updated the website and github to properly show pin 20 for FS on Teensy 4.x.


    Quote Originally Posted by feima0011 View Post
    Please help us figure out the connection between the ICS52000 and the teensy 4.1
    I want to help you, but as far as I know WMXZ's suggested connection is correct.

    Could you show us photos of how you've actually connected the hardware? Often when there is a mistake or misunderstanding in the wiring, usually words can't describe the problem (especially when it's a misunderstanding) but a photos sometimes can let us see what's really wrong.

    Maybe also show us the (complete) program you're running. There too, certain mistakes like forgetting AudioMemory or not giving enough memory to process all 16 inputs can cause a program which otherwise should work to do nothing. We can't see your screen, so if you don't show us the code you're actually running, we're left to just blind guessing about the real cause of the problem.

    With these MEMS microphones, sometimes we've seen cases where everything was "working" but seems to be dead only because the microphone's data had a very small signal with a large DC offset. The SPH0645 mic in particular had these problems, which is why the audio library has an example program to demonstrate how to get a usable signal from that particular mic.

  9. #9
    Thanks for the reply. Her are our set up and code.

    We connect the 4 ICS52000 microphone array from
    https://www.notwired.co/products/det...red-co/605574/
    with the Teensy 4.1 as shown in the following figure
    Click image for larger version. 

Name:	Ics52000_teensy41.jpg 
Views:	6 
Size:	69.6 KB 
ID:	25051
    Specifically, we connect
    --------------------------------------------------------------------
    Microphone array pin <-------> Teensy 4.1 Pin
    1,3,5,7,9 <-------> GND
    2 <-------> 3.3V
    6 <--------> 8
    8 <--------> 21
    10 <-------> 20
    -----------------------------------------------------------------------
    according to the audio design tool suggestion
    Name:  Screenshot from 2021-06-17 19-02-35.png
Views: 21
Size:  8.4 KB

    and the microphone array data sheet
    Name:  Screenshot from 2021-06-17 19-03-48.png
Views: 21
Size:  8.8 KB
    ------------------------------------------------------------------------

    Here is the code, which basically record 10 second of data from
    one microphone and then save the data to the SD card.

    Code:
    #include <Audio.h>
    #include <Wire.h>
    #include <SPI.h>
    #include <SD.h>
    #include <SerialFlash.h>
    
    #define SDCARD_CS_PIN    BUILTIN_SDCARD
    /////////////////////////////////////////////////////////////////////////////////
    int a=0;
    ////////////////////////////////////////////////////////////////////////////////
    
    unsigned int tsamplemillis = 10000;
    
    int16_t* buffer1;
    int16_t* buffer2;
    
    File frec;
    
    ////////////////////////////////////////////////////////////////////////////////
    
    AudioInputTDM            tdm1;   
            
    AudioRecordQueue         queue1;       
    AudioRecordQueue         queue2;  
         
    AudioConnection          patchCord1(tdm1, 0, queue1, 0);
    AudioConnection          patchCord2(tdm1, 1, queue2, 0);
    
    ////////////////////////////////////////////////////////////////////////////////
    
    void setup() {
      Serial.begin(115200);
      AudioMemory(512);
    
      // Initialize the SD card
    
      if (!(SD.begin(SDCARD_CS_PIN))) {
        // stop here if no SD card, but print a message
        while (1) {
          Serial.println("Unable to access the SD card");
          delay(1000);
        }
      }
      while (!Serial);
      Serial.println("Begin");
    }
    
    void loop() {
        if(a<1){
        record();
        continueRecording();
        stopRecording();
        a = 1;
        }
    }
    
    void record()
    {
      
      frec = SD.open("ICS52000.raw", FILE_WRITE);
      if (frec) {
        Serial.println("File Open");
      }
    }
    
    void continueRecording() {
      int data = 0, num = 0;
      elapsedMillis recordingTime = 0;
      
      queue1.begin();------------------------------------------------------------------------
    ------------------------------------------------------------------------
    
      queue2.begin();
      
      while (recordingTime < tsamplemillis)
      {
        data = queue1.available();
        if (data > 0)
        {
          buffer1 = queue1.readBuffer();     
          buffer2 = queue2.readBuffer();
          
          queue1.freeBuffer();                
          queue2.freeBuffer();
         
          for (int i = 0; i < 128; i ++)                       
          { 
            frec.write(highByte(buffer2[i])); // LSB            
            frec.write(lowByte(buffer1[i])); // Middle Byte     
            frec.write(highByte(buffer1[i])); // MSB           
    
            num++;
          }
        }
      }
      queue1.end();     //stop the background sampling
      queue2.end();
      
      Serial.print("num of samples written per channel:");
      Serial.println(num);
    
    }
    
    void stopRecording() {
      Serial.println("Finished recording.");
      queue1.end();
      queue2.end();
      queue1.clear();
      queue2.clear();
    
      frec.close();
       Serial.println("File close");
    }
    --------------------------------------------------------------------------------------------------------------------
    I use a loudspeaker to play a 440 Hz sine signal close to the microphone array, I expect to witness the sine
    waveform from the data.

    But after I imported the data "ICS52000.raw" to the Audacity as raw data, 24 bit signed pcm, little endian ,one channel,
    with sampling frequency of 44100 hz.

    Here is that showed by Audacity
    Click image for larger version. 

Name:	Screenshot from 2021-06-17 19-10-43.jpg 
Views:	1 
Size:	57.7 KB 
ID:	25054

    I can not see a sine waveform if even I zoom in to the data.

  10. #10
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,243
    I have a couple of those ICS52000 boards here, part number NW-AUD-ICS52000. I believe this is the datasheet with its schematic, right?
    Attached Files Attached Files

  11. #11

    Correct

    Quote Originally Posted by PaulStoffregen View Post
    I have a couple of those ICS52000 boards here, part number NW-AUD-ICS52000. I believe this is the datasheet with its schematic, right?
    Correct! Correct!

  12. #12
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,243
    I tried to follow the wires in your photo, but due to the bad camera angle I just can't clearly see where each wire really connects.

    I connected my ICS52000 to a Teensy 4.0 on my desk.

    Click image for larger version. 

Name:	tdm.jpg 
Views:	3 
Size:	107.2 KB 
ID:	25056

    So far I only ran this program, just to get the waveforms.

    Code:
    #include <Audio.h>
    
    AudioInputTDM            tdm1;
    
    void setup() {
      AudioMemory(40);
    }
    
    void loop() {
    }
    At a very quick first test, these are the waveforms I oscilloscope sees on the 3 signals.

    Click image for larger version. 

Name:	file1.png 
Views:	2 
Size:	69.8 KB 
ID:	25057

    Click image for larger version. 

Name:	file2.png 
Views:	3 
Size:	44.7 KB 
ID:	25058

    If you have a scope or logic analyzer, check if your hardware is giving these waveforms...

  13. #13

    Connection

    I will try the logic analyzer tomorrow.

    My connection between two board are
    Name:  Screenshot from 2021-06-17 21-11-04.png
Views: 13
Size:  6.7 KB
    Have a try the connect and my code.
    Last edited by feima0011; Today at 11:15 AM.

  14. #14
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,243
    I believe you should first try simple things within the audio library (like peak level analysis), before adding all the complexity of queues and handling data and adding a SD card into the list of unknowns.


    My connection between two board are
    If you can take better photos from an angle where I can see the connections, I will try again to follow the wires. But this description isn't helping. Real photos are needed. Before you post, please look at your photo from the perspective of someone trying to visually verify the wires. If many of the wires all cross over each other in 1 place, you need a different camera angle!

  15. #15
    I will show you a better image tomorrow. Thanks for your feed back.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •