Package: sigmadsp
Analog Devices Sigma DSP control softwareThis software package is a Python application, which controls Analog Devices
digital signal processors (DSPs). It exposes a TCP server for
connecting with SigmaStudio, allowing to upload new applications to the DSP, as well as debugging it. Essentially, it
behaves like a wired debug probe, but with an Ethernet connection. This source code was inspired bythe original TCP service,
as well as thehifiberry-dspproject. However, this application was written completely from scratch, in an effort to make it more efficient, stable, and faster.This software package contains two separate components: a backend service, as well as a frontend interface. It is meant
to run on single-board computers that connect to an Analog Devices DSP via the serial peripheral interface (SPI) - specifically the Raspberry Pi.Backend serviceThe backend service is the core application, whichconnects to the DSP via SPI or I2C,exposes a TCP interface towards SigmaStudio (on the default port8087),and provides a remote procedure call (RPC) interface, based ongrpc.With the latter, a frontend can connect to the backend service and control it remotely.Frontend interfaceThe frontend interface connects to the RPC service of the backend, allowing the user to control
settings via a command-line interface (CLI). Currently, the frontend supportsResetting the DSP (soft or hard)Read arbitrary registersChange or set volume on a DSP volume registerRead SigmaStudio parameter files and parse them in the backendSupported chipsetsThis is not an extensive list, but only comprises chips that are tested or likely compatible.DSPStatusBackend settingsdsp_typeADAU140xUntested, but register compatible with ADAU170xadau1x0xADAU170xTestedadau1x0xADAU145XTestedadau14xxADAU146XTestedadau14xxThe last column denotes the string to put in the backend settings file (seeConfiguration) for thedsp_typesetting.Installation:zap:Running the installation can overwrite your existing configuration.For upgrading, seeUpgrading!For installing, please install git first, then clone this repository and run the installation script.sudoaptinstallgit&&gitclonehttps://github.com/elagil/sigmadsp.git&&cdsigmadsp&&./install.shThe script installs the Python package, which includes thesigmadsp-backend(the backend) andsigmadsp(the frontend) executables.
It also sets up a system service, which runssigmadsp-backendin the background.pipxis used for installing the Python package in an isolated way, without having to usesudo pip install <package>.UpgradingFor upgrading, usepipxto upgrade the Python package and restart the backend service afterwards:pipxupgradesigmadsp&&sudosystemctlrestartsigmadsp-backend.serviceRemovalFrom within the previously cloned repository foldersigmadsprun./uninstall.shIf you find that this removal procedure leaves any files unremoved, please open an issue.Backend configurationConfiguration ofsigmadspis done via a*.yamlfile, which is created during installation. Its default path is/var/lib/sigmadsp/config.yaml. The default configuration is shown below.# This config.yaml file contains all settings that can be changed on the sigmadsp-backend.# The IP address and port, on which the sigmadsp-backend listens for requests from SigmaStudio.host:# The default value "0.0.0.0" allows listening on any address.ip:"0.0.0.0"port:8087# Settings for the sigmadsp-backend.backend:# The port, on which the sigmadsp-backend is reachable.port:50051parameters:# The parameter file path, which contains DSP application parameters,# such as cell names, addresses and other information. This parameter file is required# for the backend, in order to be able to control DSP functionality at runtime, e.g. volume.path:"/var/lib/sigmadsp/current.params"dsp:# The type of the DSP to control with the sigmadsp-backend service.# Can be "adau14xx" or "adau1x0x".type:"adau14xx"# The protocol used to communicate.# Can be "spi" or "i2c"protocol:"spi"bus_number:"0"device_address:"0"pins:# The DSP's hardware reset pin.reset:number:17active_high:falseinitial_state:truemode:"output"# The self-boot pin, enabling the DSP to load its application from external flash when set.self_boot:number:22active_high:trueinitial_state:truemode:"output"Frontend usageFor a list of commands that can be emitted by the frontend, please type$sigmadsp--help
Usage:sigmadsp[OPTIONS]COMMAND[ARGS]...Command-linetoolforcontrollingthesigmadsp-backend.

Options:--portINTEGERSettheport,onwhichthebackendlistensforrequests.[default:50051]--ipIPV4ADDRESSSettheIPaddress,onwhichthebackendlistensforrequests.[default:127.0.0.1]--helpShowthismessageandexit.

Commands:change-volumeChangesthevolumebyacertainamountindB.load-parametersLoadaparameterfile.read-registerReadsaDSPregister.resetResetstheDSP.set-volumeSetsthevolumetoacertainvalueindB.For more information on a command, use--helpon that command, for example$sigmadspread-register--help
Usage:sigmadspread-register[OPTIONS]ADDRESSLENGTHReadsaDSPregister.

Options:--helpShowthismessageandexit.Loading parametersA key feature of this application is the ability to control the connected DSP at runtime. At this point, it is only possible
to adjust the volume of a volume cell by means of thechange-volumeandset-volumecommands.For this to work, the backend requires knowledge about the program that is loaded onto the DSP. The register
addresses at which the volume cells are located, must be known, in order to adjust their values.
Conveniently, SigmaStudio can export a so-called parameter file that holds this information.The safety hash cellThere is a safety mechanism is thesigmadspapplication that makes sure that the parameter file matches the software
that is running on the DSP. This is important, as changing the DSP software also changes register addresses. If thesigmadspapplication attempted to write to an incorrect register address, this can have unforseeable consequences.Therefore, you must include aDCcell in your DSP program, which contains a random value, and is calledsafety_hash.
On startup, thesigmadsp-backendwill try to read thesafety_hashcell from the DSP and only allow write access,
if the content matches the value of the provided parameter file. This ensures that the parameter file and DSP application
are consistent.This is an example of a safety hash cell.Defining adjustable cellsFor thechange-volumeandset-volumecommands to work, there needs to be at least one adjustable volume slider in the
DSP program. Currently, only a single slider is supported for adjustment.Add a volume slider, as seen below, to your program. Be sure to call itadjustable_volume_main.In the future, multiple adjustable sliders will be supported. They will be addressed by means of a unique name.
The naming scheme for sliders will beadjustable_volume_<name>.Exporting and loading a parameter fileFinally, the parameter files of the DSP program can be exported and loaded into sigmadsp.First, use theExport system filesfeature of SigmaStudioStore the files in a location of your choice. Among the exported files, there is one file that has the ending*.param.
Transfer it to the Raspberry Pi that runs thesigmadspapplication.Next, run$sigmadspload-parameters<parameter_file>.paramsIf the safety hash cell content did not match, the call will returnINFO:root:Safetycheckfailed,parameterscannotbeadjusted.If everything went well, the call instead returnsINFO:root:Loadedparameters,controlisunlocked.In that case, you can now adjust volume settings, for example by setting a new value in dB$sigmadspset-volume-10
INFO:root:Setvolumeofcell'adjustable_volume_main'to-10.00dB.or by adjusting the current value by a certain offset in dB with$sigmadspchange-volume-10
INFO:root:Setvolumeofcell'adjustable_volume_main'to-20.00dB.Thechange-volumecommand reads the current volume level, and changes it by the chosen amount.