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

Thread: How to connect teensy 4.1 with the ICS52000 array

  1. #1

    How to connect teensy 4.1 with the ICS52000 array

    ------------------------------------
    Admin Edit: ICS-52000 microphones do not appear to work well with Teensy at 44100 Hz sample rate. The "notwired.co" board does NOT work with Teensy at 44.1 kHz!
    ------------------------------------



    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:	22 
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:	27 
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?
    Last edited by Paul; 07-20-2021 at 08:25 AM. Reason: added ICS-52000 warning

  2. #2
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,281
    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:	24 
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,281
    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,496
    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:	16 
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: 122
Size:  8.4 KB

    and the microphone array data sheet
    Name:  Screenshot from 2021-06-17 19-03-48.png
Views: 129
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:	11 
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,496
    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,496
    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:	13 
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:	13 
Size:	69.8 KB 
ID:	25057

    Click image for larger version. 

Name:	file2.png 
Views:	16 
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: 123
Size:  6.7 KB
    Have a try the connect and my code.
    Last edited by feima0011; 06-17-2021 at 11:15 AM.

  14. #14
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,496
    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.

  16. #16
    which pins are you connecting to?

  17. #17

    logic analyser results

    Quote Originally Posted by PaulStoffregen View Post
    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:	13 
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:	13 
Size:	69.8 KB 
ID:	25057

    Click image for larger version. 

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

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

    I have a bitscope logic analyser, https://www.bitscope.com/product/BS05/.

    I run your code and have a look at the signal on pin 20 and 21.
    The connection between the bitscope and the teensy 4.1 are as follows.

    Click image for larger version. 

Name:	IMG_20210623_110642.jpg 
Views:	13 
Size:	71.8 KB 
ID:	25102

    Here is the signal on pin 21,
    Click image for larger version. 

Name:	Screen Shot 2021-06-23 at 11.04.40 am.jpg 
Views:	10 
Size:	71.1 KB 
ID:	25103
    here is the signal on pin 20.
    Click image for larger version. 

Name:	Screen Shot 2021-06-23 at 11.06.10 am.jpg 
Views:	9 
Size:	69.7 KB 
ID:	25104

    Note that the time scales in the two figures are different.
    The signal on pin 20 is much sparse than the signal on pin 21.

    I think the TDM port on teensy should work just fine.

    What is next?

  18. #18

    Lightbulb

    I have done another measurement using the DS1052E DIGITAL OSCILLOSCOPE.
    The results are here.
    Click image for larger version. 

Name:	IMG_20210623_160326.jpg 
Views:	8 
Size:	237.1 KB 
ID:	25105
    Here plot 1 is the pin 20 signal, and plot 2 is the pin 21 signal.

    As shown in the figure, the pin 20 signal is pulse signal with a peroid about 22.7 us,
    and the pin 21 signal is approximately (square) pulse signal with a peroid about 88.6 ns.

    These two clock signals are good.

    What is the next for further debuggering?

  19. #19
    I still have not make the teensy work with the ICS52000,
    Last edited by feima0011; 06-25-2021 at 09:11 AM.

  20. #20
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    8,691
    Quote Originally Posted by feima0011 View Post
    I am suprised to find that even this simple code does not work.
    I'm not

    The documentation in the audio gui says:

    USB input & output does not cause the Teensy Audio Library to update. At least one non-USB input or output object must be present for the entire library to update properly.
    Best is to use I2S. You don't need to connect anything there, it's just used as internal clock source.

  21. #21
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,281
    Quote Originally Posted by PaulStoffregen View Post
    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:	13 
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:	13 
Size:	69.8 KB 
ID:	25057

    Click image for larger version. 

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

    If you have a scope or logic analyzer, check if your hardware is giving these waveforms...
    So,
    Paul, I can confirm the same picture for the TDM, but strange enough, when sending data over USB to PC only noise is passing without acoustics.
    (See other thread https://forum.pjrc.com/threads/67581...l=1#post282615 for program)

  22. #22
    Administrator Paul's Avatar
    Join Date
    Oct 2012
    Posts
    406
    Too many threads about the problematic ICS-52000 have been opened.

    Please see these 2 open threads.

    https://forum.pjrc.com/threads/67581...ensy-4-1/page2

    https://forum.pjrc.com/threads/48563...TDM-evaluation

    I am closing this and all the other extra threads. Please DO NOT start new threads about ICS-52000.
    Continue all ICS-52000 on those 2 remaining open threads.

Posting Permissions

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