diff --git a/boards/arm/nucleo_f756zg/Kconfig.defconfig b/boards/arm/nucleo_f756zg/Kconfig.defconfig index 6df83d0cc60..4b316078640 100644 --- a/boards/arm/nucleo_f756zg/Kconfig.defconfig +++ b/boards/arm/nucleo_f756zg/Kconfig.defconfig @@ -51,4 +51,11 @@ config PWM_STM32_1 endif # PWM +if SPI + +config SPI_1 + default y + +endif # SPI + endif # BOARD_NUCLEO_F756ZG diff --git a/boards/arm/nucleo_f756zg/doc/nucleof756zg.rst b/boards/arm/nucleo_f756zg/doc/nucleof756zg.rst index 17010b3d55b..44606e9f9ed 100644 --- a/boards/arm/nucleo_f756zg/doc/nucleof756zg.rst +++ b/boards/arm/nucleo_f756zg/doc/nucleof756zg.rst @@ -112,6 +112,8 @@ features: +-----------+------------+-------------------------------------+ | PWM | on-chip | pwm | +-----------+------------+-------------------------------------+ +| SPI | on-chip | spi | ++-----------+------------+-------------------------------------+ Other hardware features are not yet supported on this Zephyr port. @@ -138,6 +140,10 @@ and a ST morpho connector. Board is configured as follows: - USB DP : PA12 - I2C : PB8, PB9 - PWM : PE13 +- SPI : PA4, PA5, PA6, PA7 + +Note. The Arduino Uno v3 specified SPI device conflicts with the on-board ETH +device on pin PA7. System Clock ------------ diff --git a/boards/arm/nucleo_f756zg/nucleo_f756zg.dts b/boards/arm/nucleo_f756zg/nucleo_f756zg.dts index fab49ef5ff1..916ffe4c665 100644 --- a/boards/arm/nucleo_f756zg/nucleo_f756zg.dts +++ b/boards/arm/nucleo_f756zg/nucleo_f756zg.dts @@ -52,6 +52,7 @@ arduino_serial: &usart6 {}; arduino_i2c: &i2c1 {}; +arduino_spi: &spi1 {}; &usart2 { current-speed = <115200>; @@ -90,3 +91,11 @@ arduino_i2c: &i2c1 {}; status = "ok"; }; }; + +&spi1 { + /* + * WARNING: The pin PA7 will conflict on selection of SPI_1 and + * ETH_STM32_HAL. See pinmux.c for further details. + */ + status = "ok"; +}; diff --git a/boards/arm/nucleo_f756zg/nucleo_f756zg.yaml b/boards/arm/nucleo_f756zg/nucleo_f756zg.yaml index 9c0358596dc..4cf8e0eb133 100644 --- a/boards/arm/nucleo_f756zg/nucleo_f756zg.yaml +++ b/boards/arm/nucleo_f756zg/nucleo_f756zg.yaml @@ -14,3 +14,4 @@ supported: - usb_device - i2c - pwm + - spi diff --git a/boards/arm/nucleo_f756zg/pinmux.c b/boards/arm/nucleo_f756zg/pinmux.c index fa5908d4d8a..172c6bd9cb4 100644 --- a/boards/arm/nucleo_f756zg/pinmux.c +++ b/boards/arm/nucleo_f756zg/pinmux.c @@ -12,7 +12,13 @@ #include -/* NUCLEO-F756ZG pin configurations */ +/* NUCLEO-F756ZG pin configurations + * + * WARNING: The pin PA7 will conflict on selection of SPI_1 and ETH_STM32_HAL. + * If you require both peripherals, and you do not need Arduino Uno v3 + * comaptability, the pin PB5 (also on ST Zio connector) can be used + * for the SPI_1 MOSI signal. + */ static const struct pin_config pinconf[] = { #ifdef CONFIG_UART_2 { STM32_PIN_PD5, STM32F7_PINMUX_FUNC_PD5_USART2_TX }, @@ -50,6 +56,12 @@ static const struct pin_config pinconf[] = { #ifdef CONFIG_PWM_STM32_1 { STM32_PIN_PE13, STM32F7_PINMUX_FUNC_PE13_PWM1_CH3 }, #endif /* CONFIG_PWM_STM32_1 */ +#ifdef CONFIG_SPI_1 + { STM32_PIN_PA4, STM32F7_PINMUX_FUNC_PA4_SPI1_NSS }, + { STM32_PIN_PA5, STM32F7_PINMUX_FUNC_PA5_SPI1_SCK }, + { STM32_PIN_PA6, STM32F7_PINMUX_FUNC_PA6_SPI1_MISO }, + { STM32_PIN_PA7, STM32F7_PINMUX_FUNC_PA7_SPI1_MOSI }, +#endif /* CONFIG_SPI_1 */ }; static int pinmux_stm32_init(struct device *port)