hachyderm.io is one of the many independent Mastodon servers you can use to participate in the fediverse.
Hachyderm is a safe space, LGBTQIA+ and BLM, primarily comprised of tech industry professionals world wide. Note that many non-user account types have restrictions - please see our About page.

Administered by:

Server stats:

8.9K
active users

#i2s

0 posts0 participants0 posts today

Цифровой звук на STM32: подключаем аналоговый микрофон через SAI и NAU88C22

ИИ обложка, потому что модно. Иногда простой проект превращается в увлекательное исследование. Разбираясь с записью звука на STM32L432 через аудиокодек NAU88C22, я не только подключил микрофон и настроил кодек, но и столкнулся с рядом интересных задач. Разбираясь с ними, я узнал много нового о SAI, работе с SD-картой и нюансах цифрового звука — и теперь хочу поделиться этим опытом. Железка, на которой идет разработка, — это не просто плата для экспериментов, а прототип, сделанный как образец для одного проекта. Так что любопытство, конечно, присутствовало, но двигало процесс скорее желание довести до ума конкретное (будущее) устройство.

habr.com/ru/companies/selectel

ХабрЦифровой звук на STM32: подключаем аналоговый микрофон через SAI и NAU88C22ИИ обложка, потому что модно. Иногда простой проект превращается в увлекательное исследование. Разбираясь с записью звука на STM32L432 через аудиокодек NAU88C22, я не только подключил микрофон и...

I am researching my next #electronics #DIY project by doing some test coding to figure out whether the #esp32 WROVER-E will work well in a bluetooth handsfree device with call recording capabilities.

Also Planning to add external circuitry for high quality sound processing with auto-leveling and noise filtering as well. So, I'm on the lookout for a powerful #i2s compatible audio codec to embed alongside the ESP32 module. Right now I'm considering MAX98090.

Advices, suggestions or warnings are welcome!

Os insensatos de #Bricolabs organizan unha pequena charla o próximo día 7 de setembro sobre a programación dos #STM32 para recibir e transmitir son mediante dispositivos #I2S (e facerlle cousiñas polo medio, claro), e non atoparon a nadie mais que a este que escribe para impartila. A calidade irá en consoancia co prezo, iso si.

jmmarino2.gitlab.io/slides/int

jmmarino2.gitlab.io · Introdución ao procesado de son con microcontroladores STM32 e dispositivos I2SAprende a programar os STM32 co STM32CubeIDE, e a recibir, enviar e modificar son mediante dispositivos I2S.

Inspired by the news that HiFiBerry are releasing an 8-channel DAC board for the Raspberry Pi 5, but slightly disappointed they’ve sold out of their beta-test programme, coupled with the news that Rene has added 4-channel I2S support for circle, and seeing that the HiFiBerry dac8x is essentially four PCM5102A modules and a high quality audio path, I set out attempting to create a similar (albeit low quality) equivalent with four GY-PCM5102 modules.

Warning! I strongly recommend using old or second hand equipment for your experiments.  I am not responsible for any damage to expensive instruments!

If you are new to single board computers, see the Getting Started pages.

Parts list

  • Raspberry Pi 5.
  • uSD card, HDMI, mouse, keyboard, etc to boot Raspberry Pi OS.
  • 4x GY-PCM5102A modules.
  • Breadboard and jumper wires.

The Circuit

The Raspberry Pi GPIO Pins are connected as follows:

Raspberry Pi 5GY-PCM5102A Modules5VVCC – Modules 1-4GNDGND and SCK – Modules 1-4GPIO 18BCK – Modules 1-4GPIO 19LCK – Modules 1-4GPIO 21DIN – Module 1GPIO 23DIN – Module 2GPIO 25DIN – Module 3GPIO 27DIN – Module 4

I eventually ended up using a small solderless breadboard to allow me to daisy-chain the power and common signals for the GY-PCM5102 modules.

Important: Recall that for these PCM5102 modules, there are solder jumpers that have to be setup on the back. More details here.

Raspberry Pi OS

Before connecting any of the GY-PCM5102A modules, I downloaded the latest 64-bit Raspberry Pi OS image and booted it up “as is” on my Pi 5 to make sure everything was working.

Then I installed any pending updates and rebooting to ensure everything was once again up and running.

It might be worth checking sound is working by firing up an Internet browser and watching a video or something. By default the sound will go over HDMI, so naturally you need a sound-capable HDMI device to support that.

