diff --git a/boards/arm/stm32f7/stm32f777zit6-meadow/configs/i2s/defconfig b/boards/arm/stm32f7/stm32f777zit6-meadow/configs/i2s/defconfig new file mode 100644 index 0000000000000..efa714be6c19e --- /dev/null +++ b/boards/arm/stm32f7/stm32f777zit6-meadow/configs/i2s/defconfig @@ -0,0 +1,79 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +# CONFIG_STM32F7_USE_LEGACY_PINMAP is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="stm32f777zit6-meadow" +CONFIG_ARCH_BOARD_MEADOW_F7MICRO=y +CONFIG_ARCH_CHIP="stm32f7" +CONFIG_ARCH_CHIP_STM32F777ZI=y +CONFIG_ARCH_CHIP_STM32F7=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_ARMV7M_DCACHE=y +CONFIG_ARMV7M_DCACHE_WRITETHROUGH=y +CONFIG_ARMV7M_DTCM=y +CONFIG_ARMV7M_ICACHE=y +CONFIG_AUDIO=y +CONFIG_AUDIO_CS4344=y +CONFIG_AUDIO_EXCLUDE_TONE=y +CONFIG_AUDIO_EXCLUDE_VOLUME=y +CONFIG_AUDIO_I2S=y +CONFIG_BCH=y +CONFIG_BOARDCTL_USBDEVCTRL=y +CONFIG_BOARD_LATE_INITIALIZE=y +CONFIG_BOARD_LOOPSPERMSEC=43103 +CONFIG_BUILTIN=y +CONFIG_CDCACM=y +CONFIG_CDCACM_CONSOLE=y +CONFIG_CDCACM_PRODUCTID=0x0001 +CONFIG_CDCACM_PRODUCTSTR="Wilderness Labs" +CONFIG_CDCACM_VENDORID=0x2E6A +CONFIG_CDCACM_VENDORSTR="Meadow F7 Micro" +CONFIG_CRYPTO=y +CONFIG_CRYPTO_RANDOM_POOL=y +CONFIG_DEV_URANDOM=y +CONFIG_DEV_URANDOM_RANDOM_POOL=y +CONFIG_DRIVERS_AUDIO=y +CONFIG_FS_LITTLEFS=y +CONFIG_HAVE_CXX=y +CONFIG_HAVE_CXXINITIALIZE=y +CONFIG_I2S=y +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_INTELHEX_BINARY=y +CONFIG_MM_REGIONS=3 +CONFIG_MTD=y +CONFIG_MTD_BYTE_WRITE=y +CONFIG_MTD_PARTITION=y +CONFIG_MTD_SECT512=y +CONFIG_MTD_W25QXXXJV=y +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_LINELEN=64 +CONFIG_NSH_READLINE=y +CONFIG_PREALLOC_TIMERS=4 +CONFIG_RAM_SIZE=245760 +CONFIG_RAM_START=0x20010000 +CONFIG_RAW_BINARY=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_HPWORK=y +CONFIG_SCHED_WAITPID=y +CONFIG_SPI=y +CONFIG_START_DAY=14 +CONFIG_STM32F7_DMA1=y +CONFIG_STM32F7_I2S2=y +CONFIG_STM32F7_I2S2_MCK=y +CONFIG_STM32F7_I2S2_TX=y +CONFIG_STM32F7_OTGFS=y +CONFIG_STM32F7_QSPI_POLLING=y +CONFIG_STM32F7_QUADSPI=y +CONFIG_STM32F7_USART1=y +CONFIG_SYSTEM_FLASH_ERASEALL=y +CONFIG_SYSTEM_NSH=y +CONFIG_TASK_NAME_SIZE=64 +CONFIG_USBDEV=y +CONFIG_W25QXXXJV_QSPI_FREQUENCY=64000000 diff --git a/boards/arm/stm32f7/stm32f777zit6-meadow/include/board.h b/boards/arm/stm32f7/stm32f777zit6-meadow/include/board.h index 9c054cd020149..85d004f8e9a5c 100644 --- a/boards/arm/stm32f7/stm32f777zit6-meadow/include/board.h +++ b/boards/arm/stm32f7/stm32f777zit6-meadow/include/board.h @@ -152,6 +152,13 @@ #define STM32_RCC_PLLSAICFGR_PLLSAIQ RCC_PLLSAICFGR_PLLSAIQ(2) #define STM32_RCC_PLLSAICFGR_PLLSAIR RCC_PLLSAICFGR_PLLSAIR(2) +/* SAIx input frequency = 25 / M * N / Q / P + * 25000000 / 25 * 384 / 2 / 8 + */ + +#define STM32F7_SAI1_FREQUENCY (49142857) +#define STM32F7_SAI2_FREQUENCY (49142857) + /* Configure Dedicated Clock Configuration Register */ #define STM32_RCC_DCKCFGR1_PLLI2SDIVQ RCC_DCKCFGR1_PLLI2SDIVQ(1) @@ -377,6 +384,10 @@ /* DMA Channel/Stream Selections ********************************************/ +#define DMACHAN_SAI2_A DMAMAP_SAI2_A +#define DMACHAN_SAI2_B DMAMAP_SAI2_B +#define DMACHAN_SAI1_B DMAMAP_SAI1_B + /* SDMMC */ /* Stream selections are arbitrary for now but might become important in the @@ -470,6 +481,16 @@ #define GPIO_I2C1_SCL (GPIO_I2C1_SCL_1|GPIO_SPEED_50MHz) #define GPIO_I2C1_SDA (GPIO_I2C1_SDA_1|GPIO_SPEED_50MHz) +/* I2S2 - CS4344 configuration uses I2S2 */ + +#define GPIO_I2S2_SD (GPIO_I2S2_SD_1 | GPIO_SPEED_100MHz) /* PB15 */ +#define GPIO_I2S2_CK (GPIO_I2S2_CK_3 | GPIO_SPEED_100MHz) /* PB13 */ +#define GPIO_I2S2_WS (GPIO_I2S2_WS_1 | GPIO_SPEED_100MHz) /* PB12 */ +#define GPIO_I2S2_MCK (GPIO_I2S2_MCK_0 | GPIO_SPEED_100MHz) /* PC6 */ + +#define DMACHAN_I2S3_RX DMAMAP_SPI3_RX_2 +#define DMACHAN_I2S3_TX DMAMAP_SPI3_TX_2 + /* QSPI Mapping */ #define GPIO_QSPI_CS (GPIO_QUADSPI_BK1_NCS_2 | GPIO_FLOAT | GPIO_PUSHPULL | GPIO_SPEED_100MHz) diff --git a/boards/arm/stm32f7/stm32f777zit6-meadow/src/stm32_bringup.c b/boards/arm/stm32f7/stm32f777zit6-meadow/src/stm32_bringup.c index 7c0b50331efab..7dadf6b3d2221 100644 --- a/boards/arm/stm32f7/stm32f777zit6-meadow/src/stm32_bringup.c +++ b/boards/arm/stm32f7/stm32f777zit6-meadow/src/stm32_bringup.c @@ -33,6 +33,10 @@ #include #include +#ifdef CONFIG_AUDIO_CS4344 +# include "stm32_cs4344.h" +#endif + #include "stm32f777zit6-meadow.h" /**************************************************************************** @@ -139,6 +143,16 @@ int stm32_bringup(void) } #endif +#ifdef CONFIG_AUDIO_CS4344 + /* Configure CS4344 audio as /dev/pcm0 on I2S2 */ + + ret = board_cs4344_initialize(0, 2); + if (ret != OK) + { + syslog(LOG_ERR, "Failed to initialize CS4344 audio: %d\n", ret); + } +#endif + #ifdef CONFIG_BOARD_MEADOW_F7_CORE_COMPUTE /* Initialize all devices in the F7 Core Compute */