KCC's Quizzes AQQ305 about a mutual exponentiation equation
1. Quote of the month: "A train station is where a train stops. A bus station is where a bus stops. I have a work station on my desk, so..." - unknown
2. Quiz AQQ305 about finding a mutual exponential equation
Good luck, and try to be among the
View All
October Monthly Blog Quiz! Read the blog, take the quiz, and you could win a gift card
Finding Your Circuit Chi — EMC Quiz!
Think you know EMC? Test your knowledge with our 5-question quiz!
Read the blog first, then take the challenge: Finding Your Circuit Chi
Every current flowing creates electromagnetic fields.
Strong EMC design
View All
ADAU1467
Production
The ADAU1463/ADAU1467 are automotive qualified audio processors that far exceed the digital signal processing capabilities of earlier SigmaDSP® devices...
Datasheet
ADAU1467 on Analog.com
hi all,
I recently acquired the eval adau 1466Z eval board from ADI.
I struggled a bit getting it piloted by an esp32 in C, but now its tamed (using I2C). My next goal is to be able to make it behave as I want while it is running a program from its memory/eeprom.
I am ok with doing wimple writes to its registers, but I can't find any convincing code snipets to do safeload writes, the same way sigmadsp on windows an on SPI does.
So please direct me to some existing material to tweak/hack/adapt, if any; else we'll have write try to write and share a fully working C function, from scratch (which will be a pity).
Thanks for your attention and future contributions!
Regards.
in datasheet revision A of the adau1463-1467 chip we can find this:

I understand that those adresses need to be check and adjusted for each and every binary coming out of the compiler and before writing the code which will interact with the same binary being running on the DSP.
I I can find this in one of the compiler's output files:
#define MOD_SAFELOADMODULE_COUNT 20
#define MOD_SAFELOADMODULE_DEVICE "IC1"
#define MOD_SAFELOADMODULE_DATA_SAFELOAD0_ADDR 24576
#define MOD_SAFELOADMODULE_DATA_SAFELOAD0_MEMORYPAGE 0
#define MOD_SAFELOADMODULE_DATA_SAFELOAD1_ADDR 24577
#define MOD_SAFELOADMODULE_DATA_SAFELOAD1_MEMORYPAGE 0
#define MOD_SAFELOADMODULE_DATA_SAFELOAD2_ADDR 24578
#define MOD_SAFELOADMODULE_DATA_SAFELOAD2_MEMORYPAGE 0
#define MOD_SAFELOADMODULE_DATA_SAFELOAD3_ADDR 24579
#define MOD_SAFELOADMODULE_DATA_SAFELOAD3_MEMORYPAGE 0
#define MOD_SAFELOADMODULE_DATA_SAFELOAD4_ADDR 24580
#define MOD_SAFELOADMODULE_DATA_SAFELOAD4_MEMORYPAGE 0
#define MOD_SAFELOADMODULE_ADDRESS_SAFELOAD_ADDR 24581
#define MOD_SAFELOADMODULE_ADDRESS_SAFELOAD_MEMORYPAGE 0
#define MOD_SAFELOADMODULE_NUM_SAFELOAD_LOWER_ADDR 24582
#define MOD_SAFELOADMODULE_NUM_SAFELOAD_LOWER_MEMORYPAGE 0
#define MOD_SAFELOADMODULE_NUM_SAFELOAD_UPPER_ADDR 24583
#define MOD_SAFELOADMODULE_NUM_SAFELOAD_UPPER_MEMORYPAGE 0
24576 is 0x6000, so this time, adresses in table55 is my real world values, I may be lucky ;-)
The example use case it change the frequency value in the "Tone1" cell in this app
Let's figure out how sigmadsp on windows would do that...
assuming that "default_1467_esp" is my project's name, the valuable file containing the safeload adresses is "default_1467_esp_IC_1_PARAM.h". I suppose also because IC1 is the ADAU (while IC2 is the eeprom chip).
I have good news! I analysed and figured out how to do (software?) safeload write , at least of the frequency value of the Tone1 cell above; It needs quite a lot lot of C code, dancing with structures and unions, and also changing the endianness of a few byte arrays here and there, but now it works !
I will publish something simplified soon to illustrate my solution (for my own needs, so your mileage may vary..).
here is the sigmastudio project I'll use to show my current (and arbitrary) process..

