Skip to content

Commit 82e832f

Browse files
Tomasz Bursztykagalak
authored andcommitted
boards/arm: Enabling SPI ports on nucleo_f103rb
Current configuration was choosen to avoid colliding with existing ones for i2c and uart, but others can be used. Signed-off-by: Tomasz Bursztyka <[email protected]>
1 parent 561161d commit 82e832f

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

boards/arm/nucleo_f103rb/Kconfig.defconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,14 @@ config PWM_STM32_1
2424

2525
endif # PWM
2626

27+
if SPI
28+
29+
config SPI_1
30+
default y
31+
32+
config SPI_2
33+
default y
34+
35+
endif
36+
2737
endif # BOARD_NUCLEO_F103RB

boards/arm/nucleo_f103rb/nucleo_f103rb.dts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,11 @@
3636
pinctrl-0 = <&usart3_pins_a>;
3737
pinctrl-names = "default";
3838
};
39+
40+
&spi1 {
41+
status = "ok";
42+
};
43+
44+
&spi2 {
45+
status = "ok";
46+
};

boards/arm/nucleo_f103rb/pinmux.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@ static const struct pin_config pinconf[] = {
2929
#ifdef CONFIG_PWM_STM32_1
3030
{STM32_PIN_PA8, STM32F1_PINMUX_FUNC_PA8_PWM1_CH1},
3131
#endif /* CONFIG_PWM_STM32_1 */
32+
#ifdef CONFIG_SPI_1
33+
{STM32_PIN_PA4, STM32F1_PINMUX_FUNC_PA4_SPI1_MASTER_NSS},
34+
{STM32_PIN_PA5, STM32F1_PINMUX_FUNC_PA5_SPI1_MASTER_SCK},
35+
{STM32_PIN_PA6, STM32F1_PINMUX_FUNC_PA6_SPI1_MASTER_MISO},
36+
{STM32_PIN_PA7, STM32F1_PINMUX_FUNC_PA7_SPI1_MASTER_MOSI},
37+
#endif /* CONFIG_SPI_1 */
38+
#ifdef CONFIG_SPI_2
39+
{STM32_PIN_PB12, STM32F1_PINMUX_FUNC_PB12_SPI2_MASTER_NSS},
40+
{STM32_PIN_PB13, STM32F1_PINMUX_FUNC_PB13_SPI2_MASTER_SCK},
41+
{STM32_PIN_PB14, STM32F1_PINMUX_FUNC_PB14_SPI2_MASTER_MISO},
42+
{STM32_PIN_PB15, STM32F1_PINMUX_FUNC_PB15_SPI2_MASTER_MOSI},
43+
#endif /* CONFIG_SPI_2 */
3244
};
3345

3446
static int pinmux_stm32_init(struct device *port)

0 commit comments

Comments
 (0)