WT32 Gain settings

Ok, I’ll admit I’m confused. Can someone elaborate a bit on appripriate get setting for mic input?

Specifically, I’ve got this:

Page 41, WR32_Datasheet.pdf, Section 7.2.1 figure 15 has a good pic and description of what’s necessary. Shows the two-stage gain configuration.

7.2.5 says first stage gain set to > 21dB selects Mic input (rather than line level), which lines up with Figure 15 showing switching the first stage in/out for Mic vs Line. In fact table 13 implies gain setting 0-15 w/ 7 = 21.5dB (ie selecting Mic Input), but that’s the only gain setting > 21dB??

Section 7.2.1 also says the second stage is 7 steps between -3dB and 18dB

All this relatively makes sense, then throw in how to configure this w/ iWrap.

Now iWrap3 user guide says SET CONTROL GAIN is 0-17 hex (even though the data sheet shows 0-15 decimal). I’m assuming that the SET CONTROL GAIN, should be lining up with Table 13 in the data sheet, but it doesn’t appear to.

On top of that, how do you set the 2nd stage gain w/ iWrap? There’s a VOLUME command that shows nine volume steps (not 7) and it’s documented as setting the line out gain only.

So? I understand the datasheet gain settings, but how to configure what’s documented int he datasheet with iwrap commands? (or even PSTools if that’s necessary).

Anyone explored this space yet?

Hi,

It looks as though the gain settings are set with a PSKey value. Start PSTool and search for gain the describe button gives the following description. Individual bits in this PSKey give the settings required.

I must admit I use the MIC input and have never made changes to these settings and get very acceptable results to another WT32 using SCO audio from the microphone and stereo line in using A2DP.

Regards

Dez Ellis

440 PSKey Codec in Gain

Sets the audio input gain when using the built-in codec.

The interpretation varies depending on the device.

BlueCore2 External,

Bits [3:0] set the gain (0xF = maximum)

BC3-MM and BC5-MM

Bits [3:0] set the analogue gain (8 = optimum noise)

Bits [7:4] set the digital gain (0 = unity gain)

On other devices with a codec:

Bits [3:0] set the analogue gain (8 = optimum noise)

Bits [7:4] set the digital gain (0 = unity gain)

Bit [8] enables scaling down of DAC outputs

Important exception:

On BC7-FM, the codec ADC uses the same analogue gain as the DAC.

Therefore bits [3:0] are ignored on BC7-FM.

ah, at least this lines up with what’s documented in the data-sheet.

Wonder if it’s possible that my defaults are different due to parentage of the device. (came with 2.3 firmware, then upgraded to 3.0.0-106, then 3.0.0-165)

Looked at Codec in gain, it was set to 8, which according to the book is -24dB and configured for line input, not mic, might explain why I’m having mic troubles right now.

So, then what does iWrap SET CONTROL GAIN -do-? You’d think that it would be directly modifying the PS key, but the ranges don’t line up.

Sixerdoodle:
So, then what does iWrap SET CONTROL GAIN -do-? You’d think that it would be directly modifying the PS key, but the ranges don’t line up.

I can’t answer that one it doesn’t seem to make sense but I think a bit of experimentation may help.

Try setting the iWrap SET CONTROL GAIN to different settings then check in PSTool what values if any have changed.

Regards

Dez Ellis

Interesting, seem to be totally unrelated. Tried SET CONTROL GAIN and SET CONTROL GAIN x x DEFAULT larger numbers, smaller numbers doesn’t appear to change PSKEY_CODEC_IN_GAIN at all. Also changing PSKEY_CODEC_IN_GAIN does not appear to effect what you see when you issue a SET command in iWrap.

Maybe it’s something wacky like the true gain is the value of SET CONTROL GAIN plus the vaule of the PSKEY?

I wonder if the params are scrambled since I’ve done the firmware upgrade? perhaps I need to do the PStools Factory Restore All and start clean.

btw, looks like I’m getting a good 50mv signal on the mic differential inputs, so I think I should be good, but it’s way low on an audio call

More experimentation. the PSKEY_CODEC-IN/OUT_GAIN values must not doing anything when iWrap is involved.

First I SET CONTROL GAIN 0 0 DEFAULT

reset

then used pstools to change the codec out gain, first at 5, then at 7, then at 17(hex), then f7(hex). (reset between each) I got NO playback volume, but then as soon as I went into iWrap and did a SET CONTROL GAIN 11 11 DEFAULT (then a reset), now I’ve got volume. Dinking the out codec gain variable didn’t change the playback volume, but changing the SET CONTROL GAIN -did-.

Hi,

You seem to be working your way around the hurdles. I don’t think that your upgrade path is a problem. I suspect that their documentation just does not relate to reality and is lacking in detail. It may be an idea to ask questions about this to their technical support team.

Regards

Dez Ellis

after an e-mail exchange with BlueGiga technical support (they’re pretty responsive), here’s what I know…

The gains associated with the iWrap SET CONTROL GAIN command are:

dB Gain     iWrap value
  -24            0
  -20.5          1
  -18            2
  -14.5          3
  -12            4
   -8.5          5
   -6            6
   -2.5          7
    0            8
    3            9
    6            a
    9            b
   12            c
   15            d
   18            e
   21            f
   24.5         10
   27           11
   30.5         12
   33           13
   36.5         14
   39           15
   42.5         16

Note - same dB gain values for both the Input and Output SET CONTROL GAIN values.

The PSTOOL values do NOT affect the gain when using iWrap. In fact there’s a vague comment to that effect in the data sheet which says

“The overall gain control of the ADC/DAC is controlled by a VM function”

That ‘VM function’ is what SET CONTROL GAIN uses and on boot the SET CONTROL GAIN {DEFAULT} settings overwrite the PSTOOL values.

As far as Mic level vs Line level gain goes, every firmware version prior to build 231 is hard-coded to Mic Level gains (which adds +24dB to all the input dB gain values above). Build 231, which is only in beta right now will add a SET CONTROL PREAMP command to switch between Mic and Line level input (turning that additional +24Db gain on and off). But as that’s only in beta, right now everything is hard-coded to Mic level gains.

Hi,

Thanks for clarifying the issue and posting the explanation and update.

Regards

Dez Ellis