The HAMKit VMAC PiHat v1 audio and video matrix is totally controlled by a FMS6501A. This device is a 12 inputs and 9 outputs Video Switch Matrix IC, controlled by I2C. The matrix I/O offers 1 to 1, or 1 to many, input/outputs.
The datasheet link is provided below.
Although the FMS6501A is primarily designed for video switching, the wide dynamic range, voltage levels at 1Vpp and minimal cross talk and distortion, also makes it ideal for switching audio too.
For audio, all that is required is to change the input and output impedance from 75 Ohms to 600 Ohms. Also, the input clamp and input bias circuitry is not required/enabled for audio. The programmable gain can be used for both, if required but generally set to the lowest of 6dB.
The HAMKit VMAC PiHat is only using seven (6 RCA and 1 Pi), inputs and four outputs. The remaining inputs are taken to on-board resistors to ground and the unused outputs software disabled. This allows for experimentation or future expansion, if required.
The FMS6501A is totally controlled over I2C and has two device addresses, which can be selected using the solder jumper. The default used on the HAMKit VMAC PiHat is 0x86h (DEVICE_ADDR = 0x43).
The PCB link is shown below. The bottom two pads being shorted for 0x86h (DEVICE_ADDR = 0x43)
The code example below shows how you set the default device address in Python.
import smbus #Set Bus DEVICE_BUS = 1 #Set FMS6501A I2C Address to either 0x43 or 0x03 DEVICE_ADDR = 0x43 i2cbus = smbus.SMBus(1)
Configuration details for the FMS6501A are provide below.
Inputs and Outputs
In order to provide input and output flexibility, the layout has included the ability to make any input audio or video, with the same on the outputs.
Both inputs and outputs are AC coupled and set to a fixed impedance of either 75 Ohms for video or 600 Ohms for audio.
Input impedance can be set by simply changing the resistor value as needed. The two clamping diodes are intended for video inputs, so can optionally be removed for audio inputs.
Whilst the PiHat is set for 600 Ohm audio inputs, a higher audio input impedance maybe configured, where required.
Input channels are spaced out over the 12 inputs in order to increase separation and reduce crosstalk even further.
The output has additional matching depending on audio or video usage.
Whilst the PiHat is set for 600 Ohm audio output, a higher audio output impedance maybe configured, where required.
In addition to resistor value changes to alter the impedance, two different capacitors are required depending on audio or video usage. Video requires a 220uF and Audio requires a 0.1uF.
The PCB is laid out in such a way that you easily can fit either type of capacitor. The pad positions also acts as a safety net to ensure you do not accidentally fit both in parallel.
The matrix configuration is fairly straight forward under software control.
The below Python code will select the FMS6501A IC on the I2C and then set input 1 to output 1.
import smbus DEVICE_ADDR = 0x43 #0x43 or 0x03 i2cbus = smbus.SMBus(1) #Send Command to I2C - Input 1 to Output 1 i2cbus.write_byte_data(DEVICE_ADDR, 0x01, 0x81)
You select the output and then instruct which single input is switched to it. This is 1 input to 1 output, or 1 input to many outputs. You can then have 9 separate inputs to 9 separate outputs if you wanted, even take an output back into an input (hardwired) , so it is very flexible. What you cannot do is MIX more than one input to a single output!
The Python example shows input 1 set to output 1, input 4 set to outputs 2, 3 and 4.
import smbus DEVICE_ADDR = 0x43 #0x43 or 0x03 i2cbus = smbus.SMBus(1) #Send Command to I2C - Input 1 to Output 1 i2cbus.write_byte_data(DEVICE_ADDR, 0x01, 0x81) #Send Command to I2C - Input 4 to all Outputs 2,3 and 4 i2cbus.write_byte_data(DEVICE_ADDR, 0x03, 0x87) #Input 4 to Output 2 i2cbus.write_byte_data(DEVICE_ADDR, 0x06, 0x87) #Input 4 to Output 3 i2cbus.write_byte_data(DEVICE_ADDR, 0x09, 0x87) #Input 4 to Output 4
The below example shows the flexibility in how the matrix is setup. Here we have input 1 set to output 1,input 4 set to outputs 2, 3,4 and 8, and so on.
Further details on the configuration can be found in the below link and described in more detail our other Wiki pages.