Skip to content

Commit bd0417c

Browse files
committed
Merge pull request #1520 from adustm/b_b96b_can
[STM B96B_F446VE] Add CAN feature
2 parents 121804a + 20c34f4 commit bd0417c

File tree

12 files changed

+584
-10
lines changed

12 files changed

+584
-10
lines changed

libraries/mbed/hal/can_api.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* mbed Microcontroller Library
2-
* Copyright (c) 2006-2013 ARM Limited
2+
* Copyright (c) 2006-2016 ARM Limited
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

libraries/mbed/targets/hal/TARGET_STM/TARGET_STM32F4/PeripheralPins.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,8 @@ extern const PinMap PinMap_SPI_MISO[];
6565
extern const PinMap PinMap_SPI_SCLK[];
6666
extern const PinMap PinMap_SPI_SSEL[];
6767

68+
//*** CAN ***
69+
extern const PinMap PinMap_CAN_RD[];
70+
extern const PinMap PinMap_CAN_TD[];
71+
6872
#endif

libraries/mbed/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_B96B_F446VE/PeripheralNames.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ extern "C" {
3838

3939
typedef enum {
4040
ADC_1 = (int)ADC1_BASE,
41-
ADC_3 = (int)ADC3_BASE,
41+
ADC_3 = (int)ADC3_BASE
4242
} ADCName;
4343

4444
typedef enum {
@@ -92,6 +92,11 @@ typedef enum {
9292
PWM_14 = (int)TIM14_BASE
9393
} PWMName;
9494

95+
typedef enum {
96+
CAN_1 = (int)CAN1_BASE,
97+
CAN_2 = (int)CAN2_BASE
98+
} CANName;
99+
95100
#ifdef __cplusplus
96101
}
97102
#endif

libraries/mbed/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_B96B_F446VE/PeripheralPins.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,3 +288,24 @@ const PinMap PinMap_SPI_SSEL[] = {
288288
{PE_11, SPI_4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)},
289289
{NC, NC, 0}
290290
};
291+
292+
//*** CAN ***
293+
294+
const PinMap PinMap_CAN_RD[] = {
295+
// {PA_11, CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)}, // unsolder JP73 to use it
296+
// {PB_5 , CAN_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN2)}, // unsolder JP36 to use it
297+
// {PB_8, CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)}, // connected to MEMs
298+
// {PB_12, CAN_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN2)},
299+
{PD_0, CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)},
300+
{NC, NC, 0}
301+
};
302+
303+
const PinMap PinMap_CAN_TD[] = {
304+
// {PA_12, CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)}, // unsolder JP74 to use it
305+
// {PB_6 , CAN_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN2)}, // unsolder JP43 to use it
306+
// {PB_9, CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)}, // connected to MEMs
307+
// {PB_13, CAN_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN2)},
308+
{PD_1, CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)},
309+
{NC, NC, 0}
310+
};
311+

libraries/mbed/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_B96B_F446VE/PinNames.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ typedef enum {
120120
PC_15 = 0x2F,
121121

122122
PD_0 = 0x30,
123-
PD_1 = 0x31,
123+
PD_1 = 0x31,
124124
PD_2 = 0x32,
125125
PD_3 = 0x33,
126126
PD_4 = 0x34,

libraries/mbed/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_B96B_F446VE/device.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@
5757

5858
#define DEVICE_SLEEP 1
5959

60+
#define DEVICE_CAN 1
61+
6062
//=======================================
6163

6264
#define DEVICE_SEMIHOST 0

libraries/mbed/targets/hal/TARGET_STM/TARGET_STM32F4/TARGET_B96B_F446VE/objects.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ struct pwmout_s {
111111
uint8_t inverted;
112112
};
113113

114+
struct can_s {
115+
CANName can;
116+
int index; // Used by irq
117+
};
118+
114119
#include "gpio_object.h"
115120

116121
#ifdef __cplusplus

0 commit comments

Comments
 (0)