General purpose input parameters controlled by an external microcontroller

Discussion created by BrettG on Jun 21, 2010
Latest reply on Nov 10, 2011 by redBeard

Method 1: Using the GPIO Value Registers


The ADAU1761, ADAU144x, and ADAU1781 SigmaDSPs are capable of reading GPIO inputs from registers instead of pins. Please take a look at AN-951:

The use case of interest is “Input Driven by Control Port,” which is shown in Figure 16 on page 6.


The corresponding registers in the ADAU1761 allowing control over the GPIO inputs are shown here:

ScreenHunter_27 Jun. 22 11.25.jpg


I attached two example projects. In both projects, the schematic is the same. A GPIO input is connected to a readback cell, which allows you to read back the value of the signal via the I2C/SPI port.

ScreenHunter_03 Jun. 22 10.24.jpg


In the first project, Input_GPIO_Switch_S3.dspproj, the GPIO registers are configured as GPIO Active, Input Debounce mode.

ScreenHunter_04 Jun. 22 10.26.jpg


The data flow for this use case is shown in this figure:

ScreenHunter_28 Jun. 22 11.30.jpg


If I download this project and press the switch S3 on the evaluation board, I can see that I read back zero (5.23 format) on the DSP readback cell.

ScreenHunter_06 Jun. 22 10.27.jpg


If I release the switch S3 on the evaluation board, I can read back one (5.23 format) on the DSP readback cell.

ScreenHunter_07 Jun. 22 10.28.jpg


In the second project, “Input_GPIO0SET_Register_1568”, the GPIO pin changes its function to an I2S port. However, the DSP core reads its value from an address instead.


Unfortunately there is a small error in this figure. The arrow  connecting REGISTER and DSP CORE should have its direction reversed. So,  the value goes in through the CONTROL PORT, is written to the REGISTER,  and then read into the DSP CORE.

ScreenHunter_26 Jun. 22 11.23.jpg


Here are the register settings for this case. Note that all GPIO pins are used for the I2S port, but the core will read GPIO input values from the corresponding GPIO register.

ScreenHunter_09 Jun. 22 10.30.jpg


Now I open the Register Read/Write Window…

ScreenHunter_10 Jun. 22 10.31.jpg


If I write 0x00 0x80 0x00 0x00 to the GPIO0SET register (address 1568 in the case of the ADAU1761)…

ScreenHunter_11 Jun. 22 10.33.jpg


I read back 1.

ScreenHunter_12 Jun. 22 10.34.jpg


If I write 0x00 0x00 0x00 0x00 to address 1568…

ScreenHunter_13 Jun. 22 10.34.jpg


I read back 0.

ScreenHunter_14 Jun. 22 10.35.jpg


Using this method, you can have direct control over a GPIO input in the signal flow, regardless of what value is actually on the input pin. All you need to do is configure the GPIO pin as "Input controlled by I2C/SPI port."


Method 2: Creating a "Dummy" DC Source


This method works for all SigmaDSPs.


Create a DC source in the project.

ScreenHunter_16 Jun. 22 10.40.jpg

ScreenHunter_15 Jun. 22 10.39.jpg


Give it a meaningful name.

ScreenHunter_21 Jun. 22 10.43.jpg


Compile the project.

ScreenHunter_17 Jun. 22 10.40.jpg


Click the Export System Files button.

ScreenHunter_22 Jun. 22 10.43.jpg

Save the exported files somewhere in the project folder. I named my exported files “Test.”


Open either Test.params or Test_IC1_1.PARAM.h. The address of the Test_Input you created is listed there.

ScreenHunter_24 Jun. 22 10.45.jpg

ScreenHunter_25 Jun. 22 10.46.jpg

Using this address, the MCU can update this parameter at any time.


So, using this method, you simply create one DC Source cell in the SigmaStudio project for each parameter that the MCU will be updating via the I2C port.