I am developing an acquisition system with as many digital microphones (MEMS) as Bela can hold.
The idea is to connect 64 of these MEMS (ICS-52000 TDK) to a 4-data-line-input Bela Cape. Since this is going to be used just for signal acquisition, I'm considering a master microcontroller to connect 8 Bela capes to my pc.
Can anyone give me some suggestions about the master microcontroller and any extra consideration before I get these components?
Audio Acquisition with MEMS microphones
After reading relevant sections of the datasheet, I concur with you that you can connect at most 16 of these microphones to each McASP data line. Each McASP on BeagleBone Back and PocketBeagle has at most 4 data lines, so you can connect up to 64 microphones to each McASP. There are at least a few pins from other McASPs on both boards, so if you needed more than that, it is possible that you'd be able to connect them (well, with adequate software support). Note that having a Bela or BelaMini on any of these is possibly going to be a disadvantage more than an advantage, as the Bela codec's ADC data line will occupy one of the McASP data lines.
What I don't understand is why you'd need 8 Bela capes and how these relate to the MEMS setups. By the way, I highly doubt that the 64-channel MEMS is supported by the Bela software stack as it is.
Thanks a lot for your support @giuliomoro
I'm trying to build a massive acoustic camera with 512 microphones. If modules of 64 MEMS are possible, I'd need 8 BBB or PocketBeagle. I'd like to avoid using BeagleBone Black or PocketBeagle for the odd Fs (37.5kHz or 46.875kHz), as you already explained to me by mail. Even though Beagle documentation is easier to find. I'm not very clear with the pin connection with data lines in the BBB. I've found in some projects that it's common to use the GPIO_112, 115, 117, etc. to connect a digital microphone signal, so in theory, is it possible to convert any GPIO into a McASP? Also, I've seen assigning the clock either to the SPI SCK or a GPIO, how convenient is that?
Most pins on the BeagleBone headers can assume one of several functions. Available functions are listed in https://github.com/BelaPlatform/Bela/wiki/BeagleboneBlackBelaP8HeaderTable.pdf and https://github.com/BelaPlatform/Bela/wiki/BeagleboneBlackBelaP9HeaderTable.pdf .
If the same function is available on more than one pin, only one can be used with that function at any given time. Of these, only those labelled _axr
can work as data lines for the McASP and there are at most 4 data lines for each of mcasp0
and mcasp1
. Additionally, you need at least one of _fsx
or _fsr
and one of _aclkx
or _aclkr
from each mcasp peripheral that you want to use and at least one of _achlkx
or _ahclkr
from one mcasp peripheral, unless you have an external clock generator (e.g.: a crystal oscillator). In total I see only two data lines for mcasp1
, so assuming you can use two mcasp peripherals at once (which requires non-trivial amounts of firmware development), the maximum channel count per board would be 80 channels.
BeamBang I've found in some projects that it's common to use the GPIO_112, 115, 117, etc. to connect a digital microphone signal, so in theory, is it possible to convert any GPIO into a McASP? Also, I've seen assigning the clock either to the SPI SCK or a GPIO, how convenient is that?
You'll see in those documents I linked that the "Name" column only represents one of the several possible functions of the pin. Pins that can assume the function of GPIO numbers 112, 115, 117 (see the GPIO NO column) can also work as mcasp0_axr0
, mcasp0_fsr/mcasp0_axr
, mcasp0_axr3/mcasp0_ahclkx
respectively, and SPI1_SCLK can be mcasp0_aclkx
. So these are not just "any" pins, but pins which, despite the fact that the unfortunate name choice may be confusing, have some very specific mcasp capabilities. In other words, you cannot use a generic pin for a generic function.
Regarding the overall project, a few things you should be thinking about:
- assuming you can get 64 (or even 80) channels into the BeagleBone, what are you planning to do with those? Are they being processed on-board? Where would the processed output go, considering you may have already used all available data lines from the McASP? Are they recorded on-board? Are they sent out some other way (e.g.: network)? Is there enough CPU time left to do any of that?
- Do you need the 8 BeagleBones to be synchronised with sub-ms accuracy? How are you planning to do that, if they each run off their internal clocks?
- What's the cable length between each microphone and the BeagleBone? To achieve 16 channels with 32-bit word-length on each data line, the bit clock frequency will have to be at Fs * 512, e.g.: 22.579MHz for a 44.1kHz sampling rate. It's not trivial to transmit such a signal at any distance without a lot of care and you may well need a transceiver of sort in the middle. If the microphones for a single data line are themselves spaced out, you may even need three transceiver per each microphone (as each microphone needs two clocks and has a data output), making things pretty complex. Maybe a better option would be to transmit (balanced?) analog signals to the BeagleBones, where some ADCs would take care of the conversion without having to worry about transmitting a lot of high-speed digital signals around the room.
giuliomoro
I appreciate your very clear explanation!
I'm planning to use these microphone arrays only as an acquisition system. Data would be post-processed offline from demultiplexing tasks in after. Every module (64 mics or more) is going to be part of a 1m diameter general array (512 mics), so distances between microphones to every slave board shouldn't be longer than 30cm. Synchronization should be accurate enough to get signals at 44.1kHz and 16 bit depth. About the master microcontroller, it's still not defined because it would depend on the process to make, for instance how convenient demultiplex, decimate and/or filtering the signal before sending to the PC can be. In this way, I believe making a network for this data traffic would be the most convenient option. This massive low-cost acoustic camera will be tested to characterize noise sources. Measurements will be carried out in the laboratory.
If it were the case: how many analog signals can BBB read at the same time?
giuliomoro (which requires non-trivial amounts of firmware development),
Hello Giulio,
I'm back again with the prototype development. There are a couple of things I'd like to bring to this thread with the intention to redirect or collecting some ideas. As you said, setting the McASP in capture mode takes more effort than one could expect. I decided to go with the Beaglebone black since it has some advantages due to the components that are soldered on the board. For instance, there's an external oscillator Y4 with my desired sampling rate (24.576 MHz), and this can be redirected to feed the ahclkr.
Current state
I'm still struggling with the McASP connection. Since BBB is an embedded linux system, recording signals compels you to configure several modules, device tree files, subsystems, and units. I leave a ti application report, written in 2017, which breaks down the steps to compile a kernel version with these modifications. This other link might be useful if one needs to use a different kernel version. The error that I'm encountering is this:
pcm_read:2152: read error: Input/output error.
I wanted to show also a brief summary of the result of my configuration that still doesn't work.
-------------------------------------------------------------------------------------------------
McASP Report
-------------------------------------------------------------------------------------------------
** pinmux **
''''''''''''
pin 51 (PIN51): 48038000.mcasp (GPIO UNCLAIMED) function mcasp0_pins group mcasp0_pins
pin 52 (PIN52): 48038000.mcasp (GPIO UNCLAIMED) function mcasp0_pins group mcasp0_pins
pin 53 (PIN53): 48038000.mcasp (GPIO UNCLAIMED) function mcasp0_pins group mcasp0_pins
pin 102 (PIN102): 48038000.mcasp (GPIO UNCLAIMED) function mcasp0_pins group mcasp0_pins
P8.34 / hdmi / sysboot 11 51 fast rx 3 asp 0 rx hclk mcasp@48038000 (mcasp0_pins)
P8.35 / hdmi / sysboot 12 52 fast 3 asp 0 rx clk mcasp@48038000 (mcasp0_pins)
P8.33 / hdmi / sysboot 13 53 fast 3 asp 0 rx fs mcasp@48038000 (mcasp0_pins)
P9.30 102 fast rx down 0 asp 0 data 0 mcasp@48038000 (mcasp0_pins)
type: MUX_GROUP controller pinctrl-single group: mcasp0_pins (10) function: mcasp0_pins (10)
-------------------------------------------------------------------------------------------------
** clock summary **
'''''''''''''''''''
clk_mcasp_fixed 0 0 0 24576000 0 0 50000
clk_mcasp 0 0 0 24576000 0 0 50000
mcasp1_fck 0 1 0 24000000 0 0 50000
mcasp0_fck 0 1 0 24000000 0 0 50000
-------------------------------------------------------------------------------------------------
** interrupts **
''''''''''''''''
26: 0 INTC 80 Level 48038000.mcasp_tx
27: 0 INTC 81 Level 48038000.mcasp_rx
28: 0 INTC 84 Level 48038000.mcasp_common
-------------------------------------------------------------------------------------------------
** soundcards **
''''''''''''''''
0 [PCM5102a ]: PCM5102a - PCM5102a
PCM5102a
00-00: davinci-mcasp.0-pcm5102a-hifi pcm5102a-hifi-0 : davinci-mcasp.0-pcm5102a-hifi pcm5102a-hifi-0 : playback 1 : capture 1
-------------------------------------------------------------------------------------------------
** capture soundcard **
'''''''''''''''''''''''
**** List of CAPTURE Hardware Devices ****
card 0: PCM5102a [PCM5102a], device 0: davinci-mcasp.0-pcm5102a-hifi pcm5102a-hifi-0 [davinci-mcasp.0-pcm5102a-hifi pcm5102a-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
null
Discard all samples (playback) or generate zero samples (capture)
hw:CARD=PCM5102a,DEV=0
PCM5102a, davinci-mcasp.0-pcm5102a-hifi pcm5102a-hifi-0
Direct hardware device without any conversions
plughw:CARD=PCM5102a,DEV=0
PCM5102a, davinci-mcasp.0-pcm5102a-hifi pcm5102a-hifi-0
Hardware device with all software conversions
default:CARD=PCM5102a
PCM5102a, davinci-mcasp.0-pcm5102a-hifi pcm5102a-hifi-0
Default Audio Device
sysdefault:CARD=PCM5102a
PCM5102a, davinci-mcasp.0-pcm5102a-hifi pcm5102a-hifi-0
Default Audio Device
dsnoop:CARD=PCM5102a,DEV=0
PCM5102a, davinci-mcasp.0-pcm5102a-hifi pcm5102a-hifi-0
Direct sample snooping device
-------------------------------------------------------------------------------------------------
** errors **
''''''''''''
[ 4.822111] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6, bus freq 1000000
[ 5.398165] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6, bus freq 1000000
[ 5.454690] davinci_mdio 4a101000.mdio: phy[0]: device 4a101000.mdio:00, driver SMSC LAN8710/LAN8720
-------------------------------------------------------------------------------------------------
** audio kernel modules **
''''''''''''''''''''''''''
snd_soc_simple_card 24576 0
snd_soc_simple_card_utils 24576 1 snd_soc_simple_card
snd_soc_pcm5102a 16384 1
snd_soc_davinci_mcasp 32768 2
snd_soc_ti_udma 16384 1 snd_soc_davinci_mcasp
snd_soc_ti_edma 16384 1 snd_soc_davinci_mcasp
snd_soc_ti_sdma 16384 1 snd_soc_davinci_mcasp
snd_soc_core 180224 7 snd_soc_davinci_mcasp,snd_soc_simple_card_utils,snd_soc_ti_sdma,snd_soc_ti_edma,snd_soc_pcm5102a,snd_soc_ti_udma,snd_soc_simple_card
snd_pcm_dmaengine 16384 1 snd_soc_core
snd_pcm 98304 3 snd_soc_davinci_mcasp,snd_pcm_dmaengine,snd_soc_core
snd_timer 36864 1 snd_pcm
snd 65536 3 snd_timer,snd_soc_core,snd_pcm
soundcore 16384 1 snd
-------------------------------------------------------------------------------------------------
I really appreciate any idea or kind of help to solve these issues.