Microphone PCM1864CMBEVM of Texas Instruments

Hello! I got the microphone of TI and I haven't been able toestablish an I2C connection from the Arduino to the PCM1864.

Beginning with the hardware configurations, establish the routing between the Arduino and PCM1864 GND, 3.3v, SDA, and SCL pins. As for software I have used Wire.h.

PCM1864 I2C device address is "0x94", as found in page 3 under the "Hardware and Software Setup" of the PCM1864 datasheet.

Could you help me to make it work? Pleaseeeee.

My code util now is:

#include <Wire.h>

void setup() {
  Wire.begin();        // join i2c bus (address optional for master)
  Serial.begin(2000000);  // start serial for output
}

void loop() {
  //Wire.beginTransmission(0x94); // transmit to device #150 = 0x96 (run in slave)
  // but i2c addressing uses the high 7 bits so it's 75
  
  Wire.requestFrom(0x96,3);
    long sum = 0;
    for(int i=0; i<100; i++)
    {
        sum += Wire.read(); // receive a byte as character
    }
 
    sum = sum/100;
 
    Serial.println(sum);
  
    delay(10);

}

sum += Wire.read() is bad. Learn the difference between byte, int etc.
What is read? An int in 2 byte? Is the first byte MSB or LSB? MSB needs a factor of 256 before adding to sum.

Function "read" returns a byte, and "int" is 4 bytes, you're right, thanks!

No. An int is 2 bytes. A long is 4 bytes.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.