Jump to content

felipeduque

Members
  • Posts

    14
  • Joined

  • Last visited

Everything posted by felipeduque

  1. I was struggling to make SPH0645 I2S microphone to work with H3 mainline kernel (4.14.87), on NanoPi Neo Core. After weeks of distress, I finally made it work! Maybe some will find it useful. Here's what I did: 1- In file sound/soc/sunxi/sun4i-i2s.c, change the following line { SUN8I_I2S_RX_CHAN_SEL_REG, 0x00000000 } to { SUN8I_I2S_RX_CHAN_SEL_REG, 0x00001000 } You may have to download the linux-source package for your kernel version, or you can build your own kernel. It's weird that in legacy kernel, this register was assigned 0x00001000 by default (and the mic worked easily on that kernel). Not sure why it's changed. I'm not sure if this register can be accessed through an overlay. I tried my best but could not find a way to do it. Please, someone let me know if it's possible to do that, so we can avoid the driver compiling stuff. 2- Compile, generate and load the new sun4i-i2s.ko module. 3- Create a .dts file, sph0645-overlay.dts, with the following contents: It's almost the same as the one @Valery Rezvyakov devised in this thread. The only difference is the line with simple-audio-card,mclk-fs = <512>; which specifies MCLK's oversample rate regarding the sampling frequency (i.e., if sampling frequency = 48KHz, mclk = 512 * 48k = 24,576MHz). As far as I understand, this is the base clock which generates other clock signals (bit clock, frame sync). 4- Compile and add the .dts file. 5- Reboot and test with arecord -f S16_LE -c 2 -r 48000 -D hw:0,0 -v >test.wav Please let me know if it works for you. Maybe I have forgotten something.
  2. Hi, @cibernuts. I was struggling to make the same mic (SPH0645 I2S) to work with H3 mainline kernel (4.14.87), on NanoPi Neo Core. After weeks of distress, I finally made it work! Here's what I did: 1- In file sound/soc/sunxi/sun4i-i2s.c, change the following line { SUN8I_I2S_RX_CHAN_SEL_REG, 0x00000000 } to { SUN8I_I2S_RX_CHAN_SEL_REG, 0x00001000 } You may have to download the linux-source package for your kernel version, or you can build your own kernel. I'm not sure if this register can be accessed through an overlay. I tried my best but could not find a way to do it. Please, someone let me know if it's possible to do that, so we can avoid the driver compiling stuff. 2- Compile, generate and load the new sun4i-i2s.ko module. 3- Create a .dts file, sph0645-overlay.dts with the following contents: It's almost the same as the one @Valery Rezvyakov showed earlier in this same thread. The only difference is the line with simple-audio-card,mclk-fs = <512>; 4- Compile and add the .dts file. 5- Reboot and test with arecord -f S16_LE -c 2 -r 48000 -D hw:0,0 -v >test.wav Please let me know if it works for you. Maybe I have forgotten something.
  3. @dony71 The "make linux-menuconfig" stuff is just saying that you need to compile the kernel with the "Allwinner A10 I2S Support" option enabled. You can do it by several means, one of which is the "make linux-menuconfig", but I don't remember how to do it. However, you can compile the kernel using Vagrant. That's how I've always done.
  4. Apparently the fix by @JohnF doesn't work on mainline (it did work for me on legacy). This fix worked for me on mainline.
  5. It works here. Thanks. Apparently things were different on legacy. I had to do this workaround, but it didn't work on mainline.
  6. I2S left-justify requires audio_format = 3. As far as I'm concerned, there is no audio_format = 0. But I think you may run into hardware issues with I2S on OPi zero. See this post.
  7. I've been delving into I2S driver on H3 (legacy kernel) because I need TDM (time-division multiplexing) mics to work. So I came across what all those fex parameters really mean. Almost all of them can be found in sunxi-daudio0.c, some can be found in sunxi-snddaudio0.c, and you need to match those parameters to H3 datasheet. I'll spit out some of my findings. Please feel free to ask questions about any of the parameters. - daudio_master: it goes from 1 to 4. It selects slave/master combinations of bit clock and frame sync. = 1: bit clock and frame sync are input to H3 (i.e., codec is master, H3 is slave); = 2: bit clock is output from H3, frame sync is input to H3; = 3: bit clock is input to H3, frame sync is output from H3; = 4: bit clock and frame sync are output from H3 (i.e., codec is slave, H3 is master). - daudio_select: it can be 0 or 1. It selects whether we will be working with I2S or PCM mode. = 0: PCM mode. Basically, frame sync is just a short pulse, and all channels are sent/captured one after the other. When the last one is sent/captured, frame sync is pulsed again. = 1: I2S mode. Channels 0, 2, 4... are sent/captured during frame sync high; channels 1, 3, 5... are sent/captured during frame sync low. - audio_format: it goes from 1 to 5. It selects different configurations of I2S or PCM mode. See pages 529 and 530 of H3 datasheet. = 1: regular I2S mode. Only makes sense when daudio_select = 1 (I2S). = 2: I2S right justified mode. Only makes sense when daudio_select = 1. = 3: I2S left justified mode. Only makes sense when daudio_select = 1. = 4: DSP_A mode. Only makes sense when daudio_select = 0 (PCM). = 5: DSP_B mode. Only makes sense when daudio_select = 0. - signal_inversion: it goes from 1 to 4. It selects different combinations of bit clock and frame sync polarity.
  8. @burak That's good to know. However, I'm struggling to make the proper changes to sun4i-i2s.c and device tree stuff. Would you be willing to share the files you had to change?
  9. Hi, @projetoarduino, thank you very much for your straightforward fix. You mention in your readme that your modified device tree also enables audio. What kind of audio? I tried to record audio with my I2S microphone but arecord doesn't show any audio interface...
  10. Hi, all. I have the same question ("Can you install Armbian to NanoPi Neo Core eMMC?") but on legacy kernel. I was able to install Armbian to NanoPi Neo Core eMMC on mainline, following this topic, but cannot find anyone who made it work on legacy. (I really want to use legacy because I need I2S microphones, and was not able to make them work on mainline.) (Another option was to use NanoPi Neo Air legacy image, which supports eMMC out of the box, but I also need Ethernet, which isn't supported by Neo Air!)
  11. Hi all. I'm still struggling to capture I2S audio on my OrangePi PC (H3), mainline kernel. I've followed all steps by @Valery Rezvyakov and was able to see the I2S input device with arecord -l, just like @Christos. However, audio is not captured properly: there is an annoying DC offset at about 99% of maximum output value, thus only downwards signal excursion is possible (in fact, they are captured, as I can see them with Audacity). I'm using Adafruit SPH0645 I2S microphone as the capture device, and it's not a hardware problem because it works perfectly with legacy kernel. Audio format in both cases (legacy and mainline) is S16_LE. My suspicion is that the adau7002 driver is not suitable for my mic, but I was not able to find out where to meddle with.
  12. That's exactly the same problem I'm facing right now with legacy 3.4.113 on Nano Pi NEO Air (H3 chip). Audio recorded with e.g. S32_LE format is garbage, whereas S16_LE is perfect. Has anybody figured out how to handle this? I tried meddling with pcm0 parameters to no avail.
  13. Version 5.38 now, but there is no spi0 in armbian-config. There are i2c0, usbhost0 etc, but no spi0... And now eth0 won't even show up, but the module is correctly loaded (same "chip not found error" though). My bad when writing the post. It was correct in my file.
  14. Hi all. I've been struggling for several days to establish an internet connection via enc28j60 (Ethernet to SPI device) on my Nano Pi NEO Air, running Armbian 5.27, kernel 4.11.3. I have this custom DTS file added to my armbianEnv.txt, with two small modifications regarding the interrupt pin (apparently, PA7 is not available on Nano Pi NEO Air). I have pins = "A17"; ... interrupts = <0 17 2>; instead of pins = "PA7"; ... interrupts = <0 7 2>; The DT stuff is correctly loaded during boot, and an eth0 interface shows up (initially with random MAC address upon every reboot, but it's fixed now). However, only the orange light on the enc28j60 blinks - the green one just sits still (powered on). And there is no internet connection, despite the fact that "nmcli d" tells otherwise. The only occurrences of "spi" on dmesg are the following: [ 4.369613] enc28j60 spi0.0: enc28j60 Ethernet driver 1.02 loaded [ 4.373744] enc28j60 spi0.0: enc28j60 chip not found [ 4.373829] enc28j60: probe of spi0.0 failed with error -5 This readme file suggests that enc28j60 overlay "may require activating the SPI bus device is connected to by a kernel provided overlays (i.e. overlays=spi0)", however I could not find spi0 overlay for H3 devices. Other than that, I'm confident the hardware connections are correct. Am I missing anything obvious? Or maybe my Armbian version is outdated? How can I connect my Nano Pi NEO Air to the internet via ethernet?
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines