Audio: MEMS Digital Microphone

From HiveTool
Revision as of 04:58, 11 February 2018 by Paul (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

To compile module:

http://raspberrypi.stackexchange.com/questions/39845/how-compile-a-loadable-kernel-module-without-recompiling-kernel


Edit asoc-i2s-loader.c

vi asoc-i2s-loader.c                                                                                                                 
make                                                                                                                                 
insmod asoc-i2s-loader.ko                                                                                                            
dmesg                                                                                                                                
arecord -D hw:0 -c2 -r 48000 -f S32_LE -t wav -v file.wav

Before insmod:

# lsmod
Module                  Size  Used by
bnep                   12051  2 
hci_uart               19956  1 
btbcm                   7916  1 hci_uart
bluetooth             365511  22 hci_uart,bnep,btbcm
8192cu                582217  0 
brcmfmac              222720  0 
brcmutil                9092  1 brcmfmac
cfg80211              543027  2 8192cu,brcmfmac
rfkill                 20851  5 bluetooth,cfg80211
snd_soc_bcm2835_i2s     6546  0 
snd_soc_core          179915  1 snd_soc_bcm2835_i2s
snd_compress           10384  1 snd_soc_core
snd_pcm_dmaengine       5894  1 snd_soc_core
snd_pcm                97226  2 snd_pcm_dmaengine,snd_soc_core
snd_timer              23904  1 snd_pcm
snd                    70032  4 snd_compress,snd_timer,snd_soc_core,snd_pcm
bcm2835_gpiomem         3940  0 
uio_pdrv_genirq         3923  0 
fixed                   3285  0 
uio                    10204  1 uio_pdrv_genirq
i2c_dev                 6913  0 
fuse                   99603  3 
ipv6                  406279  70 

After insmod:

Module                  Size  Used by
snd_soc_simple_card     6297  0 
snd_soc_simple_card_utils     5196  1 snd_soc_simple_card
asoc_i2s_loader         2761  0 
bnep                   12051  2 
hci_uart               19956  1 
btbcm                   7916  1 hci_uart
bluetooth             365511  22 hci_uart,bnep,btbcm
8192cu                582217  0 
brcmfmac              222720  0 
brcmutil                9092  1 brcmfmac
cfg80211              543027  2 8192cu,brcmfmac
rfkill                 20851  5 bluetooth,cfg80211
snd_soc_bcm2835_i2s     6546  2 
snd_soc_core          179915  3 snd_soc_simple_card_utils,snd_soc_bcm2835_i2s,snd_soc_simple_card
snd_compress           10384  1 snd_soc_core
snd_pcm_dmaengine       5894  1 snd_soc_core
snd_pcm                97226  2 snd_pcm_dmaengine,snd_soc_core
snd_timer              23904  1 snd_pcm
snd                    70032  4 snd_compress,snd_timer,snd_soc_core,snd_pcm
bcm2835_gpiomem         3940  0 
uio_pdrv_genirq         3923  0 
fixed                   3285  0 
uio                    10204  1 uio_pdrv_genirq
i2c_dev                 6913  0 
fuse                   99603  3 
ipv6                  406279  54 


static struct asoc_simple_card_info snd_rpi_simple_card_info = {                                                                                                                    
 .card = "snd_rpi_simple_card", // -> snd_soc_card.name                                                                                                                            
 .name = "simple-card_codec_link", // -> snd_soc_dai_link.name                                                                                                                     
 .codec = "snd-soc-dummy", // -> snd_soc_dai_link.codec_name                                                                                                                       
 // Available codecs can be found in /sys/kernel/debug/asoc/codecs                                                                                                                 
 // .platform = "20203000.i2s", // -> snd_soc_dai_link.platform_name                                                                                                               
 .platform = "3f203000.i2s", //                                                                                                                                                    
 // ASoC platform strings can be found in /sys/kernel/debug/asoc/platforms                                                                                                         
 // Note: use SND_SOC_DAIFMT_CBS_CFM instead of SND_SOC_DAIFMT_CBS_CFS                                                                                                             
 // if I²S device must be in slave state.                                                                                                                                         
 .daifmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS,                                                                                                     
 .cpu_dai = {                                                                                                                                                                      
 //  .name = "20203000.i2s", // -> snd_soc_dai_link.cpu_dai_name                                                                                                                   
   .name= "3f203000.i2s",                                                                                                                                                          
   .sysclk = 0                                                                                                                                                                     
 },                                                                                                                                                                                
 .codec_dai = {                                                                                                                                                                    
   .name = "snd-soc-dummy-dai",                                                                                                                                                    
   // Available dais can be found in /sys/kernel/debug/asoc/dais                                                                                                                   
   .sysclk = 0                                                                                                                                                                     
 },                                                                                                                                                                                
};



https://github.com/nejohnson2/rpi-i2s

https://learn.adafruit.com/adafruit-i2s-mems-microphone-breakout/raspberry-pi-wiring-and-test

https://raspberrypi.stackexchange.com/questions/70897/help-reading-audio-data-from-i2s-microphones