Signal Routing and Scaling¶
Routing commands¶
The following controls are provided for configuring the signal control blocks.
Command |
Type |
Args |
Definition |
---|---|---|---|
SET_IO_MAP |
unint8 |
2 |
Configures the two input switches and four output switches.
See Destination and Source index table for valid argument options.
arg1 <Destination Index>
arg2 <Source Index>
|
SET_OUTPUT_SHIFT |
int32 |
2 |
Sets the gain for each mux block. Select mux block Destination Index followed by shift (+ve is left, -ve is right shift)
arg1 <Destination Index>
arg2 <shift value>
|
SET_OUTPUT_SHIFT |
uint32 |
8 x 3 |
Get all IO_MAP and OUTPUT_SHIFT values for all destinations |
SET_MIC_SHIFT_SATURATE
GET_MIC_SHIFT_SATURATE
|
uint32 |
2 |
Sets the gain on the raw mic signals before entering the Pipeline
arg1 <shift value (left shift)>
arg2 <saturate, enable if =1 >
|
Destinations¶
The Destination channels available to be mapped are referenced as follows:
Channel (Destination) |
Value |
Definition |
---|---|---|
USB_FROM_DEVICE_0 |
0 |
USB channel 0 output from device to host |
USB_FROM_DEVICE_1 |
1 |
USB channel 1 output from device to host |
I2S_FROM_DEVICE_0 |
2 |
I2S channel 0 output from device |
I2S_FROM_DEVICE_1 |
3 |
I2S channel 1 output from device |
REF_TO_PIPELINE_0 |
4 |
reference channel 0 going into the pipeline |
REF_TO_PIPELINE_1 |
5 |
reference channel 1 going into the pipeline |
MIC_TO_PIPELINE_0 |
6 |
microphone channel 0 going into the pipeline |
MIC_TO_PIPELINE_1 |
7 |
microphone channel 1 going into the pipeline |
Sources¶
Sources available to be mapped to destinations are referenced as follows:
Channel (Source) |
Value |
Definition |
---|---|---|
MUTE |
0 |
Zeros are sent to the destination if this value is selected, which mutes the channel |
USB_TO_DEVICE _AVERAGE |
1 |
Average of USB input from host to device. |
USB_TO_DEVICE _DIFFERENCE |
2 |
Half of the difference between ch0 and ch1 of USB input from host to device. |
I2S_TO_DEVICE _AVERAGE |
3 |
Average of I2S input to device. |
I2S_TO_DEVICE _DIFFERENCE |
4 |
Half of the difference between ch0 and ch1 of I2S input to device. |
PIPELINE_OUT_0 |
5 |
Pipeline output channel 0 |
PIPELINE_OUT_1 |
6 |
Pipeline output channel 1 |
USB_TO_DEVICE_0 |
7 |
USB input channel 0 from host to device |
USB_TO_DEVICE_1 |
8 |
USB input channel 1 from host to device |
I2S_TO_DEVICE_0 |
9 |
I2S input channel 0 to device |
I2S_TO_DEVICE_1 |
10 |
I2S input channel 1 to device |
MIC_IN_0 |
11 |
Ch0 Microphone input seen by the pipeline |
MIC_IN_1 |
12 |
Ch1 Microphone input seen by the pipeline |
PACKED_PIPELINE_OUTPUT |
13 |
pack 16kHz pipeline output on 48kHz output |
PACKED_MIC |
14 |
pack 16kHz mic input to pipeline on 48kHz output |
PACKED_REF |
15 |
pack 16kHz reference input to pipeline on 48kHz output |
PACKED_ALL |
16 |
pack 1 channel of 16kHz mic, reference input and pipeline. When this option is used, the other channel of the same output also gets PACKED_ALL set in its IO map. |
PACKED_ALL_INPUT_USB |
17 |
pack 16kHz mic and reference into a 48kHz USB input |
PACKED_ALL_INPUT_I2S |
18 |
pack 16kHz mic and reference into a 48kHz I2S input |
NOTE: The MIC_IN_0 and MIC_IN_1 signals are at 16kHz. If they are routed to a 48kHz output they will be sample repeated three times. No antialiasing filter is applied.
Further details of the PACKED format are given in the Capturing packed samples page in the reference section.
Example Routing Commands¶
The following section illustrates how to use the IO mapping and scaling commands.
Using the SET_IO_MAP command, the user can choose the sources that get routed to the following 3 destinations -
the USB output from device to host
the I2S output from the device
the reference going into the device
For instance, to route I2S channel 0 (= 9 as shown in the Source table) input to the device to USB channel 1 output from the device (= 1 as shown in the destination table), the command is:
vfctrl_usb SET_IO_MAP 1 9
where the first argument “1” refers to USB_FROM_DEVICE_1 as shown in the destination table and the second argument “9” refers to I2S_TO_DEVICE_0 in the source table.
Signal routing is also useful for hardware debugging of microphone or reference signal connection. As an example, the following command routes USB reference channel 0 from host to the USB audio output channel 0 of the XVF3610:
vfctrl_usb SET_IO_MAP 0 7
This command sets a loopback of the reference signal given to the XVF3610 to its audio output. By playing a simple reference signal, e.g., a sine wave, the user can verify if the XVF3610 has received the signal properly through its audio output. If the audio signal recorded at host is different from the reference output, the user may check if the problem is caused by hardware connection failure or wrong data format.
Signal routing can also be used for debugging microphone signal:
vfctrl_usb SET_IO_MAP 1 12
The above command routes microphone channel 1 as the direct signal to the USB audio output of the XVF3610. Microphone signals can the be verified by recording the audio output from the XVF3610.
For XVF3610-UA, its I2S master interface can be used for sending out different signals as shown in the source channel table while having the USB output processed audio. For example, the following command configures the XVF3610 to send mic, reference and pipeline outputs in 16kHz sampling frequency packed to 48kHz I2S output:
vfctrl_usb SET_IO_MAP 2 16
vfctrl_usb SET_IO_MAP 3 16
By using Raspberry Pi with I2S slave interface configured, the user can then capture synchronized signals of mic, reference and pipeline output. Observing these signals can be very useful for debugging. The packed signal can be unpacked to mic, reference and pipeline signal with 2 channels in each of them by using a Python script provided in the Release Package.
The SET_OUTPUT_SHIFT command can be used to specify a bit shift that is applied to all samples of a given target. For example, specifying:
vfctrl_usb SET_OUTPUT_SHIFT 2 4
applies a left shift of 4 bits on all samples output from the device on I2S channel 0 as 24=16x of gain. A negative shift value would imply a right bit shift for attenuation.
The GET_IO_MAP_AND_SHIFT command displays the IO mapping and the shift values for all targets.
Executing a GET_IO_MAP_AND_SHIFT command without having set any mapping or shifts explicitly shows the default mapping that is configured in firmware.
vfctrl_usb GET_IO_MAP_AND_SHIFT
GET_IO_MAP_AND_SHIFT:
target: USB_FROM_DEVICE_0, source: PIPELINE_OUT_0 output shift: NONE
target: USB_FROM_DEVICE_1, source: PIPELINE_OUT_1 output shift: NONE
target: I2S_FROM_DEVICE_0, source: PIPELINE_OUT_0 output shift: NONE
target: I2S_FROM_DEVICE_1, source: FAR_END_IN_0 output shift: NONE
target: REF_TO_PIPELINE_0, source: USB_TO_DEVICE_0 output shift: NONE
target: REF_TO_PIPELINE_1, source: USB_TO_DEVICE_1 output shift: NONE