Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[STM32F3xx] CAN development for STM32F3xx family #1762

Merged
merged 5 commits into from
Jun 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ typedef struct
#define I2C1 ((I2C_TypeDef *) I2C1_BASE)
#define I2C2 ((I2C_TypeDef *) I2C2_BASE)
#define I2C3 ((I2C_TypeDef *) I2C3_BASE)
#define CAN ((CAN_TypeDef *) CAN_BASE)
#define CAN1 ((CAN_TypeDef *) CAN_BASE)
#define PWR ((PWR_TypeDef *) PWR_BASE)
#define DAC ((DAC_TypeDef *) DAC_BASE)
#define DAC1 ((DAC_TypeDef *) DAC1_BASE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ typedef struct
#define USART2 ((USART_TypeDef *) USART2_BASE)
#define USART3 ((USART_TypeDef *) USART3_BASE)
#define I2C1 ((I2C_TypeDef *) I2C1_BASE)
#define CAN ((CAN_TypeDef *) CAN_BASE)
#define CAN1 ((CAN_TypeDef *) CAN_BASE)
#define PWR ((PWR_TypeDef *) PWR_BASE)
#define DAC1 ((DAC_TypeDef *) DAC1_BASE)
#define DAC2 ((DAC_TypeDef *) DAC2_BASE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ typedef struct
#define UART5 ((USART_TypeDef *) UART5_BASE)
#define I2C1 ((I2C_TypeDef *) I2C1_BASE)
#define I2C2 ((I2C_TypeDef *) I2C2_BASE)
#define CAN ((CAN_TypeDef *) CAN_BASE)
#define CAN1 ((CAN_TypeDef *) CAN_BASE)
#define PWR ((PWR_TypeDef *) PWR_BASE)
#define DAC ((DAC_TypeDef *) DAC_BASE)
#define DAC1 ((DAC_TypeDef *) DAC1_BASE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ typedef struct
#define USART2 ((USART_TypeDef *) USART2_BASE)
#define USART3 ((USART_TypeDef *) USART3_BASE)
#define I2C1 ((I2C_TypeDef *) I2C1_BASE)
#define CAN ((CAN_TypeDef *) CAN_BASE)
#define CAN1 ((CAN_TypeDef *) CAN_BASE)
#define PWR ((PWR_TypeDef *) PWR_BASE)
#define DAC1 ((DAC_TypeDef *) DAC1_BASE)
#define DAC2 ((DAC_TypeDef *) DAC2_BASE)
Expand Down
4 changes: 4 additions & 0 deletions hal/targets/hal/TARGET_STM/TARGET_STM32F3/PeripheralPins.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,8 @@ extern const PinMap PinMap_SPI_MISO[];
extern const PinMap PinMap_SPI_SCLK[];
extern const PinMap PinMap_SPI_SSEL[];

//*** CAN ***
extern const PinMap PinMap_CAN_RD[];
extern const PinMap PinMap_CAN_TD[];

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ typedef enum {
PWM_17 = (int)TIM17_BASE
} PWMName;

typedef enum {
CAN_1 = (int)CAN_BASE
} CANName;

#ifdef __cplusplus
}
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,15 @@ const PinMap PinMap_SPI_SSEL[] = {
{PF_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_CAN)}, // Not available in 32 pins package
{PA_11, CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN)},
{NC, NC, 0}
};

const PinMap PinMap_CAN_TD[] = {
// {PB_9 , CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN)}, // Not available in 32 pins package
{PA_12, CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN)},
{NC, NC, 0}
};
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@

#define DEVICE_SLEEP 1

#define DEVICE_CAN 1

//=======================================

#define DEVICE_SEMIHOST 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ struct pwmout_s {
uint32_t inverted;
};

struct can_s {
CANName can;
int index;
};

#include "gpio_object.h"

#ifdef __cplusplus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ typedef enum {
PWM_17 = (int)TIM17_BASE
} PWMName;

typedef enum {
CAN_1 = (int)CAN_BASE
} CANName;

#ifdef __cplusplus
}
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,13 @@ const PinMap PinMap_SPI_SSEL[] = {
{PA_15, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
{NC, NC, 0}
};

const PinMap PinMap_CAN_RD[] = {
{PA_11, CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN)},
{NC, NC, 0}
};

const PinMap PinMap_CAN_TD[] = {
{PA_12, CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN)},
{NC, NC, 0}
};
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@

#define DEVICE_SLEEP 1

#define DEVICE_CAN 1

//=======================================

#define DEVICE_SEMIHOST 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ struct pwmout_s {
uint32_t inverted;
};

struct can_s {
CANName can;
int index;
};

#include "gpio_object.h"

#ifdef __cplusplus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ typedef enum {
PWM_17 = (int)TIM17_BASE
} PWMName;

typedef enum {
CAN_1 = (int)CAN_BASE
} CANName;

#ifdef __cplusplus
}
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,3 +255,15 @@ const PinMap PinMap_SPI_SSEL[] = {
{PF_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_CAN)},
{PA_11, CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN)},
{NC, NC, 0}
};

const PinMap PinMap_CAN_TD[] = {
{PB_9 , CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN)},
{PA_12, CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN)},
{NC, NC, 0}
};
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@

#define DEVICE_SLEEP 1

#define DEVICE_CAN 1

//=======================================

#define DEVICE_SEMIHOST 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ struct pwmout_s {
uint32_t inverted;
};

struct can_s {
CANName can;
int index;
};

#include "gpio_object.h"

#ifdef __cplusplus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ typedef enum {
PWM_17 = (int)TIM17_BASE
} PWMName;

typedef enum {
CAN_1 = (int)CAN_BASE
} CANName;

#ifdef __cplusplus
}
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,3 +210,15 @@ const PinMap PinMap_SPI_SSEL[] = {
{PA_15, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
{NC, NC, 0}
};

const PinMap PinMap_CAN_RD[] = {
{PB_8 , CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN)},
{PA_11, CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN)},
{NC, NC, 0}
};

const PinMap PinMap_CAN_TD[] = {
{PB_9 , CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN)},
{PA_12, CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN)},
{NC, NC, 0}
};
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@

#define DEVICE_SLEEP 1

#define DEVICE_CAN 1

//=======================================

#define DEVICE_SEMIHOST 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ struct pwmout_s {
uint32_t inverted;
};

struct can_s {
CANName can;
int index;
};

#include "gpio_object.h"

#ifdef __cplusplus
Expand Down
Loading