I bought an EVAL-ADAU1761Z and I want to connect it with a raspberry.
I connected all wires to i2c and i2s and downloaded drivers.
I compiled a module with adau1761_i2c, adau1761.c, adau 17x1.c, adau_utils.c, sigma_dsp.c and sigmadsp_regmap with a Makefile. After that I created a device tree overlay and added the line dtoverlay=adau1761_codec in /boot/config.txt. Finally I copied adau1761.bin generate by utility in /lib/firmware.
In dmesg I can see:
[ 5.448853] adau1761_codec: loading out-of-tree module taints kernel.[ 5.483891] asoc-simple-card soc:sound: adau-hifi <-> 3f203000.i2s mapping ok
If I delete the bin file I get an error because firmware is not found.
aplay -r and arecord -l show me the sound card:
pi@MelRPI:~/ADAU1761/driver $ aplay -l**** List of PLAYBACK Hardware Devices ****card 0: adau1761 [adau1761], device 0: bcm2835-i2s-adau-hifi adau-hifi-0  Subdevices: 1/1 Subdevice #0: subdevice #0
pi@MelRPI:~/ADAU1761/driver $ arecord -l**** List of CAPTURE Hardware Devices ****card 1: adau1761 [adau1761], device 0: bcm2835-i2s-adau-hifi adau-hifi-0  Subdevices: 1/1 Subdevice #0: subdevice #0
but when I try to record
arecord -c 2 -t wav -f S16_LE -r 48000 test1.wav
I get only noise.
BCLK and LRCLK are present and ADC out too.
If I use USBi with Windows I can hear on the headphone the input elaborated from dsp.
I don't have much experience with device trees and drivers. Can someone help me?
Attached my whole project.
After a lot of test, these are the results:
- If I load manually (with a c program that write directly to i2c) all register and firmware (from the generate .h file or taken from sigmastudio windows) the IC run perfectly. After that I load driver with dtoverlay function and I can record and play correctly.
- If I load module on startup or after the boot the IC doesn't work. After that I unload module and read all registers but they have almost all value 0x00.
Have the driver a problem loading firmware?
Sorry for late response.
I'll try to reproduce your setup and check the firmware loading using the Linux driver and come back to you with a response.
Thanks for your reply.
Attached 2 picture of the connections between the 2 boards. During test GND was connected to GND of J6 to make possible the connection of USBi without power off the boards.
I attached the current project too. Inside there is a directory called load_fw with the software i used to load the firmware manually inside ADAU1761 before call dtoverlay to load driver.
After other test i discovered that i can record only with:
arecord -c 2 -t wav -f S32_LE -r 48000 test1.wav
I tested on a board having ADAU1761 and a FPGA so not exactly your setup because I don't have available an EVAL-ADAU1761Z.
Linux kernel version is: Linux analog 4.14.0-01492-g01faddbdba7a
adau1761 driver build as module and firmware loaded from /lib/firmware
Firmware loading seems to work and also recording on my test setup.
I looked at the attached files and first thing that I saw was that in ADAU1761_48_IC_1_REG.h in registers 0x40F2 and 0x40F3 is written 0x0. This is related to input/output routing. 0x00 means the audio set path is ADCs -> DSP -> DACs.
In linux by default the audio path is set to ADCs -> I2S(ADC_SDATA) and output is set to I2S(DAC_SDATA) -> DACs. So the DSP is kind of bypassed. In order to put the DSP in chain you have to set using alsamixer the following controls to DSP ( please see highlighted in picture).
Please set it to DSP and test again.
Also you can dump the i2c register data while the driver is loaded using:
Did you use the attached drivers?
I used the attached driver sources. I just put them in a Linux kernel repository and build them with "make modules" and then "make modules install"
Tested with both S16_LE -r 48000 and S132_LE -r 48000
If you set both "Capture" and "DAC Play" to DSP you can test the DSP firmware loading was performed right. If you connect audio source at input and headphones at output should hear input signal processed in DSP.
thanks for your reply.
I have no experience with compiling kernel modules. I need other information about the entire procedure.
Did you use the Makefile included to make the module?
After module install, how do you load it?
Did you use the device tree overlay attached?
Compiling kernel modules is just if you have a Linux source tree prepared. Is the alternative to your Makefile but using the kernel build system. You can find more information here: kernel_build
Your method should be ok and I don't see a problem with it.
After module install, modules are copied to the rootfs specified with "INSTALL_MOD_PATH=" in /lib/modules
At boot modules requested in device tree are loaded if are available in /lib/modules
I didn't used the device tree overlay you attached because I tested on a Zed board and not on RPI.