diff --git a/hal/targets.json b/hal/targets.json index b948d3de9d..55c3fa3050 100644 --- a/hal/targets.json +++ b/hal/targets.json @@ -900,7 +900,7 @@ "macros": ["MBEDTLS_ENTROPY_HARDWARE_ALT"], "progen": {"target": "nucleo-f767zi"}, "detect_code": ["0818"], - "device_has": ["ANALOGIN", "ANALOGOUT", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"], + "device_has": ["ANALOGIN", "ANALOGOUT", "CAN", "I2C", "I2CSLAVE", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "RTC", "SERIAL", "SERIAL_ASYNCH", "SLEEP", "SPI", "SPISLAVE", "STDIO_MESSAGES"], "features": ["IPV4"], "release_versions": ["2", "5"] }, diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F767ZI/PeripheralNames.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F767ZI/PeripheralNames.h index 819b12e8fc..fc1991862d 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F767ZI/PeripheralNames.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F767ZI/PeripheralNames.h @@ -92,6 +92,12 @@ typedef enum { PWM_14 = (int)TIM14_BASE } PWMName; +typedef enum { + CAN_1 = (int)CAN1_BASE, + CAN_2 = (int)CAN2_BASE, + CAN_3 = (int)CAN3_BASE +} CANName; + #ifdef __cplusplus } #endif diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F767ZI/PeripheralPins.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F767ZI/PeripheralPins.c index f128dd2320..db600f4db2 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F767ZI/PeripheralPins.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F767ZI/PeripheralPins.c @@ -326,3 +326,27 @@ const PinMap PinMap_SPI_SSEL[] = { {PF_6, SPI_5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF5_SPI5)}, {NC, NC, 0} }; + +//*** CAN *** + +const PinMap PinMap_CAN_RD[] = { + {PA_8, CAN_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF11_CAN3)}, + {PA_11, CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)}, + {PB_3, CAN_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF11_CAN3)}, + {PB_5, CAN_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN2)}, + {PB_8, CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)}, + {PB_12, CAN_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN2)}, + {PD_0, CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)}, + {NC, NC, 0} +}; + +const PinMap PinMap_CAN_TD[] = { + {PA_12, CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)}, + {PA_15, CAN_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF11_CAN3)}, + {PB_4, CAN_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF11_CAN3)}, + {PB_6, CAN_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN2)}, + {PB_9, CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)}, + {PB_13, CAN_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN2)}, + {PD_1, 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_STM32F7/TARGET_NUCLEO_F767ZI/objects.h b/hal/targets/hal/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F767ZI/objects.h index ee08873996..0c2f3fd453 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F767ZI/objects.h +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F7/TARGET_NUCLEO_F767ZI/objects.h @@ -85,6 +85,12 @@ struct i2c_s { uint32_t slave; }; +struct can_s { + CANName can; + int index; +}; + + #include "gpio_object.h" #include "common_objects.h" diff --git a/libraries/tests/mbed/can_loopback/main.cpp b/libraries/tests/mbed/can_loopback/main.cpp index efbd9a5de4..be68d11880 100644 --- a/libraries/tests/mbed/can_loopback/main.cpp +++ b/libraries/tests/mbed/can_loopback/main.cpp @@ -24,7 +24,7 @@ CAN can1(PA_11, PA_12); #elif defined(TARGET_DISCO_F469NI) || defined(TARGET_DISCO_F746NG) || \ defined(TARGET_NUCLEO_F446ZE) || defined(TARGET_NUCLEO_F103RB) || \ defined(TARGET_NUCLEO_F207ZG) || defined(TARGET_NUCLEO_F303ZE) || \ - defined(TARGET_DISCO_F769NI) + defined(TARGET_DISCO_F769NI) || defined(TARGET_NUCLEO_F767ZI) CAN can1(PB_8, PB_9); #endif diff --git a/tools/tests.py b/tools/tests.py index 26ca23f344..29a610b53b 100644 --- a/tools/tests.py +++ b/tools/tests.py @@ -326,7 +326,7 @@ TESTS = [ "NUCLEO_F303RE", "NUCLEO_F303K8", "NUCLEO_F302R8", "NUCLEO_F446RE","NUCLEO_F446ZE", "DISCO_F469NI", "DISCO_F429ZI", "NUCLEO_F103RB", "NUCLEO_F746ZG", "DISCO_F746NG", "DISCO_L476VG", "NUCLEO_L476RG", "NUCLEO_L432KC", - "DISCO_F769NI"] + "DISCO_F769NI", "NUCLEO_F767ZI"] }, { "id": "MBED_A28", "description": "CAN loopback test", @@ -339,7 +339,7 @@ TESTS = [ "NUCLEO_F303RE", "NUCLEO_F303K8", "NUCLEO_F302R8", "NUCLEO_F303ZE", "NUCLEO_F446RE","NUCLEO_F446ZE", "DISCO_F469NI", "DISCO_F429ZI", "NUCLEO_F103RB", "NUCLEO_F746ZG", "DISCO_F746NG", "DISCO_L476VG", "NUCLEO_L476RG", "NUCLEO_L432KC", - "DISCO_F769NI"] + "DISCO_F769NI", "NUCLEO_F767ZI"] }, { "id": "MBED_BLINKY", "description": "Blinky",