Commit 4ea41623 authored by Ivo Clarysse's avatar Ivo Clarysse Committed by Anas Nashif
Browse files

boards: stm32f4_disco: enable canbus

Define CAN_1 and CAN_2 canbus controllers and enable CAN_2 in the ST
STM32F4 Disco development board.

Signed-off-by: default avatarIvo Clarysse <ivo@bcdevices.com>
parent fe9025aa
Loading
Loading
Loading
Loading
+7 −0
Changes for boards/arm/stm32f4_disco/Kconfig.defconfig: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -22,4 +22,11 @@ config PWM_STM32_2

endif # PWM

if CAN

config CAN_2
	default y

endif # CAN

endif # BOARD_STM32F4_DISCO
+13 −0
Changes for boards/arm/stm32f4_disco/doc/index.rst: 13 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -96,6 +96,12 @@ The Zephyr stm32f4_disco board configuration supports the following hardware fea
+-----------+------------+-------------------------------------+
| USB       | on-chip    | usb                                 |
+-----------+------------+-------------------------------------+
| CAN       | on-chip    | CAN controller                      |
+-----------+------------+-------------------------------------+

.. note:: CAN feature requires CAN transceiver, such as `SK Pang CAN breakout board`_.
          Zephyr default configuration uses CAN_2 exclusively, as simultaneous use
          of CAN_1 and CAN_2 is not yet supported.

Other hardware features are not yet supported on Zephyr porting.

@@ -128,6 +134,10 @@ Default Zephyr Peripheral Mapping:
- LD6 : PD15
- USB DM : PA11
- USB DP : PA12
- CAN1_RX : PB8
- CAN1_TX : PB9
- CAN2_RX : PB5
- CAN2_TX : PB13

System Clock
============
@@ -201,3 +211,6 @@ You can debug an application in the usual way. Here is an example for the

.. _STM32F407 reference manual:
   http://www.st.com/resource/en/reference_manual/dm00031020.pdf

.. _SK Pang CAN breakout board:
   http://skpang.co.uk/catalog/canbus-can-fd-breakout-board-5v-p-242.html
+8 −0
Changes for boards/arm/stm32f4_disco/pinmux.c: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -29,6 +29,14 @@ static const struct pin_config pinconf[] = {
	{STM32_PIN_PA11, STM32F4_PINMUX_FUNC_PA11_OTG_FS_DM},
	{STM32_PIN_PA12, STM32F4_PINMUX_FUNC_PA12_OTG_FS_DP},
#endif	/* CONFIG_USB_DC_STM32 */
#ifdef CONFIG_CAN_1
	{STM32_PIN_PB8, STM32F4_PINMUX_FUNC_PB8_CAN1_RX},
	{STM32_PIN_PB9, STM32F4_PINMUX_FUNC_PB9_CAN1_TX},
#endif	/* CONFIG_CAN_1 */
#ifdef CONFIG_CAN_2
	{STM32_PIN_PB5, STM32F4_PINMUX_FUNC_PB5_CAN2_RX},
	{STM32_PIN_PB13, STM32F4_PINMUX_FUNC_PB13_CAN2_TX},
#endif	/* CONFIG_CAN_2 */
};

static int pinmux_stm32_init(struct device *port)
+11 −0
Changes for boards/arm/stm32f4_disco/stm32f4_disco.dts: 11 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@
	};

	aliases {
		can-primary = &can2;
		led0 = &green_led_4;
		led1 = &orange_led_3;
		led2 = &red_led_5;
@@ -81,3 +82,13 @@
&usbotg_fs {
	status = "okay";
};

&can1 {
	bus-speed = <125000>;
	status = "okay";
};

&can2 {
	bus-speed = <125000>;
	status = "okay";
};
+1 −0
Changes for boards/arm/stm32f4_disco/stm32f4_disco.yaml: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ toolchain:
ram: 128
flash: 1024
supported:
  - can
  - pwm
  - counter
  - usb