ADAU1701 and Arduino
Hello,
first of all I want to excuse me for stupid questions and bad expression, but i am rather a newbie in this dsp and microcontroller stuff.
So I am working right now with the ADAU1701 DSP ( Elektor ADAU1701 Universal Audio DSP Board (130232-71) Elektor ). I program the E2Prom of the DSP by using an Arduino Uno like shown in this video: Elektor - ADAU1701 Universal Audio DSP Board - YouTube
This is a rather easy configuration I tried:
#
I have a decoder which codes SPDIF to I2S and sends it to the GPIOs of the DSP. Everything works so far.
So my issue is now: I want to communicate "live" with the DSP with the help of my Arduino Uno. Here, for example, to mute the Channels by applying a switch at the GPIOs of the Arduino.
I have already read this: How do I create the microcontroller code to interface to my SigmaDSP?
And it helped a lot! But I dont get it, how to do this stuff with my arduino.
Is it possible at all to use the arduino environment to program the uC like this ? Which libraries would I need? The same as in the example ? Which code should I even upload to the arduino!? (see.. I am pretty new here..)
But my main question is: Where do i send the data to? - Those pins, I am using right now to program the E2prom? Because I think if I would do that, the data would maybe be saved in the eprom, but the DSP wouldnt execute it. At least not without a restart.
So maybe to one of the GPIOs ? But why and how should the DSP know to read the data from one of the GPIOs ? (if I dont use any in the schematic..)
Hope this was more or less comprehensible and you can help me. Thank you in advance!
-matse
Audio Signal Processors
dsp
uc
mcu
microcontroller
arduino
SigmaDSP Audio Processors
volume control
adau1701
Show More
Hello matse,
Welcome to the forum. It appears that so far you have your ADAU1701 successfully self-booting with a program that you have loaded into the Elektor board's E2PROM through your Arduino from SigmaStudio. This is a good first step! You've also discovered the two principal ways to give your Arduino some control over the -1701's operation:
Have the Arduino safeload-write changes in parameters (such as volume and EQ filter coefficients) to the ADAU1701 via its I2C interface. This allows virtually unlimited control of nearly anything in your DSP signal flow. It's unfortunately more difficult to get started with, but is easier in the long run -- especially if many parameters need to be controlled.
Build GPIO input blocks into your signal flow that control specific functions. Hardwire the -1701's appropriate input GPIO pin(s) to logic outputs(s) from your Arduino, which you can then program to operate those functions. This is relatively easy to perform, but is limited to just a few functions.
The first method is what's covered by many posts on this forum, including the tutorial you mentioned above. The Arduino controls the ADAU1701 by writing to its parameter memory and registers through the I2C bus. This bus as you noted also includes the self-boot E2PROM -- but since its hardwired address differs from that of the ADAU1701, the two devices are addressable separately. Unfortunately I'm not familiar with Arduino programming, but likely there's a I2C library with function calls for starting, writing, and stopping I2C communication to the -1701. If someone on the forum is familiar with Arduino they can help you with this aspect.
The second method requires little Arduino programming -- if you can program the Arduino to switch a LED on and off, you can use that logic signal to control something on the ADAU1701. You can easily set up one of the ADAU1701's unused GPIO inputs to accept and operate on the control signal. An example signal flow is shown below:
This signal flow mutes the audio if the GPIO input is high, allowing it through if low. All you need do is wire a logic output from Arduino to the GPIO input on the ADAU1701, and program the Arduino to control that logic output. I'm assuming that the Arduino has 3.3V logic signals -- if not, you'll need to adapt between it and the -1701. Once you get used to the various SigmaStudio blocks available, you'll find ways to control other functions.
Since the Elektor board has four pots, I assume all the 1701's control ADCs are wired to those pots. Also you're using the I2S digital audio input which needs some GPIO pins. I chose GPIO 6 above since it has neither of these functions. It's pin 15 on the ADAU1701 itself. Refer to the Elektor board's schematic and the ADAU1701 data sheet to work out which GPIO pins are available and how to get at them easily (hopefully the GPIOs are available on a header).
Best regards,
Bob
Dear matse,
Welcome!
I suggest you go Bob's first plan to go with the arduino writing changes to DSP's parameter RAM via I2C, since this will give u unlimited control in the long run.
as a detailed example u can try to store pre-calculated parameters exported from the capture window to the arduino and write them to the dsp:
code ADI_REG_TYPE MUTE_VALUE_ON[4] = {0x00, 0x80, 0x00, 0x00};
code ADI_REG_TYPE MUTE_VALUE_OFF[4] = {0x00, 0x00, 0x00, 0x00};
note: u can safeload-write it by padding additional zeros making the whole data 5 bytes, i.g. (0x00, 0x00, 0x80, 0x00, 0x00)
void SIGMA_WRITE_REGISTER_BLOCK(uchar devAddress, uint param_address, uint length, ADI_REG_TYPE *dVal)
{
// START I2C
// Send Device ID
// mask,shift by one byte, and send upper address byte
// mask and send lower address byte
// send data byte by byte
// Send ACK bit on I2C bus
// STOP I2C
}
void mute_dsp(){
SIGMA_WRITE_REGISTER_BLOCK(0x68, 0x0000, 4, MUTE_VALUE_OFF)
}
I've tried this using 8051 uC, but im pretty sure arduino has it s own I2C library counterpart.
Then, use an external Arduino GPIO pin (push button, IR remote) as interrupt, for example, and call the mute_dsp() function to mute the dsp and make similar function as to unmute it.
As stated earlier, u can have unlimited option to vary the dsp parameters on the fly, like filter coeffs, volume control, phase, parametric EQs, compressors, etc...by updating it's parameters via I2C!
Good Luck!
Best regards,
Dan
Hello Bob and Dan!
Thank you very much so far! That helped me a lot. I tried Bobs second method and it worked, so there I have a little success :-)
Now I am trying to send data with the help of the Arduino to the DSP, like Dan explained. I have still got some issues right now, but I will try on. If I wont be able to go on again, I hope I can count on your help again. Otherwise, if I will get it working, I will post me result, because maybe it could be also usefull for others.
-matse
So I started now, to try the following Code:
#include <Wire.h>
void setup()
{
pinMode(7, OUTPUT);
pinMode(12, OUTPUT); //WP
pinMode(13, OUTPUT); // RST
digitalWrite(12, HIGH);
digitalWrite(13, HIGH);
Wire.begin();
}
void loop()
{
Wire.beginTransmission(0x34); // MUTE
Wire.write(0x00);
Wire.write(0x00);
Wire.write(0x00);
Wire.write(0x00);
Wire.write(0x20);
Wire.write(0x00);
Wire.endTransmission();
digitalWrite(7, HIGH); // LED to check if code works
Wire.beginTransmission(0x34);
Wire.write(0x00);
Wire.write(0x01);
Wire.write(0x00);
Wire.write(0x00);
Wire.write(0x00);
Wire.write(0x00);
Wire.endTransmission();
delay(5000);
Wire.beginTransmission(0x34); // UNMUTE
Wire.write(0x00);
Wire.write(0x00);
Wire.write(0x00);
Wire.write(0x00);
Wire.write(0x20);
Wire.write(0x00);
Wire.endTransmission();
digitalWrite(7, LOW); // again LED to check
Wire.beginTransmission(0x34);
Wire.write(0x00);
Wire.write(0x01);
Wire.write(0x00);
Wire.write(0x08);
Wire.write(0x00);
Wire.write(0x00);
Wire.endTransmission();
delay(5000);
}
The idea for the Code I have from this thread: ADAU1701 I2C communication with mcu
Now I have the following issues:
when I load the code to the arduino, I can see bytes on the SDA pin BUT the level is too low (0 and 2.4V) and in the end it doesnt even matter becaaause:
programm stops at the first Wire.endTransmission(); (checked by those test LEDs)
the programm seems to work, if the wires for SDA and SCL are floating (I can see bytes on the scope all the time - not just right after the upload. the levels are correct (0 and ~4.8V) and the check-LEDs work)
when I programm the E2Prom, the High-Low-Levels of SDA are also 0 and ~4.8V, so this seems to be the right levels also to adress the DSP ?
Comments to the code:
I noticed WP and RST are always (when I program the E2Prom and after that) HIGH, so i set them high in the Code.
Probably it is not the right question for this community because of all this arduino stuff. But maybe you have an idea what I am doing wrong.. Thank you in advance !
-matse
Hello guys,
I am sorry because i am not very good in DSP and arduino technical term as mentioned above. But i would like to share what i have done.
simple schematic and capture window as below.
the sketch of arduino as below.
#include <Wire.h>
void setup()
{
Wire.begin();
}
unsigned int address = 0x0000;
uint8_t addr[] = {address>>8, address&0xff};//{takeHibyte=08,takelowbyte=1A}
// write address to data capture register
void loop()
{
//mute
Wire.beginTransmission(0x34);
Wire.write(addr, 2);
Wire.write(0x00);
Wire.write(0x00);
Wire.write(0x00);
Wire.write(0x00);
Wire.endTransmission();//
delay(3000);
//unmute
Wire.beginTransmission(0x34);
Wire.write(addr, 2);
Wire.write(0x00);
Wire.write(0x80);
Wire.write(0x00);
Wire.write(0x00);
Wire.endTransmission();//
delay(3000);
}
I've tested with my arduino ethernet and evaladau1701. and it works fine. when I play mp3 song, i will hear the music 3 second, and the music will mute for another 3 second. and it is repeating like forever. good luck!
Thanks and Best Regards,
Kal
For the direct i2c communication, lets try make the ground of both arduino and adau1701 board in common by connecting ground of arduino and ground of adau1701. (I am not sure if the eeprom connection already have the common ground).
If still failed, try put pull up resistor 4.7k ohm to 3.3V (from arduino) for each SDA and SCL wires. So, each wires will have their own resistor. And the resistor is connecting to 3.3Volt.
My explanation is all about my platform. Mine was evaladau1701 (operate at 3.3V) and arduino ethernet (operate at 5V). Arduino ethernet did have 3.3V output.
Good luck!!
Hello Kal, thank you for your help !
Unfortunately it still doesnt work. I would like to show you guys my pin config:
So what I am doing all the time is:
1. Programm a DSP-Project (.hex) File to the EEProm
- I am doing this with an .ino file you can see in the attachment
- You can program then the EEProm of the DSP via a Program called "Tera Term"
- Everything works fine so far. The DSP-Project is running
2. Now I load another .ino to the Arduino, e.g. Kal´s Code
- With the wire.h you have SDA=Pin 4 and SCL=Pin 5 at the arduino and I connected it also this way ("Direct Communication")
- according to the schematic of the DSP the two SDA and SCL Pins I am using (EEProm and Direct) are the same (although two different connectors K9 and K10)
3. After i loaded the code to the arduino, the DSP doesnt run the Project anymore
I checked the Levels of the pins and these are my results:
if I programmed either the file for the EEProm, or the file for the direct communication to the arduino (so in both cases!!) and I disconnected the connectors, the levels of the DSP were:
SDA: 2.3V
SCL: 2.3V
WP: 2.3V
RST: 1.5V
when the Arduino is programmed with the file for the EEProm (DSP worked properly) and I disconnected the connectors and checked the levels of the pins of the Arduino the results were:
SDA: HIGH
SCL: HIGH
WP: HIGH
RST: HIGH
(HIGH ~ 4.8V)
when the Arduino is programmed with the file for the direct communication and I disconnect the connectors and checked the levels of the two Arduino pins:
SDA: HIGH and I can see data every 3 seconds (with Kal´s Code)
SCL: HIGH and I can see that the clock comes, everytime when data comes
But when they are connected to the DSP nothing happens at all.
What am I doing wrong ??
Hello,
Looks like you have bus contention. Remove the direct communication wires and download the EEPROM programming sketch. Remove the EEPROM programming cable, reset board and check that DSP booted from EEPROM. Now attach direct connection wires, (SCL, SDA, and include a GND wire!) and download the direct communication sketch.
Hi Kal,
first of all thank you again!
According to the schematic the grounds are common already.
I wonder why the HIGH-Levels in the connection to the EEProm are ~5V, since my DSP is also working with 3.3V.. Maybe I damaged something !? But well, that still does work. So since I have levels up to 5V, I guess I cannot put pull up resistors to 3.3 V. I tried it with 5V, but still nothing.
Hi bitmechanic,
thank you for your answer.
I think I can make sure, that the DSP is booting from the EEProm, because there is no data being sent from the arduino to the DSP, while it works fine. But the point is: if I remove the EEProm programming cable, the DSP doesnt work anymore. And like I said, all the Pins coming from the ardunio are HIGH. So I wrote a sketch, that does the Pins just set HIGH, and connected then the connector and the curious thing is: It does not work. Compared to that: If the DSP works fine, I disconnect the cable and connect it again, it still works then. That doesnt make any sense to me...
matse I have a problem with the board . please help me if you have resovled your problem.
I used Tera Term software to send the "E2PROM.Hex" file to arduino whie it is connected with K9 pin of the dsp board as instructed, i change the com port to arduino and change the baud to 19200 but nothing happens like shown in this video
https://www.youtube.com/watch?v=Je5pi_-eLwg
The Tera term window is just blank. I tried this with jumper on and off JP1. When i send the .hex file from tera term to arduino, the receive led bleeps in arduino but not the send data led.
How did you program it by direct method.
The instruction i got in the elekator site is brief and i can't get the dsp board to work. I attached a led in the board and it lights up but nothing about eeprom.
Hi matse,
me and other guys have developed the library to interfacing ADAU1701 with Arduino and also a board
wich we use to develop our audio alghoritms.
If you think it can help with your application, then take a look at this post
Aida DSP project is born
Max
Thank you Very Much
Hi matse,
this might be a little late but I was working on the same combination as you (Arduino UNO and Elektor ADAU1701).
And I think I made it work.
step 1: program eprom with the elektor Arduino "i2c_eeprom2.ino" (I used the sigma delta example from kaeroul (Jul 8, 2014 1:01 AM) from this thread)
step 2: remove jumper and all connected I2C cables which where used for programming.
step 3: Reset ADAU1701 board (the board should boot now from eprom) and you should hear an audio signal
step 4: connect ground, SDA and SCL between Arduino and ADAU1701 (as in your picture)
step 5: and this made it work ;-) connect two pullup resistors (2.2k) to SDA and SCL to the 5V of the Arduino. (Without these resistors the I2C signal will just break down if you connect to the ADAU1701. The Elektor board itself already has 2.2k pullups installed (R5 for SDA and R3 for SCL))
step 6: run Arduino code example from kaeroul ((Jul 8, 2014 1:01 AM) from this thread) - now it should work.
Alex
Hi,
you can try also with examples here
AidaDSP/Software/Examples/Arduino/Basics at master · AidaDSP/AidaDSP · GitHub
it should works also with Elektor boards, apart from encoder input and switch that you can
comment. We started development on Elektor boards prior to make our own. I2C address is fixed
on Elektor boards and should be 0x6C.
If you want, give us your feedback
Hello Max,
The library which developed by you and your team for interfacing ADAU1701 with Arduino really great. Is it work with ADAU1442???
This question has been assumed as answered either offline via email or with a multi-part answer. This question has now been closed out. If you have an inquiry related to this topic please post a new question in the applicable product forum.
Thank you,
EZ Admin
Please log in to reply.









