ctag-fh-kiel / ctag-face-2-4

AD1938-based audio codec PCB
49 stars 14 forks source link

Capture channels in amixer #3

Closed thmsmlt closed 6 years ago

thmsmlt commented 7 years ago

I've made great progress :)

My custom hardware gets recognised, but the amixer command yields some surprising settings.

How are the capture channels configured? I'm getting two ADC's as expected, but they seem to be configured as playback channels and the four DAC channels seem to be configured as both playback and capture channels.

Is this normal?

Also, all inputs and outputs seem to be permanently off, I've tried changing this with numid cset ... but my commands seem to be ignored... What is the regular way to make these work? Might be a fault in my hardware too ;)

henrix commented 7 years ago

Yes, that's a bit strange of alsamixer, but you can ignore it. You can unmute the single ADCs and DACs with amixer (e.g. amixer -c 0 sset DAC1 on).

thmsmlt commented 7 years ago

So should I ignore the playback/capture labels or the ADC1 and ADC2 labels and record using the DAC capture thingies?

thmsmlt commented 7 years ago

Also do you recognise this error:

arecord: pcm_read:2031: read error: Input/output error when trying to record...

henrix commented 7 years ago

Ignore the playback/capture labels. The names are correct (e.g. ADC1 corresponds to the first hardware ADC). Maybe you have some SPI issues. You can check the kernel logs (my driver logs the register contents of the codec) for verification.

thmsmlt commented 7 years ago

I am indeed having SPI connection issues, I hooked the board up to an oscilloscope and the SPI lines are all high (except the Cout one, which is 0), but no commands are executed, no matter which command I run, the lines stay high. Are there additional steps to be taken to activate the SPI-connection? Something with pin modes? I'm pretty new to Linux and Beaglebone... I'll take a look at those kernel logs.

henrix commented 7 years ago

No, the pin modes are configured with the device tree overlay. Do you use the hardware SPI interface or software spi (spi-gpio)? If you playback or capture something, there should be something happening on the SPI interface (e.g. speaker-test).

thmsmlt commented 7 years ago

My SPI wires are connected to pins 17, 18, 21 and 22, so I guess I'm using hardware SPI. (Right?) I'm trying to write to the SPI port now using Adafruit_BBIO, just to see if I can connect to the codec.

thmsmlt commented 7 years ago

The kernel log did reveal some errors...

screen shot 2017-05-30 at 13 05 26
henrix commented 7 years ago

Have a look in the pin connections table. You are using the hardware SPI interface, so you have to use the BB-CTAG-FACE-8CH overlay.

thmsmlt commented 7 years ago

Right! And I'm trying to load the SW-overlay. Well that wouldn't work indeed.

Well, I just tried changing that, but when running

sudo sh -c "echo 'BB-CTAG-FACE-8CH' > /sys/devices/platform/bone_capemgr/slots"

This error comes up:

sh: echo: I/O error

Or am I doing that wrong? When I rebooted, the BB still tried to load the SW-overlay.

Or should I just change the pin configuration I'm using to the other one? In that case, what is the difference between spi4 and spi5?

thmsmlt commented 7 years ago

Oh, I fixed the error, I had to remove the SW-overlay first in capemgr:

sudo sh -c "echo '-4' > /sys/devices/platform/bone_capemgr/slots"

Unfortunately, the Beaglebone still stried to load the SW-overlay, the slots directory is the same when rebooting even when having deleted entry -4 as indicated above...

henrix commented 7 years ago

I think there is any issue in the Cape manager. If you are using my image, you should disable the automatic loading of the SW SPI overlay and load the BB-CTAG-FACE-8CH instead.

thmsmlt commented 7 years ago

I've tried to do so, but my changes seem to be reversed immediately... Is my code in the previous messages correct?

henrix commented 7 years ago

You remove overlays from the Cape manager with your code above. Have a look in /etc/rc.local and change BB-CTAG-SW-8CH to BB-CTAG-FACE-8CH.

thmsmlt commented 7 years ago

Well, I did those things now, the good news is: when running cat /sys/devices/platform/bone_capemgr/slots, BB-CTAG-SW-8CH is no longer loaded at boot.

The bad news is: BB-CTAG-FACE-8CH doesn't load in int's place and in the kernel logs, the errors remain the same

henrix commented 7 years ago

Ok, can you please show your kernel logs regarding the sound drivers?

thmsmlt commented 7 years ago

It works!

It was a hardware thing. I was searching around in the lab and found that the PCB track connected to the PD/RST pin was broken. I fixed it and now the interface works :)

Many thanks for the help!

But before closing the subject entirely, I'm recording, I turned on the ADC's but the recorded file is still empty, it must be something small, I measured my codec's inputs and I'm putting a 440 Hz wave on there...

Also when recording with 4 channels, hundreds of files are created, all silent, but 5 seconds long..

thmsmlt commented 7 years ago

This is the kern.log file for my last bootup

log.txt

henrix commented 7 years ago

The issue with the several files is regarded to alsalib. Have a look here to avoid this.