- Wiki VMAC PiHat Connections
- Wiki VMAC PiHat Control
- Wiki VMAC PiHat DTMF
- Wiki VMAC PiHat EEPROM
- Wiki VMAC PiHat Home AV Switch
- Wiki VMAC PiHat Matrix
- Wiki VMAC PiHat Matrix GUI
- Wiki VMAC PiHat Overview
- Wiki VMAC PiHat PCB
- Wiki VMAC PiHat Reset Button
- Wiki VMAC PiHat Schematic
- Wiki VMAC PiHat Service Note 1
- Wiki VMAC PiHat Specification
- Wiki VMAC PiHat SSH Remote
- Wiki VMAC PiHat Testing I/O
- Wiki VMAC PiHat Video
The HAMKit VMAC PiHat 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.
All of our sample and test code is developed in Python.
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.
Extending the preliminary matrix test code, we explore some of the other Output Control Registers.
The matrix configuration is fairly straight forward under software control.
In essence, we setup I2C to talk to the FMS6501A and then send commands to it. A typical command is structured like:
i2cbus.write_byte_data([Device Address], [Output Channel], [Command])
The below Python code will select the FMS6501A IC on the I2C and then set the matrix 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)
However, we are also able to set some additional Output Control Registers to adjust the Gain and Video Clamp.
The first register is shown in Table 1, which allows us to enable/disable an output and adjust the gain (6dB to 9dB)
The below test code will disable Output 1 and Power this Down. This places the output into a high impedance state and deselects any assigned input.
TIP: It is recommended to Disable unused outputs, as this reduces current drain and power dissipation.
import smbus DEVICE_ADDR = 0x43 #0x43 or 0x03 i2cbus = smbus.SMBus(1) #Send Command to I2C - Disable Output 1 and Power Down i2cbus.write_byte_data(DEVICE_ADDR, 0x01, 0x00)
The next register is the Channel Gain which can be used to set four different pre-selected gains.
Binary Examples for Input Channel 1:
0x81 = Binary 10000001 = 6dB 0xA1 = Binary 10100001 = 7dB 0xC1 = Binary 11000001 = 8dB 0xE1 = Binary 11100001 = 9dB
import smbus DEVICE_ADDR = 0x43 #0x43 or 0x03 i2cbus = smbus.SMBus(1) #Send Command to I2C - Input 1 to Output 1 - Gain Default of 6dB i2cbus.write_byte_data(DEVICE_ADDR, 0x01, 0x81) #Send Command to I2C - Input 1 to Output 1 - Gain Set to 7dB i2cbus.write_byte_data(DEVICE_ADDR, 0x01, 0xA1) #Send Command to I2C - Input 1 to Output 1 - Gain Set to 8dB i2cbus.write_byte_data(DEVICE_ADDR, 0x01, 0xC1) #Send Command to I2C - Input 1 to Output 1 - Gain Set to 9dB i2cbus.write_byte_data(DEVICE_ADDR, 0x01, 0xE1)
Each input supports an integrated video clamp which sets the output sync-tip level of the video to approximately 300 mV.
Alternatively, the input maybe internally biased to center signals without sync to approximately 1.25V. As we are dealing with mostly full composite video, this option is not explored here.
NB: Video Clamp Control Registers sample code to be explorer in a following update to this Wiki.