At this point I shut it down again and connected up the four PCM5102 modules as per the diagram above then booted everything up again. The OS should boot correctly although at this point it will have no knowledge of the added boards.

Quad DAC Configuration

The basic principle is to use a device-tree overlay file to enable I2S audio and the four PCM5102 devices.

But the nice people at HiFiBerry have already done this with support from Raspberry Pi for their dac8x module, so actually all that is required is to edit the file /boot/firmware/config.txt and add the following line:

/boot/firmware/config.txt:

dtoverlay=hifiberry-dac8x

There is talk on the Internet about commenting out the audio=on parameter or enabling i2s=on, but I didn’t have to do either of these.

Then on reboot, there should be a new audio device “snd_rpi_hifiberry_dac8x” which can be selected.

At this point playing a video should output on the first PCM5102 device.

To test all 8 channels requires an application that can output audio on 8 channels. But for a simple test the “speaker-test” command can be used from the terminal:

kevin@pi5:~ $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: vc4hdmi0 [vc4-hdmi-0], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: vc4hdmi1 [vc4-hdmi-1], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: sndrpihifiberry [snd_rpi_hifiberry_dac8x], device 0: HifiBerry DAC8x HiFi pcm5102a-hifi-0 [HifiBerry DAC8x HiFi pcm5102a-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0

kevin@pi5:~ $ speaker-test -t sine -f 440 -c 8 -D hw:2

speaker-test 1.2.8

Playback device is hw:2
Stream parameters are 48000Hz, S16_LE, 8 channels
Sine wave rate is 440.0000Hz
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 16 to 32768
Period size range from 8 to 256
Using max buffer size 32768
Periods = 4
was set period_size = 256
was set buffer_size = 32768
0 - Front Left
4 - Center
1 - Front Right
7 - Side Right
3 - Rear Right
2 - Rear Left
6 - Side Left
5 - LFE
Time per period = 23.295314
0 - Front Left
^C 4 - Center
1 - Front Right
7 - Side Right
3 - Rear Right
2 - Rear Left
6 - Side Left
5 - LFE
Time per period = 0.406018
kevin@pi5:~ $

The “aplay -l” command can be used to list all devices that ALSA knows about. In my case the pseudo hifiberry dac8x device is listed as “card 2”. This means I then need to use the device identifier “hw:2” for the speaker-test command.

The other parameters to speaker-test are as follows:

  • -t sine – output a sine wave rather than the default noise output.
  • -f 440 – set the sine wave frequency to 440Hz
  • -c 8 – use 8-channel sound output.
  • -D hw:2 – use the device “hw:2”

If all goes well, then playback on 0,1 (front left/front right) goes to PCM5102 module 1; 2,3 (rear left, rear right) goes to PCM5102 module 2; and so on.

Closing Thoughts

Now that I know the basic principles seem to work, I want to see what it would take to create a 8-channel audio output MiniDexed.

Kevin

https://diyelectromusic.wordpress.com/2024/05/27/rpi-5-quad-stereo-sound-with-pcm5102a/

#0 #i2s #pcm5102 #raspberryPi #raspberryPi5

Do YOU have experience designing #usb3 or #usbC circuits? How about implementing I²S audio?

I'd love to chat, and/or work together on an #openSource, budget-friendly, and VERY high quality (24bit/192K) 8 channel #usbAudioInterface.

I'm basing the front-end on the incredible differential instrumentation amplifier #INA217 by #burrBrown. We're talkin' #midas competition #preamps into a BB #adc 😎.

I could really use help with the usb implementation.

This morning's wizarding is a new case for my #esphome speakers. Specifically, I love printables.com/model/363300-es but it doesn't fit the ESP32 boards I settled on ( amzn.to/3JA0lpA )

If #esphome supported #i2s on #esp8266 this wouldn't be an issue. I have plenty of esp8266 boards that are roughly the right size. Alas, filing a bug would involve another fight with #stalebot.

Instead of climbing the #barriertoentry, I fired up #Fusion360 (thanks usebottles.com/app/#fusion360 !) and whipped up a quick alternate box bottom.

Unfortunately, some terrible no good very bad filament from #Sunlu has managed to completely jam my extruder right below the gear, so I can't print it yet.

I am so tired of rebuilding this stupid #Prusa. The hot-end was decent before the #mmu2 disaster, but that conversion and subsequent fix-after-fix has made it sketchy at best. At least I'm getting good at teardowns. (And I'm saving for the top MK4 upgrade to get rid of the PTFE entirely.)