2021-07-22 11:21 PM
Hi,
I am using X-NUCLEO-CCA02M2 microphone board with nucleo-f401RE for USB audio streaming. Can anyone share the details about interfacing pin connection(which I2S pin is used)?. My understanding is like timer is used to connect pdm clock with I2S clock. Is the input to the timer can be configured using software or hardwire connection between I2S clock and timer input is needed?
Solved! Go to Solution.
2021-10-12 06:44 AM
Hi @KK Y.1 ,
sorry for the very delay in our answer.
The microphones compatible with the X-NUCLEO-CCA02M2 board are digital PDM microphones, so they only need the clock and the PDM lines.
These lines are reported on the morpho connector, that is linked to the "motherboard" NUCLEO-F401RE. However, this board has multiple "free" GPIO pins, that can be configured for the digital PDM acquisition using the STM32 I²S, SPI, DFSDM or SAI peripherals.
So my suggestion is to start from the X-CUBE-MEMSMIC1 expansion package, where an example combining the STM32F401RE-Nucleo with the X-NUCLEO-CCA02M2 is present, in \Projects\STM32F401RE-Nucleo\Demonstration\CCA02M2 folder.
In particular, you can find the details in the (attached).
For the NUCLEO-F401RE board, the I2S (or SPI) interface are used, but also the DFSDM or SAI peripherals are available.
static void I2S_MspInit(I2S_HandleTypeDef *hi2s)
{
UNUSED(hi2s);
GPIO_InitTypeDef GPIO_InitStruct;
/* Enable the I2S2 peripheral clock */
AUDIO_IN_I2S_CLK_ENABLE();
/* Enable I2S GPIO clocks */
AUDIO_IN_I2S_SCK_GPIO_CLK_ENABLE();
AUDIO_IN_I2S_MOSI_GPIO_CLK_ENABLE();
/* I2S2 pins configuration: SCK and MOSI pins ------------------------------*/
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FAST;
GPIO_InitStruct.Pin = AUDIO_IN_I2S_SCK_PIN;
GPIO_InitStruct.Alternate = AUDIO_IN_I2S_SCK_AF;
HAL_GPIO_Init(AUDIO_IN_I2S_SCK_GPIO_PORT, &GPIO_InitStruct);
GPIO_InitStruct.Pin = AUDIO_IN_I2S_MOSI_PIN ;
GPIO_InitStruct.Alternate = AUDIO_IN_I2S_MOSI_AF;
HAL_GPIO_Init(AUDIO_IN_I2S_MOSI_GPIO_PORT, &GPIO_InitStruct);
}
Specifically, the AUDIO_IN_I2S_SCK_PIN and AUDIO_IN_I2S_MOSI_PIN are hardware defined as follows (on the morpho connector):
#define AUDIO_IN_I2S_SCK_PIN GPIO_PIN_13
#define AUDIO_IN_I2S_MOSI_PIN GPIO_PIN_15
/* CKOUT for all mics (GPIOC_PIN_2)*/
#define AUDIO_DFSDMx_CKOUT_PIN GPIO_PIN_2
#define AUDIO_DFSDMx_CKOUT_AF GPIO_AF6_DFSDM
#define AUDIO_DFSDMx_CKOUT_GPIO_PORT GPIOC
#define AUDIO_DFSDMx_CKOUT_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
/* DATIN for MIC1 */
#define AUDIO_DFSDMx_DATIN_MIC1_PIN GPIO_PIN_14
#define AUDIO_DFSDMx_DATIN_MIC1_AF GPIO_AF6_DFSDM
#define AUDIO_DFSDMx_DATIN_MIC1_GPIO_PORT GPIOB
#define AUDIO_DFSDMx_DATIN_MIC1_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
If my reply answered your question, please click on Select as Best at the bottom of this post. This will help other users with the same issue to find the answer faster.
-Eleon
2021-10-12 06:44 AM
Hi @KK Y.1 ,
sorry for the very delay in our answer.
The microphones compatible with the X-NUCLEO-CCA02M2 board are digital PDM microphones, so they only need the clock and the PDM lines.
These lines are reported on the morpho connector, that is linked to the "motherboard" NUCLEO-F401RE. However, this board has multiple "free" GPIO pins, that can be configured for the digital PDM acquisition using the STM32 I²S, SPI, DFSDM or SAI peripherals.
So my suggestion is to start from the X-CUBE-MEMSMIC1 expansion package, where an example combining the STM32F401RE-Nucleo with the X-NUCLEO-CCA02M2 is present, in \Projects\STM32F401RE-Nucleo\Demonstration\CCA02M2 folder.
In particular, you can find the details in the (attached).
For the NUCLEO-F401RE board, the I2S (or SPI) interface are used, but also the DFSDM or SAI peripherals are available.
static void I2S_MspInit(I2S_HandleTypeDef *hi2s)
{
UNUSED(hi2s);
GPIO_InitTypeDef GPIO_InitStruct;
/* Enable the I2S2 peripheral clock */
AUDIO_IN_I2S_CLK_ENABLE();
/* Enable I2S GPIO clocks */
AUDIO_IN_I2S_SCK_GPIO_CLK_ENABLE();
AUDIO_IN_I2S_MOSI_GPIO_CLK_ENABLE();
/* I2S2 pins configuration: SCK and MOSI pins ------------------------------*/
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FAST;
GPIO_InitStruct.Pin = AUDIO_IN_I2S_SCK_PIN;
GPIO_InitStruct.Alternate = AUDIO_IN_I2S_SCK_AF;
HAL_GPIO_Init(AUDIO_IN_I2S_SCK_GPIO_PORT, &GPIO_InitStruct);
GPIO_InitStruct.Pin = AUDIO_IN_I2S_MOSI_PIN ;
GPIO_InitStruct.Alternate = AUDIO_IN_I2S_MOSI_AF;
HAL_GPIO_Init(AUDIO_IN_I2S_MOSI_GPIO_PORT, &GPIO_InitStruct);
}
Specifically, the AUDIO_IN_I2S_SCK_PIN and AUDIO_IN_I2S_MOSI_PIN are hardware defined as follows (on the morpho connector):
#define AUDIO_IN_I2S_SCK_PIN GPIO_PIN_13
#define AUDIO_IN_I2S_MOSI_PIN GPIO_PIN_15
/* CKOUT for all mics (GPIOC_PIN_2)*/
#define AUDIO_DFSDMx_CKOUT_PIN GPIO_PIN_2
#define AUDIO_DFSDMx_CKOUT_AF GPIO_AF6_DFSDM
#define AUDIO_DFSDMx_CKOUT_GPIO_PORT GPIOC
#define AUDIO_DFSDMx_CKOUT_GPIO_CLK_ENABLE() __HAL_RCC_GPIOC_CLK_ENABLE()
/* DATIN for MIC1 */
#define AUDIO_DFSDMx_DATIN_MIC1_PIN GPIO_PIN_14
#define AUDIO_DFSDMx_DATIN_MIC1_AF GPIO_AF6_DFSDM
#define AUDIO_DFSDMx_DATIN_MIC1_GPIO_PORT GPIOB
#define AUDIO_DFSDMx_DATIN_MIC1_GPIO_CLK_ENABLE() __HAL_RCC_GPIOB_CLK_ENABLE()
If my reply answered your question, please click on Select as Best at the bottom of this post. This will help other users with the same issue to find the answer faster.
-Eleon