mirror of https://github.com/ARMmbed/mbed-os.git
[DISCO_L476VG] Added CAN support
Added CAN API support for DISCO_L476VG target. *stm32l476xx.h* file was changed to avoid compilation errors. NOTE: MBED_29 or MBED_30 cannot be tested on this platform because CAN pins are soldered to USB, GYRO and others. Change-Id: I2e85bd36dc45872b1ab617f072de98164f2c96f8pull/1774/head
parent
7a262f1b2d
commit
155d38ef9e
|
@ -1336,7 +1336,6 @@ typedef struct
|
||||||
#define I2C1 ((I2C_TypeDef *) I2C1_BASE)
|
#define I2C1 ((I2C_TypeDef *) I2C1_BASE)
|
||||||
#define I2C2 ((I2C_TypeDef *) I2C2_BASE)
|
#define I2C2 ((I2C_TypeDef *) I2C2_BASE)
|
||||||
#define I2C3 ((I2C_TypeDef *) I2C3_BASE)
|
#define I2C3 ((I2C_TypeDef *) I2C3_BASE)
|
||||||
#define CAN ((CAN_TypeDef *) CAN1_BASE)
|
|
||||||
#define CAN1 ((CAN_TypeDef *) CAN1_BASE)
|
#define CAN1 ((CAN_TypeDef *) CAN1_BASE)
|
||||||
#define LPTIM1 ((LPTIM_TypeDef *) LPTIM1_BASE)
|
#define LPTIM1 ((LPTIM_TypeDef *) LPTIM1_BASE)
|
||||||
#define PWR ((PWR_TypeDef *) PWR_BASE)
|
#define PWR ((PWR_TypeDef *) PWR_BASE)
|
||||||
|
|
|
@ -83,6 +83,10 @@ typedef enum {
|
||||||
PWM_17 = (int)TIM17_BASE
|
PWM_17 = (int)TIM17_BASE
|
||||||
} PWMName;
|
} PWMName;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
CAN_1 = (int)CAN1_BASE
|
||||||
|
} CANName;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -234,3 +234,15 @@ const PinMap PinMap_SPI_SSEL[] = {
|
||||||
{PE_12, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
|
{PE_12, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
|
||||||
{NC, NC, 0}
|
{NC, NC, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const PinMap PinMap_CAN_RD[] = {
|
||||||
|
{PB_8 , 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)},
|
||||||
|
{NC, NC, 0}
|
||||||
|
};
|
||||||
|
|
||||||
|
const PinMap PinMap_CAN_TD[] = {
|
||||||
|
{PB_9 , 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)},
|
||||||
|
{NC, NC, 0}
|
||||||
|
};
|
||||||
|
|
|
@ -41,6 +41,8 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define DEVICE_CAN 1
|
||||||
|
|
||||||
//=======================================
|
//=======================================
|
||||||
|
|
||||||
#define DEVICE_ID_LENGTH 24
|
#define DEVICE_ID_LENGTH 24
|
||||||
|
|
|
@ -105,6 +105,12 @@ struct pwmout_s {
|
||||||
uint32_t inverted;
|
uint32_t inverted;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct can_s {
|
||||||
|
CANName can;
|
||||||
|
int index;
|
||||||
|
};
|
||||||
|
|
||||||
#include "gpio_object.h"
|
#include "gpio_object.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -65,7 +65,8 @@ int main() {
|
||||||
!defined(TARGET_NUCLEO_F091RC) && !defined(TARGET_NUCLEO_F072RB) && \
|
!defined(TARGET_NUCLEO_F091RC) && !defined(TARGET_NUCLEO_F072RB) && \
|
||||||
!defined(TARGET_NUCLEO_F042K6) && !defined(TARGET_NUCLEO_F334R8) && \
|
!defined(TARGET_NUCLEO_F042K6) && !defined(TARGET_NUCLEO_F334R8) && \
|
||||||
!defined(TARGET_NUCLEO_F303RE) && !defined(TARGET_NUCLEO_F303K8) && \
|
!defined(TARGET_NUCLEO_F303RE) && !defined(TARGET_NUCLEO_F303K8) && \
|
||||||
!defined(TARGET_NUCLEO_F302R8) && !defined(TARGET_NUCLEO_F103RB))
|
!defined(TARGET_NUCLEO_F302R8) && !defined(TARGET_NUCLEO_F103RB) && \
|
||||||
|
!defined(TARGET_DISCO_L476VG))
|
||||||
printf("loop()\n");
|
printf("loop()\n");
|
||||||
if(can2.read(msg)) {
|
if(can2.read(msg)) {
|
||||||
printmsg("Rx message:", &msg);
|
printmsg("Rx message:", &msg);
|
||||||
|
|
|
@ -60,7 +60,8 @@ void send() {
|
||||||
!defined(TARGET_NUCLEO_F091RC) && !defined(TARGET_NUCLEO_F072RB) && \
|
!defined(TARGET_NUCLEO_F091RC) && !defined(TARGET_NUCLEO_F072RB) && \
|
||||||
!defined(TARGET_NUCLEO_F042K6) && !defined(TARGET_NUCLEO_F334R8) && \
|
!defined(TARGET_NUCLEO_F042K6) && !defined(TARGET_NUCLEO_F334R8) && \
|
||||||
!defined(TARGET_NUCLEO_F303RE) && !defined(TARGET_NUCLEO_F303K8) && \
|
!defined(TARGET_NUCLEO_F303RE) && !defined(TARGET_NUCLEO_F303K8) && \
|
||||||
!defined(TARGET_NUCLEO_F302R8) && !defined(TARGET_NUCLEO_F103RB))
|
!defined(TARGET_NUCLEO_F302R8) && !defined(TARGET_NUCLEO_F103RB) && \
|
||||||
|
!defined(TARGET_DISCO_L476VG))
|
||||||
void read() {
|
void read() {
|
||||||
CANMessage msg;
|
CANMessage msg;
|
||||||
printf("rx()\n");
|
printf("rx()\n");
|
||||||
|
@ -78,7 +79,8 @@ int main() {
|
||||||
!defined(TARGET_NUCLEO_F091RC) && !defined(TARGET_NUCLEO_F072RB) && \
|
!defined(TARGET_NUCLEO_F091RC) && !defined(TARGET_NUCLEO_F072RB) && \
|
||||||
!defined(TARGET_NUCLEO_F042K6) && !defined(TARGET_NUCLEO_F334R8) && \
|
!defined(TARGET_NUCLEO_F042K6) && !defined(TARGET_NUCLEO_F334R8) && \
|
||||||
!defined(TARGET_NUCLEO_F303RE) && !defined(TARGET_NUCLEO_F303K8) && \
|
!defined(TARGET_NUCLEO_F303RE) && !defined(TARGET_NUCLEO_F303K8) && \
|
||||||
!defined(TARGET_NUCLEO_F302R8) && !defined(TARGET_NUCLEO_F103RB))
|
!defined(TARGET_NUCLEO_F302R8) && !defined(TARGET_NUCLEO_F103RB) && \
|
||||||
|
!defined(TARGET_DISCO_L476VG))
|
||||||
can2.attach(&read);
|
can2.attach(&read);
|
||||||
#endif
|
#endif
|
||||||
while(1) {
|
while(1) {
|
||||||
|
|
|
@ -18,7 +18,7 @@ CAN can1(P5_9, P5_10);
|
||||||
defined(TARGET_NUCLEO_F303RE) || defined(TARGET_NUCLEO_F303K8) || \
|
defined(TARGET_NUCLEO_F303RE) || defined(TARGET_NUCLEO_F303K8) || \
|
||||||
defined(TARGET_NUCLEO_F302R8) || defined(TARGET_NUCLEO_F446RE) || \
|
defined(TARGET_NUCLEO_F302R8) || defined(TARGET_NUCLEO_F446RE) || \
|
||||||
defined(TARGET_DISCO_F429ZI) || defined(TARGET_NUCLEO_F103RB) || \
|
defined(TARGET_DISCO_F429ZI) || defined(TARGET_NUCLEO_F103RB) || \
|
||||||
defined(TARGET_NUCLEO_F746ZG)
|
defined(TARGET_NUCLEO_F746ZG) || defined(TARGET_DISCO_L476VG)
|
||||||
CAN can1(PA_11, PA_12);
|
CAN can1(PA_11, PA_12);
|
||||||
#elif defined(TARGET_DISCO_F469NI) || defined(TARGET_DISCO_F746NG)
|
#elif defined(TARGET_DISCO_F469NI) || defined(TARGET_DISCO_F746NG)
|
||||||
CAN can1(PB_8, PB_9);
|
CAN can1(PB_8, PB_9);
|
||||||
|
|
|
@ -104,6 +104,7 @@ Wiring:
|
||||||
* NUCLEO_F103RB: (RX=PA_11, TX=PA_12)
|
* NUCLEO_F103RB: (RX=PA_11, TX=PA_12)
|
||||||
* NUCLEO_F746ZG: (RX=PA_11, TX=PA_12)
|
* NUCLEO_F746ZG: (RX=PA_11, TX=PA_12)
|
||||||
* DISCO_F746NG: (RX=PB_8, TX=PB_9)
|
* DISCO_F746NG: (RX=PB_8, TX=PB_9)
|
||||||
|
* DISCO_L476VG: (RX=PA_11, TX=PA_12)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
TESTS = [
|
TESTS = [
|
||||||
|
@ -313,7 +314,7 @@ TESTS = [
|
||||||
"NUCLEO_F091RC", "NUCLEO_F072RB", "NUCLEO_F042K6", "NUCLEO_F334R8",
|
"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", "DISCO_F429ZI", "NUCLEO_F103RB", "NUCLEO_F746ZG",
|
"DISCO_F469NI", "DISCO_F429ZI", "NUCLEO_F103RB", "NUCLEO_F746ZG",
|
||||||
"DISCO_F746NG"]
|
"DISCO_F746NG", "DISCO_L476VG"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "MBED_BLINKY", "description": "Blinky",
|
"id": "MBED_BLINKY", "description": "Blinky",
|
||||||
|
|
Loading…
Reference in New Issue