[DISCO_F746NG] Added CAN support

Added CAN API support for DISCO_F746NG target.

Change-Id: I3b475309ab9b08c2e0ca1e8fe7e10489b8256321
pull/1773/head
Bartosz Szczepanski 2016-04-21 11:49:36 +02:00
parent 4d22e94156
commit bafd20f561
8 changed files with 42 additions and 8 deletions

View File

@ -92,6 +92,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

View File

@ -149,3 +149,21 @@ const PinMap PinMap_SPI_SSEL[] = {
{PI_0, SPI_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF5_SPI2)}, // ARDUINO D10
{NC, NC, 0}
};
const PinMap PinMap_CAN_RD[] = {
// {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)},
// {PA_11, CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)},
// {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)},
{NC, NC, 0}
};
const PinMap PinMap_CAN_TD[] = {
// {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)},
// {PA_12, CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)},
// {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)},
{NC, NC, 0}
};

View File

@ -41,6 +41,8 @@
#define DEVICE_CAN 1
//=======================================
#define DEVICE_ID_LENGTH 24

View File

@ -105,6 +105,11 @@ struct pwmout_s {
uint8_t inverted;
};
struct can_s {
CANName can;
int index;
};
#include "gpio_object.h"
#ifdef __cplusplus

View File

@ -21,7 +21,7 @@ CAN can1(PD_0, PD_1);
defined(TARGET_DISCO_F429ZI) || defined(TARGET_NUCLEO_F103RB) || \
defined(TARGET_NUCLEO_F746ZG)
CAN can1(PA_11, PA_12);
#elif defined(TARGET_DISCO_F469NI)
#elif defined(TARGET_DISCO_F469NI) ||defined(TARGET_DISCO_F746NG)
CAN can1(PB_8, PB_9);
#else
CAN can1(p9, p10);
@ -32,7 +32,8 @@ CAN can2(p34, p33);
#elif defined (TARGET_LPC1768)
CAN can2(p30, p29);
#elif defined(TARGET_NUCLEO_F446RE) || defined(TARGET_DISCO_F469NI) || \
defined(TARGET_DISCO_F429ZI) || defined(TARGET_NUCLEO_F746ZG)
defined(TARGET_DISCO_F429ZI) || defined(TARGET_NUCLEO_F746ZG) || \
defined(TARGET_DISCO_F746NG)
CAN can2(PB_5, PB_6);
#endif
char counter = 0;

View File

@ -21,7 +21,7 @@ CAN can1(PD_0, PD_1);
defined(TARGET_DISCO_F429ZI) || defined(TARGET_NUCLEO_F103RB) || \
defined(TARGET_NUCLEO_F746ZG)
CAN can1(PA_11, PA_12);
#elif defined(TARGET_DISCO_F469NI)
#elif defined(TARGET_DISCO_F469NI) || defined(TARGET_DISCO_F746NG)
CAN can1(PB_8, PB_9);
#else
CAN can1(p9, p10);
@ -32,7 +32,8 @@ CAN can2(p34, p33);
#elif defined (TARGET_LPC1768)
CAN can2(p30, p29);
#elif defined(TARGET_NUCLEO_F446RE) || defined(TARGET_DISCO_F469NI) || \
defined(TARGET_DISCO_F429ZI) || defined(TARGET_NUCLEO_F746ZG)
defined(TARGET_DISCO_F429ZI) || defined(TARGET_NUCLEO_F746ZG) || \
defined(TARGET_DISCO_F746NG)
CAN can2(PB_5, PB_6);
#endif
char counter = 0;

View File

@ -20,7 +20,7 @@ CAN can1(P5_9, P5_10);
defined(TARGET_DISCO_F429ZI) || defined(TARGET_NUCLEO_F103RB) || \
defined(TARGET_NUCLEO_F746ZG)
CAN can1(PA_11, PA_12);
#elif defined(TARGET_DISCO_F469NI)
#elif defined(TARGET_DISCO_F469NI) || defined(TARGET_DISCO_F746NG)
CAN can1(PB_8, PB_9);
#endif

View File

@ -103,6 +103,7 @@ Wiring:
* DISCO_F4269ZI: (RX=PA_11, TX=PA_12)
* NUCLEO_F103RB: (RX=PA_11, TX=PA_12)
* NUCLEO_F746ZG: (RX=PA_11, TX=PA_12)
* DISCO_F746NG: (RX=PB_8, TX=PB_9)
"""
TESTS = [
@ -311,7 +312,8 @@ TESTS = [
"mcu": ["LPC1549", "LPC1768","B96B_F446VE", "VK_RZ_A1H",
"NUCLEO_F091RC", "NUCLEO_F072RB", "NUCLEO_F042K6", "NUCLEO_F334R8",
"NUCLEO_F303RE", "NUCLEO_F303K8", "NUCLEO_F302R8", "NUCLEO_F446RE",
"DISCO_F469NI", "DISCO_F429ZI", "NUCLEO_F103RB", "NUCLEO_F746ZG"],
"DISCO_F469NI", "DISCO_F429ZI", "NUCLEO_F103RB", "NUCLEO_F746ZG",
"DISCO_F746NG"]
},
{
"id": "MBED_BLINKY", "description": "Blinky",
@ -585,7 +587,7 @@ TESTS = [
"mcu": ["LPC1768", "LPC4088", "LPC1549", "RZ_A1H", "B96B_F446VE", "NUCLEO_F091RC",
"NUCLEO_F072RB", "NUCLEO_F042K6", "NUCLEO_F334R8", "NUCLEO_F303RE",
"NUCLEO_F303K8", "NUCLEO_F302R8", "NUCLEO_F446RE", "DISCO_F469NI",
"DISCO_F429ZI", "NUCLEO_F103RB", "NUCLEO_F746ZG"]
"DISCO_F429ZI", "NUCLEO_F103RB", "NUCLEO_F746ZG", "DISCO_F746NG"]
},
{
"id": "MBED_30", "description": "CAN network test using interrupts",
@ -594,7 +596,7 @@ TESTS = [
"mcu": ["LPC1768", "LPC4088", "LPC1549", "RZ_A1H", "B96B_F446VE", "NUCLEO_F091RC",
"NUCLEO_F072RB", "NUCLEO_F042K6", "NUCLEO_F334R8", "NUCLEO_F303RE",
"NUCLEO_F303K8", "NUCLEO_F302R8", "NUCLEO_F446RE", "DISCO_F469NI",
"DISCO_F429ZI", "NUCLEO_F103RB", "NUCLEO_F746ZG"]
"DISCO_F429ZI", "NUCLEO_F103RB", "NUCLEO_F746ZG", "DISCO_F746NG"]
},
{
"id": "MBED_31", "description": "PWM LED test",