boards: stm: Add CAN support for stm32f072b micro controller

This commit adds the can device to the stm32f072b device tree and pinmux

Signed-off-by: Alexander Wachter <alexander.wachter@student.tugraz.at>
This commit is contained in:
Alexander Wachter 2018-05-03 11:04:12 +02:00 committed by Carles Cufí
commit e73637af24
6 changed files with 49 additions and 0 deletions

View file

@ -36,6 +36,12 @@
#define CONFIG_SPI_2_NAME ST_STM32_SPI_FIFO_40003800_LABEL
#define CONFIG_SPI_2_IRQ ST_STM32_SPI_FIFO_40003800_IRQ_0
#define CONFIG_CAN_1_BASE_ADDRESS ST_STM32_CAN_40006400_BASE_ADDRESS
#define CONFIG_CAN_1_BUS_SPEED ST_STM32_CAN_40006400_BUS_SPEED
#define CONFIG_CAN_1_NAME ST_STM32_CAN_40006400_LABEL
#define CONFIG_CAN_1_IRQ ST_STM32_CAN_40006400_IRQ_0
#define CONFIG_CAN_1_IRQ_PRIORITY ST_STM32_CAN_40006400_IRQ_0_PRIORITY
#define FLASH_DEV_BASE_ADDRESS ST_STM32F0_FLASH_CONTROLLER_40022000_BASE_ADDRESS
#define FLASH_DEV_NAME ST_STM32F0_FLASH_CONTROLLER_40022000_LABEL

View file

@ -32,6 +32,11 @@ static const struct pin_config pinconf[] = {
{STM32_PIN_PB4, STM32F0_PINMUX_FUNC_PB4_SPI1_MISO},
{STM32_PIN_PB5, STM32F0_PINMUX_FUNC_PB5_SPI1_MOSI},
#endif /* CONFIG_SPI_1 */
#ifdef CONFIG_CAN_1
{STM32_PIN_PB8, STM32F0_PINMUX_FUNC_PB8_CAN_RX},
{STM32_PIN_PB9, STM32F0_PINMUX_FUNC_PB9_CAN_TX},
#endif /* CONFIG_CAN_1 */
};
static int pinmux_stm32_init(struct device *port)

View file

@ -74,3 +74,10 @@
&spi1 {
status = "ok";
};
&can1 {
pinctrl-0 = <&can_pins_a>;
pinctrl-names = "default";
bus-speed = <250000>;
status = "ok";
};

View file

@ -88,4 +88,13 @@
#define STM32F0_PINMUX_FUNC_PC3_SPI2_MOSI \
(STM32_PINMUX_ALT_FUNC_0 | STM32_PUSHPULL_NOPULL)
#define STM32F0_PINMUX_FUNC_PB8_CAN_RX \
(STM32_PINMUX_ALT_FUNC_4 | STM32_PUSHPULL_NOPULL)
#define STM32F0_PINMUX_FUNC_PB9_CAN_TX \
(STM32_PINMUX_ALT_FUNC_4 | STM32_PUSHPULL_NOPULL)
#define STM32F0_PINMUX_FUNC_PD0_CAN_RX \
(STM32_PINMUX_ALT_FUNC_0 | STM32_PUPDR_PULL_UP)
#define STM32F0_PINMUX_FUNC_PD1_CAN_TX \
(STM32_PINMUX_ALT_FUNC_0 | STM32_PUSHPULL_NOPULL)
#endif /* _STM32F0_PINMUX_H_ */

View file

@ -39,6 +39,18 @@
tx = <STM32_PIN_PD5 (STM32_PINMUX_ALT_FUNC_0 | STM32_PUSHPULL_NOPULL)>;
};
};
can_pins_a: can@0 {
rx_tx {
rx = <STM32_PIN_PB8 (STM32_PINMUX_ALT_FUNC_4 | STM32_PUPDR_PULL_UP)>;
tx = <STM32_PIN_PB9 (STM32_PINMUX_ALT_FUNC_4 | STM32_PUPDR_NO_PULL)>;
};
};
can_pins_b: can@1 {
rx_tx {
rx = <STM32_PIN_PD0 (STM32_PINMUX_ALT_FUNC_0 | STM32_PUPDR_PULL_UP)>;
tx = <STM32_PIN_PD1 (STM32_PINMUX_ALT_FUNC_0 | STM32_PUPDR_NO_PULL)>;
};
};
};
};
};

View file

@ -42,5 +42,15 @@
status = "disabled";
label= "USB";
};
can1: can@40006400 {
compatible = "st,stm32-can";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x40006400 0x400>;
interrupts = <30 0>;
status = "disabled";
label = "CAN_1";
};
};
};