TFA9879 How to enable amplifier?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

TFA9879 How to enable amplifier?

1,278 Views
kvl1
Contributor I

Hi

We got a problem enabling the amplifier.

After configuration (and before) the status register reads 0x7007. This indicated that the Amplifier mode is off. But how can it be off when the device is powered on and enabled in register 0x00? 

Here is the initialisation code:

// Reset
out[0] = 0x00; // 0000 0000 - 0000 0010 Device control register: SW Reset
out[1] = 0x02;
I2C_WriteBlock(0x00, out, sizeof(out));


// Config serial
out[0] = 0x00; // 0000 0000 - 0001 1000 Serial interface control: Left Channel, 8 kHz + I2S data + I2S mode
out[1] = 0x18;
I2C_WriteBlock(0x01, out, sizeof(out));


osDelay(10);

// Power on
out[0] = 0x00; // 0000 0000 - 0000 0001 Device control register: Operating mode
out[1] = 0x01;
I2C_WriteBlock(0x01, out, sizeof(out));

if (I2C_ReadBlock(0, in, sizeof(in)) == 0) {
TRACE_BLK(TRC_TA_PLF, "SoundInit After: ", in, sizeof(in));
}

// Config clipping
out[0] = 0x00; // 0000 0000 0000 1000 Bypass control: clip control off
out[1] = 0x08;
I2C_WriteBlock(0x01, out, sizeof(out));

// Config Dynamic range compressor
out[0] = 0x92; // 1001 0010 1011 1010 Dynamic range compressor: clip control off
out[1] = 0xBA;
I2C_WriteBlock(0x01, out, sizeof(out));

// Config volume
out[0] = 0x10; // 0001 0000 0011 0000 Volume control register: 0dB
out[1] = 0x30;
I2C_WriteBlock(0x01, out, sizeof(out));

// Config power limiting
out[0] = 0x00; // 0000 0000 0000 0000 De-emphasis, soft/hard mute and power limiter: 0dB
out[1] = 0x00;
I2C_WriteBlock(0x01, out, sizeof(out));

// audio output enable
out[0] = 0x00; // 0000 0000 - 0000 1001 Device control register: Amplifier mode + Operating mode
out[1] = 0x09;
I2C_WriteBlock(0x01, out, sizeof(out));


if (I2C_ReadBlock(0, in, sizeof(in)) == 0) {
TRACE_BLK(TRC_TA_PLF, "SoundInit: ", in, sizeof(in));
}

And here is the read-back of all the registers:

SoundInit: 

0009 0018 0007 0a18 0007 59dd c63e 651a 
e53e 4616 d33e 4df3 ea3e 5ee0 f93e 0008 
92ba 12a5 0004 1030 0000 7007 

A sample of the serial data:

pastedImage_7.png

The schematic (Note: The TEST pins is grounded, however the NC pins are NC.):

pastedImage_9.png

Help needed. Both outputs are a 0V at all time, and no sound in the 4ohm speaker, not even a click.

Thanks

Kasper

0 Kudos
8 Replies

1,152 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi Kasper,

I am not 100% sure how to read your code.

For example:

// Config clipping
out[0] = 0x00; // 0000 0000 0000 1000 Bypass control: clip control off
out[1] = 0x08;
I2C_WriteBlock(0x01, out, sizeof(out));

Does it mean that 0x0008 is written to Register 0x01? If not, where do you specify the register address?

Best regards,

Tomas

0 Kudos

1,152 Views
kvl1
Contributor I

Exactly :-) The command was prepared to write all registers at once, but I ended up only writing a single register one by one.

0 Kudos

1,152 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi Kasper,

Ok then did you change properly the register address? From your code above you are first writing to the Device control register (0x00), but then always to the Serial interface input 1 register (0x01).

Best regards,

Tomas

0 Kudos

1,152 Views
kvl1
Contributor I

Hi,

We are only using Serial interface input 1

  • In register 0x00: INPUT_SEL is set to 0. 
  • The serial Interface input 1 is configured by writing to register 0x01

You can see the result at the original post, here marked in red:

Header 1

SoundInit: 

0009 0018 0007 0a18 0007 59dd c63e 651a 
e53e 4616 d33e 4df3 ea3e 5ee0 f93e 0008 
92ba 12a5 0004 1030 0000 7007 

Register 0x00: 0x0009 (Amplifier mode and Operating mode)

Register 0x01: 0x0018 (Left channel, 8kHz, I2S data up to 24 bits, no SCK signal polarity inversion, I2S mode)

It should be in order.

And the status register: 0x7007

  • PS=1: class-D audio amplifier power stage switching; PWM signals on pins OUTA and OUTB
  • PORA=1: 1V8 analog regulator output is available and correct
  • OCPOKA=OCPOKB=OTPOK=1: All protection circuits are inactive
  • AMP=00: but amplifier is off!!! 

Kasper

0 Kudos

1,152 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi Kasper,

Have you had a chance to test more devices and have you observed this issue on all of them? If so, you can try to simplify the code by only writing the following commands.

// Reset
out[0] = 0x00; // 0000 0000 - 0000 0010 Device control register: SW Reset
out[1] = 0x02;
I2C_WriteBlock(0x00, out, sizeof(out));

// Config volume
out[0] = 0x16; // 0001 0110 0011 0000 Volume control register: 0dB
out[1] = 0x30;
I2C_WriteBlock(0x13, out, sizeof(out));

// Config serial
out[0] = 0x00; // 0000 0000 - 0001 1000 Serial interface control: Left Channel, 8 kHz + I2S data + I2S mode
out[1] = 0x18;
I2C_WriteBlock(0x01, out, sizeof(out));

// audio output enable
out[0] = 0x00; // 0000 0000 - 0000 1001 Device control register: Amplifier mode + Operating mode
out[1] = 0x09;
I2C_WriteBlock(0x00, out, sizeof(out));

 

if (I2C_ReadBlock(0, in, sizeof(in)) == 0) {
TRACE_BLK(TRC_TA_PLF, "SoundInit: ", in, sizeof(in));
}

Best regards,

Tomas

0 Kudos

1,152 Views
kvl1
Contributor I

Hi Tomas

Thanks for answering. It seems to be a HW fault on the prototype. 

Now readback of the settings is diferent:

SoundInit After:
0009 0018 0007 0a18 0007 59dd c63e 651a
e53e 4616 d33e 4df3 ea3e 5ee0 f93e 0008
92ba 12a5 0004 1030 0000 216f

Odd.

Thanks

Kasper

0 Kudos

1,152 Views
TomasVaverka
NXP TechSupport
NXP TechSupport

Hi Kasper,

It seems the TFA9879 is still not working, correct?

The status register indicates 0x216F which means that the I2S is incorrect.

Can you please make some scope pictures of the LRCK1 and SCK1? Is the LRCK1 and SCK1 jitter-free?

pastedImage_2.png

pastedImage_3.png

Best regards,

Tomas

0 Kudos

1,152 Views
kvl1
Contributor I

I know. There was no audio stream. When the audio was on, the status register read 0xA747. :-)

Thanks

0 Kudos