SIGMA STUDIO FIRST PROJECT
i made this project , simple volume control and generated files by link , compile, download. . then using codes integrated this to existing processor code having adau1761 configuration and differential loopback logic . but on varying gain value in code did not got any response. kindly help
Fullscreen
sigma_loader.cc.txt
Download
#include <stdint.h>
#include <stdio.h>
#include "sigma_loader.h"
#include "sigma_program.h"
#define ADAU1761_DSP_RUN_REG 0x40F6
#define SIGMA_PROGRAM_BASE 0x0800
#define SIGMA_GAIN_ADDR 8
static int sigma_stop_dsp(audio_codec *codec)
{
uint8_t v = 0x00;
codec->writeCodecBytes(ADAU1761_DSP_RUN_REG, &v, 1);
return 0;
}
static int sigma_start_dsp(audio_codec *codec)
{
uint8_t v = 0x01;
codec->writeCodecBytes(ADAU1761_DSP_RUN_REG, &v, 1);
return 0;
}
static int sigma_load_program(audio_codec *codec)
{
for (int i = 0; i < SIGMA_PROGRAM_WORDS; i++)
{
codec->writeCodecBytes(SIGMA_PROGRAM_BASE + i, sigma_program[i], 5);
}
return 0;
}
int sigma_set_gain_mute(audio_codec *codec)
{
uint8_t gain[4] = {0x00, 0x00, 0x00, 0x00}; // Gain = 0
codec->writeCodecBytes(SIGMA_GAIN_ADDR, gain, 4);
return 0;
}
int sigma_set_gain_normal(audio_codec *codec)
{
uint8_t gain[4] = {0x00, 0x80, 0x00, 0x00}; // Gain = 1.0
codec->writeCodecBytes(SIGMA_GAIN_ADDR, gain, 4);
return 0;
}
int sigma_set_gain_half(audio_codec *codec)
{
uint8_t gain[4] = {0x00, 0x40, 0x00, 0x00}; // Gain = 0.5
codec->writeCodecBytes(SIGMA_GAIN_ADDR, gain, 4);
return 0;
}
int sigma_load_gain0_program(audio_codec *codec)
{
sigma_stop_dsp(codec);
sigma_load_program(codec);
sigma_set_gain_mute(codec);
sigma_start_dsp(codec);
printf("SigmaStudio Gain=0 program loaded\n");
return 0;
}
Fullscreen
sigma_loader.h.txt
Download
#ifndef SIGMA_LOADER_H
#define SIGMA_LOADER_H
#include "audio_codec.h"
int sigma_load_gain0_program(audio_codec *codec);
int sigma_set_gain_mute(audio_codec *codec);
int sigma_set_gain_normal(audio_codec *codec);
int sigma_set_gain_half(audio_codec *codec);
#endif
Fullscreen
sigma_program.h.txt
Download
#ifndef SIGMA_PROGRAM_H
#define SIGMA_PROGRAM_H
#include <stdint.h>
static const uint8_t sigma_program[][5] = {
{0x00, 0x00, 0x00, 0x00, 0x00},
{0xFE, 0xE0, 0x00, 0x00, 0x00},
{0xFF, 0x34, 0x00, 0x00, 0x00},
{0xFF, 0x2C, 0x00, 0x00, 0x00},
{0xFF, 0x54, 0x00, 0x00, 0x00},
{0xFF, 0x5C, 0x00, 0x00, 0x00},
{0xFF, 0xF5, 0x08, 0x20, 0x00},
{0xFF, 0x38, 0x00, 0x00, 0x00},
{0xFF, 0x80, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00},
{0xFE, 0xE8, 0x0C, 0x00, 0x00},
{0xFE, 0x30, 0x00, 0xE2, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00},
{0xFF, 0xE8, 0x07, 0x20, 0x08},
{0x00, 0x00, 0x06, 0xA0, 0x00},
{0xFF, 0xE0, 0x00, 0xC0, 0x00},
{0xFF, 0x80, 0x07, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00},
{0xFF, 0x00, 0x00, 0x00, 0x00},
{0xFE, 0xC0, 0x22, 0x00, 0x27},
{0x00, 0x00, 0x00, 0x00, 0x00},
{0xFE, 0xE8, 0x1E, 0x00, 0x00},
{0xFF, 0xE8, 0x01, 0x20, 0x00},
{0xFF, 0xD8, 0x01, 0x03, 0x00},
{0x00, 0x07, 0xC6, 0x00, 0x00},
{0xFF, 0x08, 0x00, 0x00, 0x00},
{0xFF, 0xF4, 0x00, 0x20, 0x00},
{0xFF, 0xD8, 0x07, 0x02, 0x00},
{0xFD, 0xA5, 0x08, 0x20, 0x00},
{0x00, 0x00, 0x00, 0xE2, 0x00},
{0xFD, 0xAD, 0x08, 0x20, 0x00},
{0x00, 0x08, 0x00, 0xE2, 0x00},
{0x00, 0x00, 0x08, 0x20, 0x00},
{0x00, 0x10, 0x00, 0xE2, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x15, 0x08, 0x20, 0x00},
{0xFD, 0xB0, 0x00, 0xE2, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00},
{0xFE, 0x30, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00},
{0xFE, 0xC0, 0x0F, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00}
};
// add all remaining rows from your hex_program_data.dat
};
#define SIGMA_PROGRAM_WORDS (sizeof(sigma_program) / sizeof(sigma_program[0]))
#endif
does this mean to disable mixer loopback and loopback to be done in sigma studio?
software
4.7
processors and dsp
adau1761
Processors and Microcontrollers
Hello Vinaybhatt,
I have attached a simple project and files that I used to control the mute function from MCU.
You can try this working code in your MCU, so that we can rule out some comms issue, if present in your setup.
Make sure that the I2C address is configured correctly in both software and hardware, if you use I2C.
mcu_mute_IC_1_PARAM.zip
The audio path is stereo input to headphone output.
Regards,
Harish
Thanks Harish,
if mixer loopback is already running. will adding sigma studio project have no effect?
Regards
Vinay
Hello Vinay,
You can't add different function (any new function) and export the code and add in to the existing code.
If you want to add any new functionality into your existing project, then you will have to design that new part (in your case, gain module) in the existing sigma studio project (mixer loopback project) and export the files (latest) again and integrate it into your MCU code.
You can't export two different project and combine the exported files into MCU and try to control the DSP. It won't work that way.
So, please add this gain module into the mixer loopback sigma studio project and re-compile everything and export the files and use it.
Kindly let me know if I understood your question wrongly.
Regards,
Harish
Please log in to reply.


