VS1053+WAV PCM RECORDER: no amplification

Designing hardware that use VLSI Solution's devices as the system controller for the entire design.
zulunation
Senior User
Posts: 30
Joined: Mon 2012-02-06 23:04

VS1053+WAV PCM RECORDER: no amplification

Post by zulunation »

Hi again,

I have switched to VS1053B/VS1063A WAV PCM RECORDER as it allows larger buffer.
I can record the sound from microphone and from line.
Everything looks fine except that i can't control gain.
Whatever i write to register SCI_AICTRL1 the result is the same.
I checked with the sine wave passed to Line In.
Also i checked with microphone.
The recorded signal amplitude is the same.

I guess there is an error in my code but i would like to check the following.

The manual for the plugin says that if REG_AICTRL1 = 1024 the recording gain is 1
if REG_AICTRL1 = 2048 gain is 2

In the manual it is called digital gain.
As i remember vs1053 has only amplifier for the microphone.
Line in is not amplified,
Am i correct?

So the REG_AICTRL1 value only works when recording from mic?

Can you confirm that plugin VS1053B/VS1063A WAV PCM RECORDER supports amplification from mic?
User avatar
pasi
VLSI Staff
Posts: 1984
Joined: Thu 2010-07-15 16:04

Re: VS1053+WAV PCM RECORDER: no amplification

Post by pasi »

You enable the mic amplifier by clearing the SM_LINE bit in SCI_MODE register. When the MIC amplifier is active, both MICP and MICN are used (differential mode).

The AICTRL1 value should always be used. The encoder doesn't need to know whether the audio is from the mic or line input(s).

Have you tried the AGC (AICTRL1=0)? If that doesn't change anything, that would be very curious. Check that you don't have any accidental leftover writes to AICTRL1 elsewhere in the code.

Which program do you use to you compare the amplitude of the encoded/PCM data?
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
zulunation
Senior User
Posts: 30
Joined: Mon 2012-02-06 23:04

Re: VS1053+WAV PCM RECORDER: no amplification

Post by zulunation »

HEllo
Thanks for help
I have checked my registry setup. It is written as stated in the manual for the plugin.
Yes I am clearing SM_LINE when recording from mic.
Also I am loading plugin_48k_l.
Plugin for the left channel. I found it experimentally, 48k_r for right does not work.

Is that correct?

I am recording the sine signal which is played from youtube through the PC speakers.
Then i am measuring sine amplitude in Sound Forge audio editor.

I will remove the mic tomorrow and feed direct signal from generator to microphone input.
And check.

Am i correct that when recording from line the AGC and gain manual settings are ignored?
Because amplifier only works on MIC. Correct?

Thanks,
User avatar
pasi
VLSI Staff
Posts: 1984
Joined: Thu 2010-07-15 16:04

Re: VS1053+WAV PCM RECORDER: no amplification

Post by pasi »

AGC / gain control is software. It is always used.

Mic amplifier is hardware. It is active when line input is not selected.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
zulunation
Senior User
Posts: 30
Joined: Mon 2012-02-06 23:04

Re: VS1053+WAV PCM RECORDER: no amplification

Post by zulunation »

It is active when line input is not selected.
And when line input is selected the amplifier is not active.
And gain settings has no effect when line input is selected.

Am i correct?
User avatar
pasi
VLSI Staff
Posts: 1984
Joined: Thu 2010-07-15 16:04

Re: VS1053+WAV PCM RECORDER: no amplification

Post by pasi »

When mic is selected, there is a fixed 26dB amplifier in the hardware, and AGC/gain control in software.
When line-in is selected, there is no fixed amplifier in the hardware, and AGC/gain control in software.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
zulunation
Senior User
Posts: 30
Joined: Mon 2012-02-06 23:04

Re: VS1053+WAV PCM RECORDER: no amplification

Post by zulunation »

Thanks

I will recheck everything again.
I have one board where everything is ok with mic with old firmware.
And a new hardware with new firmware where there is no gain.
When mic is selected, there is a fixed 26dB amplifier in the hardware, and AGC/gain control in software.
How digital gain on the adc is implemented?
The digital value is multiplied by the constant?
User avatar
pasi
VLSI Staff
Posts: 1984
Joined: Thu 2010-07-15 16:04

Re: VS1053+WAV PCM RECORDER: no amplification

Post by pasi »

If the gain control value is non-zero, the value from the ADC is multiplied by the gain value and the result is divided by 1024. That means that 1024 corresponds to 1.0x gain. 2048 is 2.0x gain, 10000 is 9.76x gain, etc.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
zulunation
Senior User
Posts: 30
Joined: Mon 2012-02-06 23:04

Re: VS1053+WAV PCM RECORDER: no amplification

Post by zulunation »

Hello,

I have checked my firmware and found a strange thing.
The gain setting works fine when recording at 8 kHz without plugin. Using standard firmware.
Gain settings with plugin (48kHz) has no effect.
I have checked the value of the SCI_AICTRL1 in the main cycle where i read fifo.
Before recording i write 2048 to SCI_AICTRL1 (gain = 2).
But when i read it's value in the cycle it's value is 65535,65534,65533 and is changing.
That is strange. I checked that value of the SCI_MODE registry and is is correct and not changing.

Could you confirm that if the value if SCI_AICTRL1 is 2048 it will remain constant during recording?

I guess there is something wrong with my firmware.
Thanks,
User avatar
pasi
VLSI Staff
Posts: 1984
Joined: Thu 2010-07-15 16:04

Re: VS1053+WAV PCM RECORDER: no amplification

Post by pasi »

I looked at the code -- the ultimate documentation. VS1053_VS1063_PcmRecorder.pdf talks about gain control and AGC, but as far as I see, the documentation doesn't really match the code.

The code seems to use AICTRL1 and AICTRL2 as feedback to indicate the number of encoded data bytes, so that you can fill the resulting WAV file with the correct value. I can't find any AGC other than fade in/out for the recording output, and volume control for the monitoring.

I'll ask Henrik.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
Post Reply