diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F469NI/PeripheralNames.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F469NI/PeripheralNames.h index 1b9d414f36..614256717e 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F469NI/PeripheralNames.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F469NI/PeripheralNames.h @@ -91,6 +91,11 @@ typedef enum { PWM_14 = (int)TIM14_BASE } PWMName; +typedef enum { + CAN_1 = (int)CAN1_BASE, + CAN_2 = (int)CAN2_BASE +} CANName; + #ifdef __cplusplus } #endif diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F469NI/PeripheralPins.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F469NI/PeripheralPins.c index f4596e1e2b..bcfb3af59e 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F469NI/PeripheralPins.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F469NI/PeripheralPins.c @@ -301,3 +301,13 @@ const PinMap PinMap_SPI_SSEL[] = { {PI_0, SPI_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, {NC, NC, 0} }; + +const PinMap PinMap_CAN_RD[] = { + {PB_8 , CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)}, + {NC, NC, 0} +}; + +const PinMap PinMap_CAN_TD[] = { + {PB_9 , CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)}, + {NC, NC, 0} +}; diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F469NI/device.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F469NI/device.h index f18c574c51..c9cff10674 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F469NI/device.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F469NI/device.h @@ -54,6 +54,8 @@ #define DEVICE_SLEEP 1 +#define DEVICE_CAN 1 + //======================================= #define DEVICE_SEMIHOST 0 diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F469NI/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F469NI/objects.h index f0b6d09b21..c18281de29 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F469NI/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_DISCO_F469NI/objects.h @@ -104,6 +104,11 @@ struct pwmout_s { uint8_t inverted; }; +struct can_s { + CANName can; + int index; +}; + #include "gpio_object.h" #ifdef __cplusplus diff --git a/libraries/tests/mbed/can/main.cpp b/libraries/tests/mbed/can/main.cpp index 33201023a8..6eddb3301d 100644 --- a/libraries/tests/mbed/can/main.cpp +++ b/libraries/tests/mbed/can/main.cpp @@ -19,6 +19,8 @@ CAN can1(PD_0, PD_1); defined(TARGET_NUCLEO_F303RE) || defined(TARGET_NUCLEO_F303K8) || \ defined(TARGET_NUCLEO_F302R8) || defined(TARGET_NUCLEO_F446RE) CAN can1(PA_11, PA_12); +#elif defined(TARGET_DISCO_F469NI) +CAN can1(PB_8, PB_9); #else CAN can1(p9, p10); #endif @@ -27,7 +29,7 @@ CAN can1(p9, p10); CAN can2(p34, p33); #elif defined (TARGET_LPC1768) CAN can2(p30, p29); -#elif defined(TARGET_NUCLEO_F446RE) +#elif defined(TARGET_NUCLEO_F446RE) || defined(TARGET_DISCO_F469NI) CAN can2(PB_5, PB_6); #endif char counter = 0; diff --git a/libraries/tests/mbed/can_interrupt/main.cpp b/libraries/tests/mbed/can_interrupt/main.cpp index 0b50a142ba..ffdb5b4547 100644 --- a/libraries/tests/mbed/can_interrupt/main.cpp +++ b/libraries/tests/mbed/can_interrupt/main.cpp @@ -19,6 +19,8 @@ CAN can1(PD_0, PD_1); defined(TARGET_NUCLEO_F303RE) || defined(TARGET_NUCLEO_F303K8) || \ defined(TARGET_NUCLEO_F302R8) || defined(TARGET_NUCLEO_F446RE) CAN can1(PA_11, PA_12); +#elif defined(TARGET_DISCO_F469NI) +CAN can1(PB_8, PB_9); #else CAN can1(p9, p10); #endif @@ -27,7 +29,7 @@ CAN can1(p9, p10); CAN can2(p34, p33); #elif defined (TARGET_LPC1768) CAN can2(p30, p29); -#elif defined(TARGET_NUCLEO_F446RE) +#elif defined(TARGET_NUCLEO_F446RE) || defined(TARGET_DISCO_F469NI) CAN can2(PB_5, PB_6); #endif char counter = 0; diff --git a/libraries/tests/mbed/can_loopback/main.cpp b/libraries/tests/mbed/can_loopback/main.cpp index f0c73afc35..750b365aa2 100644 --- a/libraries/tests/mbed/can_loopback/main.cpp +++ b/libraries/tests/mbed/can_loopback/main.cpp @@ -18,6 +18,8 @@ CAN can1(P5_9, P5_10); defined(TARGET_NUCLEO_F303RE) || defined(TARGET_NUCLEO_F303K8) || \ defined(TARGET_NUCLEO_F302R8) || defined(TARGET_NUCLEO_F446RE) CAN can1(PA_11, PA_12); +#elif defined(TARGET_DISCO_F469NI) +CAN can1(PB_8, PB_9); #endif #define TEST_ITERATIONS 127 diff --git a/workspace_tools/tests.py b/workspace_tools/tests.py index f1179faf66..20e06f090f 100644 --- a/workspace_tools/tests.py +++ b/workspace_tools/tests.py @@ -99,6 +99,7 @@ Wiring: * NUCLEO_F303K8: (RX=PA_11, TX=PA_12) * NUCLEO_F302R8: (RX=PA_11, TX=PA_12) * NUCLEO_F446RE: (RX=PA_11, TX=PA_12) + * DISCO_F469NI: (RX=PB_8, TX=PB_9) """ TESTS = [ @@ -306,7 +307,8 @@ TESTS = [ "peripherals": ["can_transceiver"], "mcu": ["LPC1549", "LPC1768","B96B_F446VE", "VK_RZ_A1H", "NUCLEO_F091RC", "NUCLEO_F072RB", "NUCLEO_F042K6", "NUCLEO_F334R8", - "NUCLEO_F303RE", "NUCLEO_F303K8", "NUCLEO_F302R8", "NUCLEO_F446RE"], + "NUCLEO_F303RE", "NUCLEO_F303K8", "NUCLEO_F302R8", "NUCLEO_F446RE", + "DISCO_F469NI"], }, { "id": "MBED_BLINKY", "description": "Blinky", @@ -579,7 +581,7 @@ TESTS = [ "dependencies": [MBED_LIBRARIES], "mcu": ["LPC1768", "LPC4088", "LPC1549", "RZ_A1H", "B96B_F446VE", "NUCLEO_F091RC", "NUCLEO_F072RB", "NUCLEO_F042K6", "NUCLEO_F334R8", "NUCLEO_F303RE", - "NUCLEO_F303K8", "NUCLEO_F302R8", "NUCLEO_F446RE"] + "NUCLEO_F303K8", "NUCLEO_F302R8", "NUCLEO_F446RE", "DISCO_F469NI"] }, { "id": "MBED_30", "description": "CAN network test using interrupts", @@ -587,7 +589,7 @@ TESTS = [ "dependencies": [MBED_LIBRARIES], "mcu": ["LPC1768", "LPC4088", "LPC1549", "RZ_A1H", "B96B_F446VE", "NUCLEO_F091RC", "NUCLEO_F072RB", "NUCLEO_F042K6", "NUCLEO_F334R8", "NUCLEO_F303RE", - "NUCLEO_F303K8", "NUCLEO_F302R8", "NUCLEO_F446RE"] + "NUCLEO_F303K8", "NUCLEO_F302R8", "NUCLEO_F446RE", "DISCO_F469NI"] }, { "id": "MBED_31", "description": "PWM LED test",