I have a stock Pi 3B with all Raspbian updates. From various sources I've tried to cobble together alsa recording from an inexpensive PCM1808 device at 8K 24 bit stereo. To do this, I've used the pigpiod daemon to provide the SCK for the chip at 2048000 Hz (pigs hc 4 2048000
). The 3 outputs from the chip in master mode BCK, LRC and DOUT are connected to BCM 18, 19, and 20 respectively. All clocks look good and at the correct frequency. I noticed that the clock waveforms were low until I forced BCM 18 & 19 to inputs from their state of ALT0. I enabled dtparam-is2-on
in /boot/config.txt.
I used the instructions from adafruit to create the device in Linux. It worked, inasmuch as the device was created and reported by arecord -l
. I can't say I know exactly what it is doing but everything I did understand looks OK to me.
I used arecord -c2 -f s32_le -r8000 -d10 -M test.wav
to try to capture some data. It executed in well under a second. Nothing was connected to the audio inputs so I expected noise at minus 60-70dB or so. The file size, as expected, 640044 bytes, which is consistent with 10 seconds of stereo 32 bit floats at 8kHz. The problem is, of course, that it should take 10 seconds to capture this many samples. Using the time
command I measured the actual capture rate at 1153x nominal. For instance, specifying 1000 seconds using -d1000 executes in around .93 - .94 seconds. Unsurprisingly it sometimes produces overruns. Changing the clock speed to 8192000 actually increases the run time to just over 1 second.
I tried using the -t 0 flag in pigpiod as I'd read in this forum that it might otherwise interfere with i2s without any change in behaviour. It seems to me that the breakout board is innocent in that if it provides a reasonable clock signal arecord should capture in real time.
Random suggestions welcome! I do want to stick with this cheap interface, however, as I'd like to build at least 20 in this configuration.
Chris