This version (27 Jan 2020 15:08) was approved by Joshua Berlin.The Previously approved version (27 Jan 2020 15:05) is available.Diff

Master Control Port Runtime Sequential Write (ADAU145x)

Click here to return to the Master Control Port page

The master control port Runtime Sequential Write block allows communication with external devices during audio processing. Typically this block is used to transfer data to an external device like a converter or codec. Communication over the master control port bus (I2C or SPI) occurs once per external trigger. The data transferred between host and device is defined in a SigmaStudio sequence file which can be generated using the SigmaStudio sequence window.

Input Pins

NameFormat [int/dec] - [control/audio]Function Description
Pin 0: Trigger decimal - controlRising edge in the trigger signal, initiates the sequential write

Output Pins

NameFormat [int/dec] - [control/audio]Function Description
Pin 0: Write Statusdecimal - controlOutputs 1 while the sequential write is in progress. otherwise outputs 0


Click on to configure the parameters.

I2C configuration

GUI Control

GUI Control NameDefault ValueRangeFunction Description
Bitrate400 kHz 20 kHZ - 400 kHZI2C Speed
Device Address00 – 127I2C Slave Device Address
Sub-Address Bytes21-4 Length of the sub address
Sequence file--Device write/read sequence to execute at boot time.This file can be defined and saved from SigmaStudio's sequence window.

SPI configuration

GUI Control

GUI Control NameDefault ValueRangeFunction Description
Bitrate100 kHz 100 kHZ - 100000 kHZSPI Speed
SS_M Pin00SPI Slave Select
MP Slave Select ChannelDisabled (Enabled by click on radio button)0 – 7SPI Slave Select Channel
Sub-Address Bytes21-4 Length of the sub address
Command Length11-4 Length of the command sent in bytes
Write Instruction00-255Instruction value for a write operation (0x0 for ADI audio devices, typically 0x2 for eeprom/flash)
Write-Enable instruction60 - 255Instruction value for device write-enable operation (ignored for Master Control Port I/O Boot)

Steps to Configure

  1. Drag the block into a schematic design.
  2. Open the control port property window by clicking on image and configure all the required properties.
  3. Ensure that the 'Sub-Address Bytes:' and the 'Device Address' are entered correctly.
  4. Select a “Sequence File” that defines the desired communication with the device.
  5. Click “OK”. The control port data will be embedded in the DSP program. This step is necessary whenever the sequence file is modified.
  6. Connect the trigger signal to the input pin.
  7. Add multiple instances to configure multiple slaves during the runtime.

Support for Multiple Slaves

Multiple external devices can be configured by creating multiple instances of the Runtime Sequential Write module and selecting appropriate slave select pins in the configuration parameters as detailed below.

Support for Different SPI Slave Select

If the device to be programmed is selected through MP0 (the /SS_M pin), no configuration is required in the register controls. Otherwise, the multipurpose pin must be configured to act as the slave select in the Register Window. (Hardware Configuration → ICx - ADAU145x Register Controls → MULTIPURPOSE/AUXADC)

  1. Slave Select Channel → 'Slave Select Channel x'
  2. MPx pin mode → 'Slave Select for Master SPI port'
  3. MPx pin function → 'Multipurpose function'

The following table shows the mapping between the module's parameter and the register control window. Please note that for some other blocks, there is an offset of 1 between the module parameter and the register control window.

'Slave Select' in Configuration Window 'Slave Select Channel' in the Register Control Window
0 Slave Select Channel 0
1 Slave Select Channel 1
2 Slave Select Channel 2
3 Slave Select Channel 3
4 Slave Select Channel 4
5 Slave Select Channel 5

Creating Sequence File for SPI/I2C slave not supported by SigmaStudio

Use the following file and edit for your slave.

<?xml version="1.0" standalone="no"?>
<ROM IC="ADAU1361" IC_Address="112" Address_byte_length="2">
  <page modetype="Mode 0">
    <action instr="writeXbytes" len="3" addr="16384" ParamName="Reg1" DspName="IC 1">0F</action>
    <action instr="writeXbytes" len="8" addr="16386" ParamName="Reg2" DspName="IC 1">00 FD 00 0C 20 01</action>
    <action instr="delay" ParamName="IC 1.Delay" DspName="IC 1">00 64</action>
    <action instr="writeXbytes" len="3" addr="16405" ParamName="IC 1.Serial Port Control Registers.Serial Port Control 0" DspName="IC 1">00</action>

Please follow the steps below to edit the XML for your Slave.

  • Edit IC, IC_Address and Address_byte_length fields in xml. Please note that IC_Address should be an 8-bit I2C address in decimal format. Address_byte_length refers to the length, in bytes, of the external IC's address space.
<ROM IC="ADAU1361" IC_Address="112" Address_byte_length="2">
  • Add your register writes as shown below.
<action instr="writeXbytes" len="8" addr="16386" ParamName="Reg2" DspName="IC 1">00 FD 00 0C 20 01</action>
Please match all the fields as follows. 
      instr => "writeXBytes" 
      len => Data Length in bytes+ Address_byte_length
      addr => Register Address in decimal (not hexadecimal)
      Then the value part should have the register values in Hexadecimal. A space should separate each data as shown in the example.   In this example len => 6 (data length)  + 2 (Address_byte_length) = 8
  • You can add delays as shown below.
<action instr="delay" ParamName="IC 1.Delay" DspName="IC 1">00 64</action>

Delay is in milliseconds (Hexadecimal Format)

Supported ICs

  1. ADAU145x
resources/tools-software/sigmastudio/toolbox/mastercontrolport/mastercontrolportioexttrigger.txt · Last modified: 27 Jan 2020 15:08 by Joshua Berlin