Go to the documentation of this file.
31 #ifndef CANDEV_STM32_H
32 #define CANDEV_STM32_H
40 #if defined(CPU_LINE_STM32F413xx) || defined(CPU_LINE_STM32F423xx)
41 #define CANDEV_STM32_CHAN_NUMOF 3
42 #elif defined(CPU_FAM_STM32F1) || defined(CPU_FAM_STM32F2) || defined(CPU_FAM_STM32F4)
43 #define CANDEV_STM32_CHAN_NUMOF 2
44 #elif defined(CPU_FAM_STM32F0) || defined(CPU_FAM_STM32F3) || \
45 defined(CPU_FAM_STM32L4) || DOXYGEN
47 #define CANDEV_STM32_CHAN_NUMOF 1
49 #error "CAN STM32: CPU not supported"
56 #if defined(CPU_FAM_STM32F1)
57 #define ISR_CAN1_TX isr_usb_hp_can1_tx
58 #define ISR_CAN1_RX0 isr_usb_lp_can1_rx0
59 #define ISR_CAN1_RX1 isr_can1_rx1
60 #define ISR_CAN1_SCE isr_can1_sce
62 #define ISR_CAN1_TX isr_can1_tx
63 #define ISR_CAN1_RX0 isr_can1_rx0
64 #define ISR_CAN1_RX1 isr_can1_rx1
65 #define ISR_CAN1_SCE isr_can1_sce
66 #define ISR_CAN2_TX isr_can2_tx
67 #define ISR_CAN2_RX0 isr_can2_rx0
68 #define ISR_CAN2_RX1 isr_can2_rx1
69 #define ISR_CAN2_SCE isr_can2_sce
70 #define ISR_CAN3_TX isr_can3_tx
71 #define ISR_CAN3_RX0 isr_can3_rx0
72 #define ISR_CAN3_RX1 isr_can3_rx1
73 #define ISR_CAN3_SCE isr_can3_sce
77 #if CANDEV_STM32_CHAN_NUMOF > 1 || DOXYGEN
79 #define CAN_STM32_NB_FILTER 28
81 #define CAN_STM32_NB_FILTER 14
84 #ifndef CANDEV_STM32_DEFAULT_BITRATE
86 #define CANDEV_STM32_DEFAULT_BITRATE 500000U
89 #ifndef CANDEV_STM32_DEFAULT_SPT
91 #define CANDEV_STM32_DEFAULT_SPT 875
100 #ifndef CPU_FAM_STM32F1
103 #if CANDEV_STM32_CHAN_NUMOF > 1 || defined(DOXYGEN)
114 #if defined(CPU_FAM_STM32F0)
132 #define HAVE_CAN_CONF_T
135 #define CAN_STM32_TX_MAILBOXES 3
137 #define CAN_STM32_RX_MAILBOXES 2
140 #ifndef CAN_STM32_RX_MAIL_FIFO
142 #define CAN_STM32_RX_MAIL_FIFO 12
178 #ifndef CPU_FAM_STM32F1
This structure holds anything related to the receive part.
#define CAN_STM32_RX_MAIL_FIFO
This is the maximum number of frame the driver can receive simultaneously.
uint32_t rcc_mask
RCC mask to enable clock.
int read_idx
Read index in the receive FIFO.
candev_stm32_isr_t isr_flags
ISR flags.
CAN_TypeDef * can_master
Master CAN device.
Structure to hold driver state.
uint8_t awum
Automatic wakeup mode.
uint8_t first_filter
First filter in the bank.
uint8_t tx_irqn
TX IRQ channel.
int isr_rx
Rx FIFO interrupt.
gpio_af_t
Available MUX values for configuring a pin's alternate function.
uint8_t rx1_irqn
RX1 IRQ channel.
struct candev_stm32_isr candev_stm32_isr_t
Internal interrupt flags.
const struct can_frame * tx_mailbox[CAN_STM32_TX_MAILBOXES]
Tx mailboxes.
int write_idx
Write index in the receive FIFO.
CAN_TypeDef * can
CAN device.
int isr_wkup
Wake up interrupt.
uint8_t rx0_irqn
RX0 IRQ channel.
uint8_t ttcm
Time triggered communication mode.
uint8_t nart
No automatic retransmission.
#define CAN_STM32_TX_MAILBOXES
The number of transmit mailboxes.
int isr_tx
Tx mailboxes interrupt.
uint8_t txfp
Transmit FIFO priority.
uint32_t master_rcc_mask
Master device RCC mask.
candev_stm32_rx_fifo_t rx_fifo
Rx FIFOs.
uint8_t sce_irqn
SCE IRQ channel.
Controller Area Network frame.
ESP CAN device configuration.
int is_full
Flag set when the FIFO is full.
Definitions for low-level CAN driver interface.
uint8_t nb_filters
Number of filters to use.
Internal interrupt flags.
gpio_af_t af
Alternate pin function to use.
gpio_t tx_pin
CAN transceiver TX pin.
struct candev_conf can_conf_t
Linux candev configuration.
struct can_frame frame[CAN_STM32_RX_MAIL_FIFO]
Receive FIFO.
uint8_t rflm
Receive FIFO locked mode.
gpio_t rx_pin
CAN transceiver RX pin.
gpio_af_t af
Alternate pin function to use.
Low level device structure for ESP32 CAN (extension of candev_t)
struct candev_stm32_rx_fifo candev_stm32_rx_fifo_t
This structure holds anything related to the receive part.
const can_conf_t * conf
Configuration.
uint8_t abom
Automatic bus-off management.
uint8_t lbkm
Loopback mode.
void candev_stm32_set_pins(can_t *dev, gpio_t tx_pin, gpio_t rx_pin, gpio_af_t af)
Set the pins of an stm32 CAN device.
candev_t candev
candev base structure