arduino / ArduinoCore-mbed

345 stars 199 forks source link

Giga R1 PDM library pins not correctly defined #718

Closed Gerriko closed 1 year ago

Gerriko commented 1 year ago

In the Arduino documentation, there is a section on PDM: https://docs.arduino.cc/tutorials/giga-r1-wifi/giga-audio#pulse-density-modulation-support

However, as there is no PDM microphone on the Giga R1 board, I was curious to see what DAT and CLK were defined in the PDM library because the examples provided do not allow you to define these yourself.

I then discovered that in the PDM.cpp file (found in the STM32H747_dfsdm / STM32H747_SAI folders) these pins are one and the same:

PDMClass PDM(0, 0, 0);

The examples will then still compile.

According to the STM32H747xI/G datasheet: Three standard I2S interfaces (multiplexed with SPI1, SPI2 and SPI3) are available. They can be operated in Master or Slave mode, in Simplex or Full-duplex communication mode, and can be configured to operate with a 16-/32-bit resolution as an input or output channel. Audio sampling frequencies from 8 kHz up to 192 kHz are supported.

So as SPI1 (pins 11,12,13) are available, I assume these could be used in some way or form.

I haven't checked if SPI2 or SPI3 pins are available on the Giga board.

facchinm commented 1 year ago

@Gerriko the Giga exposes a "pure" PDM interface on the "right black" connector (the one with the DSI signals). Pins are https://github.com/arduino/ArduinoCore-mbed/blob/52caeac0926acbfb9a3f2b0fa3ba1c9996f103ec/libraries/PDM/src/STM32H747_dfsdm/audio.h#L33-L43 and will be used in an upcoming shield (without any SAI/SPI complication) :slightly_smiling_face: They are marked as D73/D75 in the pinout