Problem getting to work TEA 5767

Hi,

Some time ago I put my hands on TEA5767 chips (just two of them). Later on I was given an idea to put them to use as "detectors" in airsoft games. Using google I found two nice web sites with detailed descrition of code and what is sent to the device. These sites are:

Code I'm using right now:

#include <Wire.h>

unsigned char frequencyH = 0;
unsigned char frequencyL = 0;
unsigned int frequencyB;
double frequency = 0;

void setup(){
  Wire.begin();
  setFrequency();
  Serial.begin(9600);
}

void loop(){
  unsigned char buffer[5];
  
  Wire.requestFrom(0x60,5); //reading TEA5767
  if (Wire.available()) {
    for (int i=0; i<5; i++) {
      buffer[i]= Wire.read();
    }
  }
  
  Serial.println(buffer[0], BIN);
  Serial.println(buffer[1], BIN);
  Serial.println(buffer[2], BIN);
  Serial.println(buffer[3], BIN);
  Serial.println(buffer[4], BIN);
  Serial.println("\n");
  delay(1000);
}

void setFrequency(){
  Wire.beginTransmission(0x60);
  Wire.write(0x2C); //1st byte 0x2CBD -> already calculated for 93.6 MHz (local radio station)
  Wire.write(0xBD); //2nd byte
  Wire.write(0xB0); //3rd byte
  Wire.write(0x10); //4th byte
  Wire.write(0xC0); //5th byte
  Wire.endTransmission();
}

After uploading code to arduino start starting serial port monitor I get these (first three sets od data):

11111111
0
10010101
0
10010100


10010100
0
10010101
0
10010100


10010100
0
10010101
0
10010100

Looking at first site I found, the bufor array should be like:

bufer[0] -> FreqH
bufer[1] -> FreqL
bufer[2] -> Stereo/Mono
bufer[3] -> RX Power
bufer[4] -> not used ?

Looks like I'm getting some gibberish.
Now the question is: either I have something wrong in the code (sending wrong bytes, wrong tea5767 address) or TEA chip is simply broken.

Thanks in advance for support.

Best Regards :slight_smile:
b.

From the datasheet:

Before any READ or WRITE operation the pin BUSENABLE has to be HIGH for at
least 10 ms.
The I2C-bus mode is selected when pin BUSMODE is LOW, when pin BUSMODE is HIGH
the 3-wire bus mode is selected.

You call read() 5 times for one call of available() - you may need to check that each and
every byte read is actually available. For instance you could do:

  if (Wire.available () >= 5)
  {
    ..
  }

Anyway how have you wired this up?

Thread can be closed.
I got it working (at least one). Problem was in poorly soldered ground pin.

Iron too cold? Clean the iron properly?

I always find a close visual inspection after construction is worthwhile - use a lens
and expect every joint to be suspect, then you'll find the otherwise really frustrating
problems early :slight_smile: