PDA

View Full Version : Controling a TDA7318 (I2C) Audio Processor



Badger
- 29th May 2004, 00:30
Hi there,
I hope someone can help, I am trying to controll a TDA7318 Audio Processor with the I2CWRITE command but it is not working.
The chip address is 10001000 and then the control bits after that, for example to switch to stereo 1 with 0dB gain woul be 01011000.

So my test code which I am useing looks like ths:

'Program to test I2C TX

SCL VAR PORTA.2 ' Clock pin
SDA VAR PORTA.3 ' Data pin

TRISA = %00010 'Set portA as o/p pin 1 i/p
TRISB = %11111111 'set ports as i/p


MAIN:
IF PORTA.1 = 1 THEN DECODE
GOTO MAIN

DECODE:

IF PORTB = %00000001 then GOSUB ONE
IF PORTB = %00000010 then GOSUB TWO
IF PORTB = %00000011 then GOSUB THREE
IF PORTB = %00000100 then GOSUB FOUR
' IF PORTB = %00000101 then GOSUB FIVE
' IF PORTB = %00000110 then GOSUB SIX
' IF PORTB = %00000111 then GOSUB SEVEN
GOTO MAIN


ONE:
I2CWRITE SDA,SCL,%10001000,%01011000 'select stereo 1 gain of 0dB
PAUSE 5
RETURN

TWO:
I2CWRITE SDA,SCL,%10001000,%01011001 'select stereo 2 gain of 0dB
PAUSE 5
RETURN

THREE:
I2CWRITE SDA,SCL,%10001000,%01011010 'select stereo 3 gain of 0dB
PAUSE 5
RETURN
FOUR:
I2CWRITE SDA,SCL,%10001000,%01011011 'select stereo 4 gain of 0dB
PAUSE 5
RETURN

GOTO MAIN
END

I have looked on a scope and it looks like it has sent the control code (10001000), but nothing else.
It also looks like there is no ack from the TDA.
Can anyone help?
TIA
Stefan.

Badger
- 1st June 2004, 12:44
I looked on a scope today, and after reading up on the I2C specs it looks like it is sending the chip address 10001000 and then a stop bit instead of an ack and thats it. It seams to be ignoring the control signals.

CocaColaKid
- 1st June 2004, 16:22
Might be a silly question but whats the value you're try to write? I see the data pin, clock pin, control and address but I don't see a value to write to that address.

Badger
- 1st June 2004, 20:18
Hi there,
all you have to do is to send the chip address (10001000) and the data to control the chip (01011000 which will switch the chip to stereo 1 with 0dB of gain), I don't think I have to write anything else to it.
You can get the datasheet from :-http://www.angliac.com/st/data_from_st/1491.pdf
see if I have missed anything out.
Thanks.

Badger
- 2nd June 2004, 14:52
I have found that the TDA is not acknowledging the PIC Data.
I don't know why though?
Stefan

Calco
- 3rd June 2004, 18:39
Badger,

What microcontroller are you using?

I ask just incase it is one with analogue/comparators on port a. this might be causing you problems.

Regards

Darryl

Badger
- 3rd June 2004, 21:59
Thanks for your reply's
Had another look at the circuit and found that I had put the resistor array across some pins that I had not defined, which caused a few problems.
I made sure it was on only the sda & scl pins and it sorted the problem.
Thanks anyway
Stefan.