for the inputs, I can select between activable pink noise sources (separate for L and R) ,or SPDIF in;
another switch at the end of the flow if to allow switching between volume controlled by one analog external pot, or by a programmable Attenuation Cell (Atten1);
the last relevant cell is ParamEqs which contains 4 (biquad ?) filters like this:

this is what I wanted to achieve first, a C function that simply toggle sele2 switch between what I call position 0 and position 1:
void safeloadSwitchNx2( union u_adau1467safeloadBuffer *theBuffer, int targetAddr, byte val){
int i = 0;
byte *src;
if( val == 0){
src = (byte *)switchNx2Val0;
} else if( val == 1){
src = (byte *)switchNx2Val1;
} else
return;
while( i < 8){
theBuffer->A[i] = *src++;
i++;
}
safeloadWrite1467( theBuffer, targetAddr, 2);
}
..assuming that
...
const byte switchNx2Val0[8] = {1,0,0,0, 0,0,0,0 };
const byte switchNx2Val1[8] = {0,0,0,0, 1,0,0,0 };
...
void safeloadWrite1467( union u_adau1467safeloadBuffer *theBuffer, uint32_t targetAddr, int howManyslots){
theBuffer->targetAddr.I32 = targetAddr; // WARNING! : do not decrement it here !!
theBuffer->page1howMany.I32 = howManyslots; // assuming all targets are in page 1 !!
// both options below are OK
#if true
reverse4Bytes( theBuffer->targetAddr.byteArr4);
reverse4Bytes( theBuffer->page1howMany.byteArr4);
#else
builtinReverse4Bytes( (union u_4bytes *) &(theBuffer->targetAddr.byteArr4));
builtinReverse4Bytes( (union u_4bytes *) &(theBuffer->page1howMany.byteArr4));
#endif
// theBuffer->page2howMany.I32 = 0; // needed ?
// reverse4Bytes( theBuffer->page2howMany.byteArr4);
// serialPrintlnHEX( theBuffer->A, 8*4);
SIGMA_WRITE_REGISTER_BLOCK ( DSP_I2C_ADDR, MOD_SAFELOADMODULE_DATA_SAFELOAD0_ADDR, sizeof(theBuffer->A), theBuffer->A);
}
and here are the special structs I needed...
union u_4bytes {
unsigned int UINT;
int32_t I32;
byte byteArr4[4]; // __attribute__((packed));
};
union u_adau1467safeloadBuffer {
byte A[32]; // __attribute__((packed));
struct { // all entries are 32bits
union u_4bytes slot[5];
union u_4bytes targetAddr;
union u_4bytes page1howMany; // 0..5, if 0, the value below must be 1..5
union u_4bytes page2howMany; // 0..5, if 0, the value before must be 1..5
};
}; // __attribute__ ((aligned (32)));
and here are my endianness change stuff :
void reverse4Bytes( byte byteArr4[]){
byte tmp = byteArr4[3];
byteArr4[3] = byteArr4[0];
byteArr4[0] = tmp;
tmp = byteArr4[2];
byteArr4[2] = byteArr4[1];
byteArr4[1] = tmp;
}
void builtinReverse4Bytes( union u_4bytes *byteArr4){
union u_4bytes result;
result.I32 = __builtin_bswap32(byteArr4->UINT);
byteArr4->UINT = result.UINT;
}
here is the ultimate isntruction to change the cell :
.. union u_adau1467safeloadBuffer adau1467safeloadBuffer; ... safeloadSwitchNx2( &adau1467safeloadBuffer, 0x44, 0); // set entry selector to position 0