Hello,
I would like to make digital EQ controlled by Arduino, but before I even start with arduino part I must figure out what I need to send to my TEA6320 chip that comunicates via I2C bus...
Can someone please take a look at its datasheet and tell me if Im writing the command right?
Here is the code that I came up with, for turning loudness on and off:
S10000000AVLOFFP
As you already found on page 11 - you need to learn to decipher I2C protocol
For example "S" stands for "start" - from both SDA and SCL HIGH to SDA going LOW etc.
You sample looks OK, but you may need to include secondary ( not a right term) address.
Probable the best help would be found in "LCD using I2C" libraries - try Github.
Even such old device may have some code in Github repositories.
I have found most I2C "libraries" have no code for ACK/NAK.
You may spent much time experimenting after each I2C packet is passed.
I would like to make digital EQ controlled by Arduino,
I think you would want to use the Arduino Wire.h library for communication with the i2c device. The start/stop/ack bits will be taken care of by the library. I have no direct experience with the TEA6320, but here are some general principles.
You will use the seven bit slave address(0x40) which will become the 8 bit MAD slave address (B10000000) when the write bit 0 is appended by the library.
Wire.beginTranmission(0x40);//seven bit slave address becomes B10000000 with write bit appended
Wire.write(0); //set position to first address register for volume control
Wire.write(B01000000);// or B(00000000) depending on Loudness on/off
Wire.endTransmission();
it uses twi and that has decent documentation / functions description.
There are I2C code examples in the link also.
I sure would like to see someone documented when shifting 7 bit salve address left "creates" write pulse.
Nice trick, but it took me a while to realize that.
I am currently in same boat trying to write C++ code for Linux using ioctl and having similar issues making sure the I2C bus is setup in correct "direction" - switching I/O pins from output to input. Fun.