HPM SDK
HPMicro Software Development Kit
hpm_mcan_drv.c File Reference
#include "hpm_mcan_drv.h"
#include <string.h>
#include <assert.h>

Data Structures

struct  mcan_bit_timing_table_struct
 MCAN bit timing table. More...
 

Macros

#define MCAN_CAN_BAUDRATE_DEFAULT   (500UL * 1000UL)
 
#define MCAN_CANFD_BAUDRATE_DEFAULT   (2UL * 1000UL * 1000UL)
 
#define MCAN_STD_FILTER_ELEM_CNT_MAX   (128U)
 
#define MCAN_EXT_FILTER_ELEM_CNT_MAX   (64U)
 
#define MCAN_RXFIFO_ELEM_CNT_MAX   (64U)
 
#define MCAN_RXBUF_ELEM_CNT_MAX   (64U)
 
#define MCAN_TXEVT_FIFO_ELEM_CNT_MAX   (32U)
 
#define MCAN_TXBUF_ELEM_CNT_MAX   (32U)
 
#define NUM_TQ_SYNC_SEG   (1U)
 
#define TSEG1_MIN_FOR_CAN2_0   (2U)
 CAN2.0 Timing related definitions. More...
 
#define TSEG1_MAX_FOR_CAN2_0   (256U)
 
#define TSEG2_MIN_FOR_CAN2_0   (2U)
 
#define TSEG2_MAX_FOR_CAN2_0   (128U)
 
#define TSJW_MIN_FOR_CAN2_0   (1U)
 
#define TSJW_MAX_FOR_CAN2_0   (128U)
 
#define PRESCALER_MIN_FOR_CAN2_0   (1U)
 
#define PRESCALER_MAX_FOR_CAN2_0   (512U)
 
#define NUM_TQ_MIN_FOR_CAN2_0   (8U)
 
#define NUM_TQ_MAX_FOR_CAN2_0   (TSEG1_MAX_FOR_CAN2_0 + TSEG2_MAX_FOR_CAN2_0)
 
#define TSEG1_MIN_FOR_CANFD_NOMINAL   (2U)
 CANFD Nominal Timing related definitions. More...
 
#define TSEG1_MAX_FOR_CANFD_NOMINAL   (256U)
 
#define TSEG2_MIN_FOR_CANFD_NOMINAL   (1U)
 
#define TSEG2_MAX_FOR_CANFD_NOMINAL   (32U)
 
#define TSJW_MIN_FOR_CANFD_NOMINAL   (1U)
 
#define TSJW_MAX_FOR_CANFD_NOMINAL   (128U)
 
#define NUM_TQ_MIN_FOR_CANFD_NOMINAL   (8U)
 
#define NUM_TQ_MAX_FOR_CANFD_NOMINAL   (TSEG1_MAX_FOR_CANFD_NOMINAL + TSEG2_MAX_FOR_CANFD_NOMINAL)
 
#define PRESCALER_MIN_FOR_CANFD_NOMINAL   (1U)
 
#define PRESCALER_MAX_FOR_CANFD_NOMINAL   (512U)
 
#define TSEG1_MIN_FOR_CANFD_DATA   (2U)
 CANFD Data Timing related definitions. More...
 
#define TSEG1_MAX_FOR_CANFD_DATA   (31U)
 
#define TSEG2_MIN_FOR_CANFD_DATA   (0U)
 
#define TSEG2_MAX_FOR_CANFD_DATA   (15U)
 
#define TSJW_MIN_FOR_CANFD_DATA   (0U)
 
#define TSJW_MAX_FOR_CANFD_DATA   (15U)
 
#define PRESCALER_MIN_FOR_CANFD_DATA   (1U)
 
#define PRESCALER_MAX_FOR_CANFD_DATA   (32U)
 
#define NUM_TQ_MIN_FOR_CANFD_DATA   (8U)
 
#define NUM_TQ_MAX_FOR_CANFD_DATA   (TSEG1_MAX_FOR_CANFD_DATA + TSEG2_MAX_FOR_CANFD_DATA)
 
#define MIN_TQ_MUL_PRESCALE   (8U)
 
#define NUM_PRESCALE_MAX   (256U)
 
#define CAN_SAMPLEPOINT_MIN   (750U)
 
#define CAN_SAMPLEPOINT_MAX   (875U)
 
#define MCAN_RAM_ADDR_INVALID   ((1UL << 16) - 1U)
 
#define MCAN_MAX_TDC_OFFSET   ((uint32_t)(MCAN_TDCR_TDCO_MASK >> MCAN_TDCR_TDCO_SHIFT))
 
#define MCAN_MAX_TDC_FILTER_WIN   ((uint32_t)(MCAN_TDCR_TDCF_MASK >> MCAN_TDCR_TDCF_SHIFT))
 

Typedefs

typedef struct mcan_bit_timing_table_struct mcan_bit_timing_table_t
 MCAN bit timing table. More...
 

Functions

static void mcan_set_can_nominal_bit_timing (MCAN_Type *ptr, const mcan_bit_timing_param_t *bit_timing)
 Set Nominal Bit timing. More...
 
static void mcan_set_can_data_bit_timing (MCAN_Type *ptr, const mcan_bit_timing_param_t *bit_timing)
 Set CANFD Data Bit timing. More...
 
static uint32_t mcan_find_optimal_prescaler (uint32_t num_tq_mul_prescaler, uint32_t start_prescaler, uint32_t max_tq, uint32_t min_tq)
 Calculate the closest prescaler. More...
 
static hpm_stat_t mcan_calc_bit_timing_from_baudrate (uint32_t src_clk_freq, mcan_bit_timing_option_t option, uint32_t baudrate, uint16_t samplepoint_min, uint16_t samplepoint_max, mcan_bit_timing_param_t *timing_param)
 Calculate Bit timing from baudrate. More...
 
static hpm_stat_t mcan_set_bit_timing_from_baudrate (MCAN_Type *ptr, mcan_bit_timing_option_t option, uint32_t src_clk_freq, uint32_t baudrate, uint16_t samplepoint_min, uint16_t samplepoint_max)
 Set MCAN bit timing from Baudrate. More...
 
static hpm_stat_t mcan_set_tsu (MCAN_Type *ptr, mcan_tsu_config_t *config)
 Configure MCAN TSU. More...
 
static hpm_stat_t mcan_set_internal_timestamp (MCAN_Type *ptr, mcan_internal_timestamp_config_t *config)
 Configure MCAN internal timestamp. More...
 
static bool is_mcan_bit_timing_param_valid (mcan_bit_timing_option_t option, const mcan_bit_timing_param_t *param)
 Check whether the MCAN bit timing parameter is valid. More...
 
void mcan_get_default_ram_config (MCAN_Type *ptr, mcan_ram_config_t *simple_config, bool enable_canfd)
 Get Default MCAN RAM configuration If the device is configured as classic CAN node, the default CAN RAM settings are as below: More...
 
void mcan_get_default_ram_flexible_config (MCAN_Type *ptr, mcan_ram_flexible_config_t *ram_config, bool enable_canfd)
 Get Default Full MCAN RAM configuration If the device is configured as classic CAN node, the default CAN RAM settings are as below: More...
 
void mcan_get_default_config (MCAN_Type *ptr, mcan_config_t *config)
 Get Default CAN configuration. More...
 
static void mcan_config_rxfifo (MCAN_Type *ptr, uint32_t index, uint32_t reg_val)
 
hpm_stat_t mcan_config_ram (MCAN_Type *ptr, mcan_ram_config_t *config)
 Configure MCAN RAM will Simplified RAM configuration. More...
 
hpm_stat_t mcan_config_ram_with_flexible_config (MCAN_Type *ptr, mcan_ram_flexible_config_t *config)
 Configure MCAN RAM will Full RAM configuration. More...
 
hpm_stat_t mcan_config_all_filters (MCAN_Type *ptr, mcan_all_filters_config_t *config)
 Configure All CAN filters. More...
 
hpm_stat_t mcan_init (MCAN_Type *ptr, mcan_config_t *config, uint32_t src_clk_freq)
 Initialize CAN controller. More...
 
void mcan_deinit (MCAN_Type *ptr)
 De-Initialize CAN controller. More...
 
hpm_stat_t mcan_set_filter_element (MCAN_Type *ptr, const mcan_filter_elem_t *filter_elem, uint32_t index)
 Set CAN filter element. More...
 
static uint32_t mcan_get_rxfifo0_base (MCAN_Type *ptr)
 
static uint32_t mcan_get_rxfifo1_base (MCAN_Type *ptr)
 
static uint32_t mcan_get_rxbuf_elem_addr (MCAN_Type *ptr, uint32_t index)
 
static uint32_t mcan_get_txbuf_elem_addr (MCAN_Type *ptr, uint32_t index)
 
uint8_t mcan_get_message_size_from_dlc (uint8_t dlc)
 Get message Size from Data Length Code. More...
 
uint8_t mcan_get_data_field_size (uint8_t data_field_size_option)
 Get the Data field size from data field size option. More...
 
hpm_stat_t mcan_write_txbuf (MCAN_Type *ptr, uint32_t index, mcan_tx_frame_t *tx_frame)
 Write Frame to CAN TX Buffer. More...
 
hpm_stat_t mcan_write_txfifo (MCAN_Type *ptr, mcan_tx_frame_t *tx_frame)
 Write Frame CAN to TXFIFO. More...
 
hpm_stat_t mcan_read_rxbuf (MCAN_Type *ptr, uint32_t index, mcan_rx_message_t *rx_frame)
 Read message from CAN RXBUF. More...
 
hpm_stat_t mcan_read_rxfifo (MCAN_Type *ptr, uint32_t fifo_index, mcan_rx_message_t *rx_frame)
 Read message from CAN RXBUF. More...
 
hpm_stat_t mcan_read_tx_evt_fifo (MCAN_Type *ptr, mcan_tx_event_fifo_elem_t *tx_evt)
 Read TX Event from CAN TX EVENT FIFO. More...
 
hpm_stat_t mcan_transmit_via_txbuf_nonblocking (MCAN_Type *ptr, uint32_t index, mcan_tx_frame_t *tx_frame)
 Transmit CAN message via TX in non-blocking way. More...
 
hpm_stat_t mcan_transmit_blocking (MCAN_Type *ptr, mcan_tx_frame_t *tx_frame)
 Transmit CAN message in blocking way. More...
 
hpm_stat_t mcan_request_and_fill_txfifo (MCAN_Type *ptr, mcan_tx_frame_t *tx_frame, uint32_t *fifo_index)
 Request TXFIFO and fill data into TXFIFO. More...
 
hpm_stat_t mcan_transmit_via_txfifo_nonblocking (MCAN_Type *ptr, mcan_tx_frame_t *tx_frame, uint32_t *fifo_index)
 Transmit CAN message via TX FIFO in non-blocking way. More...
 
hpm_stat_t mcan_receive_from_buf_blocking (MCAN_Type *ptr, uint32_t index, mcan_rx_message_t *rx_frame)
 Receive CAN Frame from RXBUF in blocking way. More...
 
hpm_stat_t mcan_receive_from_fifo_blocking (MCAN_Type *ptr, uint32_t fifo_index, mcan_rx_message_t *rx_frame)
 Receive CAN Frame from RXFIFO in blocking way. More...
 
void mcan_get_high_priority_message_status (MCAN_Type *ptr, mcan_high_priority_message_status_t *status)
 Get High Priority Message Status. More...
 
hpm_stat_t mcan_set_global_filter_config (MCAN_Type *ptr, mcan_global_filter_config_t *filter_config)
 Configure Global Filter. More...
 
hpm_stat_t mcan_config_transmitter_delay_compensation (MCAN_Type *ptr, mcan_tdc_config_t *config)
 Configure Transmitter Delay Compensation. More...
 
uint32_t mcan_read_32bit_tsu_timestamp (MCAN_Type *ptr, uint32_t index)
 Read 32bit Timestamp value from TSU. More...
 
uint64_t mcan_read_64bit_tsu_timestamp (MCAN_Type *ptr, uint32_t index)
 Read 64bit Timestamp value from TSU. More...
 
hpm_stat_t mcan_get_timestamp_from_tx_event (MCAN_Type *ptr, const mcan_tx_event_fifo_elem_t *tx_evt, mcan_timestamp_value_t *timestamp)
 Get Timestamp from MCAN TX Event. More...
 
hpm_stat_t mcan_get_timestamp_from_received_message (MCAN_Type *ptr, const mcan_rx_message_t *rx_msg, mcan_timestamp_value_t *timestamp)
 Get Timestamp from MCAN RX frame. More...
 
hpm_stat_t mcan_parse_protocol_status (uint32_t psr, mcan_protocol_status_t *protocol_status)
 Parse the Protocol Status register value. More...
 
hpm_stat_t mcan_get_protocol_status (MCAN_Type *ptr, mcan_protocol_status_t *protocol_status)
 Get MCAN Protocol Status. More...
 

Variables

static const mcan_bit_timing_table_t k_mcan_bit_timing_tbl [3]
 
static const mcan_filter_elem_t k_default_std_id_filter
 
static const mcan_filter_elem_t k_default_ext_id_filter
 

Macro Definition Documentation

◆ CAN_SAMPLEPOINT_MAX

#define CAN_SAMPLEPOINT_MAX   (875U)

◆ CAN_SAMPLEPOINT_MIN

#define CAN_SAMPLEPOINT_MIN   (750U)

◆ MCAN_CAN_BAUDRATE_DEFAULT

#define MCAN_CAN_BAUDRATE_DEFAULT   (500UL * 1000UL)

Default CAN2.0 baudrate:500 kbps

◆ MCAN_CANFD_BAUDRATE_DEFAULT

#define MCAN_CANFD_BAUDRATE_DEFAULT   (2UL * 1000UL * 1000UL)

Default CANFD baudrate: 2 Mbps

◆ MCAN_EXT_FILTER_ELEM_CNT_MAX

#define MCAN_EXT_FILTER_ELEM_CNT_MAX   (64U)

◆ MCAN_MAX_TDC_FILTER_WIN

#define MCAN_MAX_TDC_FILTER_WIN   ((uint32_t)(MCAN_TDCR_TDCF_MASK >> MCAN_TDCR_TDCF_SHIFT))

◆ MCAN_MAX_TDC_OFFSET

#define MCAN_MAX_TDC_OFFSET   ((uint32_t)(MCAN_TDCR_TDCO_MASK >> MCAN_TDCR_TDCO_SHIFT))

◆ MCAN_RAM_ADDR_INVALID

#define MCAN_RAM_ADDR_INVALID   ((1UL << 16) - 1U)

◆ MCAN_RXBUF_ELEM_CNT_MAX

#define MCAN_RXBUF_ELEM_CNT_MAX   (64U)

◆ MCAN_RXFIFO_ELEM_CNT_MAX

#define MCAN_RXFIFO_ELEM_CNT_MAX   (64U)

◆ MCAN_STD_FILTER_ELEM_CNT_MAX

#define MCAN_STD_FILTER_ELEM_CNT_MAX   (128U)

◆ MCAN_TXBUF_ELEM_CNT_MAX

#define MCAN_TXBUF_ELEM_CNT_MAX   (32U)

◆ MCAN_TXEVT_FIFO_ELEM_CNT_MAX

#define MCAN_TXEVT_FIFO_ELEM_CNT_MAX   (32U)

◆ MIN_TQ_MUL_PRESCALE

#define MIN_TQ_MUL_PRESCALE   (8U)

◆ NUM_PRESCALE_MAX

#define NUM_PRESCALE_MAX   (256U)

◆ NUM_TQ_MAX_FOR_CAN2_0

#define NUM_TQ_MAX_FOR_CAN2_0   (TSEG1_MAX_FOR_CAN2_0 + TSEG2_MAX_FOR_CAN2_0)

◆ NUM_TQ_MAX_FOR_CANFD_DATA

#define NUM_TQ_MAX_FOR_CANFD_DATA   (TSEG1_MAX_FOR_CANFD_DATA + TSEG2_MAX_FOR_CANFD_DATA)

◆ NUM_TQ_MAX_FOR_CANFD_NOMINAL

#define NUM_TQ_MAX_FOR_CANFD_NOMINAL   (TSEG1_MAX_FOR_CANFD_NOMINAL + TSEG2_MAX_FOR_CANFD_NOMINAL)

◆ NUM_TQ_MIN_FOR_CAN2_0

#define NUM_TQ_MIN_FOR_CAN2_0   (8U)

◆ NUM_TQ_MIN_FOR_CANFD_DATA

#define NUM_TQ_MIN_FOR_CANFD_DATA   (8U)

◆ NUM_TQ_MIN_FOR_CANFD_NOMINAL

#define NUM_TQ_MIN_FOR_CANFD_NOMINAL   (8U)

◆ NUM_TQ_SYNC_SEG

#define NUM_TQ_SYNC_SEG   (1U)

◆ PRESCALER_MAX_FOR_CAN2_0

#define PRESCALER_MAX_FOR_CAN2_0   (512U)

◆ PRESCALER_MAX_FOR_CANFD_DATA

#define PRESCALER_MAX_FOR_CANFD_DATA   (32U)

◆ PRESCALER_MAX_FOR_CANFD_NOMINAL

#define PRESCALER_MAX_FOR_CANFD_NOMINAL   (512U)

◆ PRESCALER_MIN_FOR_CAN2_0

#define PRESCALER_MIN_FOR_CAN2_0   (1U)

◆ PRESCALER_MIN_FOR_CANFD_DATA

#define PRESCALER_MIN_FOR_CANFD_DATA   (1U)

◆ PRESCALER_MIN_FOR_CANFD_NOMINAL

#define PRESCALER_MIN_FOR_CANFD_NOMINAL   (1U)

◆ TSEG1_MAX_FOR_CAN2_0

#define TSEG1_MAX_FOR_CAN2_0   (256U)

◆ TSEG1_MAX_FOR_CANFD_DATA

#define TSEG1_MAX_FOR_CANFD_DATA   (31U)

◆ TSEG1_MAX_FOR_CANFD_NOMINAL

#define TSEG1_MAX_FOR_CANFD_NOMINAL   (256U)

◆ TSEG1_MIN_FOR_CAN2_0

#define TSEG1_MIN_FOR_CAN2_0   (2U)

CAN2.0 Timing related definitions.

◆ TSEG1_MIN_FOR_CANFD_DATA

#define TSEG1_MIN_FOR_CANFD_DATA   (2U)

CANFD Data Timing related definitions.

◆ TSEG1_MIN_FOR_CANFD_NOMINAL

#define TSEG1_MIN_FOR_CANFD_NOMINAL   (2U)

CANFD Nominal Timing related definitions.

◆ TSEG2_MAX_FOR_CAN2_0

#define TSEG2_MAX_FOR_CAN2_0   (128U)

◆ TSEG2_MAX_FOR_CANFD_DATA

#define TSEG2_MAX_FOR_CANFD_DATA   (15U)

◆ TSEG2_MAX_FOR_CANFD_NOMINAL

#define TSEG2_MAX_FOR_CANFD_NOMINAL   (32U)

◆ TSEG2_MIN_FOR_CAN2_0

#define TSEG2_MIN_FOR_CAN2_0   (2U)

◆ TSEG2_MIN_FOR_CANFD_DATA

#define TSEG2_MIN_FOR_CANFD_DATA   (0U)

◆ TSEG2_MIN_FOR_CANFD_NOMINAL

#define TSEG2_MIN_FOR_CANFD_NOMINAL   (1U)

◆ TSJW_MAX_FOR_CAN2_0

#define TSJW_MAX_FOR_CAN2_0   (128U)

◆ TSJW_MAX_FOR_CANFD_DATA

#define TSJW_MAX_FOR_CANFD_DATA   (15U)

◆ TSJW_MAX_FOR_CANFD_NOMINAL

#define TSJW_MAX_FOR_CANFD_NOMINAL   (128U)

◆ TSJW_MIN_FOR_CAN2_0

#define TSJW_MIN_FOR_CAN2_0   (1U)

◆ TSJW_MIN_FOR_CANFD_DATA

#define TSJW_MIN_FOR_CANFD_DATA   (0U)

◆ TSJW_MIN_FOR_CANFD_NOMINAL

#define TSJW_MIN_FOR_CANFD_NOMINAL   (1U)

Typedef Documentation

◆ mcan_bit_timing_table_t

MCAN bit timing table.

Function Documentation

◆ is_mcan_bit_timing_param_valid()

static bool is_mcan_bit_timing_param_valid ( mcan_bit_timing_option_t  option,
const mcan_bit_timing_param_t param 
)
static

Check whether the MCAN bit timing parameter is valid.

Parameters
[in]optionMCAN bit timing option
[in]paramMCAN bit timing parameter
Return values
trueMCAN bit timing parameter is valid
falseMCAN bit timing parameter is invalid

◆ mcan_calc_bit_timing_from_baudrate()

static hpm_stat_t mcan_calc_bit_timing_from_baudrate ( uint32_t  src_clk_freq,
mcan_bit_timing_option_t  option,
uint32_t  baudrate,
uint16_t  samplepoint_min,
uint16_t  samplepoint_max,
mcan_bit_timing_param_t timing_param 
)
static

Calculate Bit timing from baudrate.

Parameters
[in]src_clk_freqCAN IP clock used for generating bit timing
[in]optionCAN bit timing option
[in]baudrateCAN baudrate in bps
[in]samplepoint_minMinimum sample point, value = actual sample point * 1000
[in]samplepoint_maxMaximum sample point, value = actual sample point * 1000
[out]timing_paramCalculated Bit timing parameter
Return values
status_successif no errors happened
status_invalid_argumentif the timing parameters cannot be calculated from specified baudrate

◆ mcan_config_rxfifo()

static void mcan_config_rxfifo ( MCAN_Type ptr,
uint32_t  index,
uint32_t  reg_val 
)
static

◆ mcan_find_optimal_prescaler()

static uint32_t mcan_find_optimal_prescaler ( uint32_t  num_tq_mul_prescaler,
uint32_t  start_prescaler,
uint32_t  max_tq,
uint32_t  min_tq 
)
static

Calculate the closest prescaler.

Parameters
[in]num_tq_mul_prescalerNumber of TQ * Prescaler
[in]start_prescalerStart of Prescaler value
[in]max_tqMaximum Timing Quantum
[in]min_tqMinimum Timing Quantum
Returns
Calculated prescaler value

◆ mcan_get_rxbuf_elem_addr()

static uint32_t mcan_get_rxbuf_elem_addr ( MCAN_Type ptr,
uint32_t  index 
)
static

◆ mcan_get_rxfifo0_base()

static uint32_t mcan_get_rxfifo0_base ( MCAN_Type ptr)
static

◆ mcan_get_rxfifo1_base()

static uint32_t mcan_get_rxfifo1_base ( MCAN_Type ptr)
static

◆ mcan_get_txbuf_elem_addr()

static uint32_t mcan_get_txbuf_elem_addr ( MCAN_Type ptr,
uint32_t  index 
)
static

◆ mcan_set_bit_timing_from_baudrate()

static hpm_stat_t mcan_set_bit_timing_from_baudrate ( MCAN_Type ptr,
mcan_bit_timing_option_t  option,
uint32_t  src_clk_freq,
uint32_t  baudrate,
uint16_t  samplepoint_min,
uint16_t  samplepoint_max 
)
static

Set MCAN bit timing from Baudrate.

Parameters
[in]ptrMCAN base
[in]optionMCAN bit timing option
[in]src_clk_freqCAN IP clock used for generating bit timing
[in]baudrateBaudrate in bps
[in]samplepoint_minMinimum sample point, value = actual sample point * 1000
[in]samplepoint_maxMaximum sample point, value = actual sample point * 1000
Return values
status_successif no errors happened
status_invalid_argumentif the timing parameters cannot be calculated from specified baudrate

◆ mcan_set_can_data_bit_timing()

static void mcan_set_can_data_bit_timing ( MCAN_Type ptr,
const mcan_bit_timing_param_t bit_timing 
)
static

Set CANFD Data Bit timing.

Parameters
[in]ptrMCAN base
[in]bit_timingBit timing parameter

◆ mcan_set_can_nominal_bit_timing()

static void mcan_set_can_nominal_bit_timing ( MCAN_Type ptr,
const mcan_bit_timing_param_t bit_timing 
)
static

Set Nominal Bit timing.

Parameters
[in]ptrMCAN base
[in]bit_timingBit timing parameter

◆ mcan_set_internal_timestamp()

static hpm_stat_t mcan_set_internal_timestamp ( MCAN_Type ptr,
mcan_internal_timestamp_config_t config 
)
static

Configure MCAN internal timestamp.

Parameters
[in]ptrMCAN base
[in]configInternal Timestamp Configuration
Return values
status_successif no errors happened
status_invalid_argumentif any parameters are invalid

◆ mcan_set_tsu()

static hpm_stat_t mcan_set_tsu ( MCAN_Type ptr,
mcan_tsu_config_t config 
)
static

Configure MCAN TSU.

Parameters
[in]ptrMCAN base
[in]configTSU configuration
Return values
status_successif no errors happened
status_invalid_argumentif any parameters are invalid

Variable Documentation

◆ k_default_ext_id_filter

const mcan_filter_elem_t k_default_ext_id_filter
static
Initial value:
= {
.can_id_type = MCAN_CAN_ID_TYPE_EXTENDED,
.sync_message = 0,
.filter_id = 0,
.filter_mask = 0x1FFFFFFFUL,
}
#define MCAN_FILTER_ELEM_CFG_STORE_IN_RX_FIFO0_IF_MATCH
Definition: hpm_mcan_drv.h:507
#define MCAN_FILTER_TYPE_CLASSIC_FILTER
Definition: hpm_mcan_drv.h:499
#define MCAN_CAN_ID_TYPE_EXTENDED
Definition: hpm_mcan_drv.h:313

◆ k_default_std_id_filter

const mcan_filter_elem_t k_default_std_id_filter
static
Initial value:
= {
.can_id_type = MCAN_CAN_ID_TYPE_STANDARD,
.sync_message = 0U,
.filter_id = 0U,
.filter_mask = 0x7FFU,
}
#define MCAN_CAN_ID_TYPE_STANDARD
CAN Identifier Types.
Definition: hpm_mcan_drv.h:312

◆ k_mcan_bit_timing_tbl

const mcan_bit_timing_table_t k_mcan_bit_timing_tbl[3]
static
Initial value:
= {
{
.tq_min = (8U) , .tq_max = ( (256U) + (128U) ) ,
.seg1_min = (2U) , .seg1_max = (256U) ,
.seg2_min = (2U) , .seg2_max = (128U) ,
.sjw_min = (1U) , .sjw_max = (128U) , .min_diff_seg1_minus_seg2 = 2,
.prescaler_min = (1U) , .prescaler_max = (512U) ,
},
{
.tq_min = (8U) , .tq_max = ( (256U) + (32U) ) ,
.seg1_min = (2U) , .seg1_max = (256U) ,
.seg2_min = (1U) , .seg2_max = (32U) ,
.sjw_min = (1U) , .sjw_max = (128U) , .min_diff_seg1_minus_seg2 = 2,
.prescaler_min = (1U) , .prescaler_max = (512U)
},
{
.tq_min = (8U) , .tq_max = ( (31U) + (15U) ) ,
.seg1_min = (2U) , .seg1_max = (31U) ,
.seg2_min = (0U) , .seg2_max = (15U) ,
.sjw_min = (0U) , .sjw_max = (15U) , .min_diff_seg1_minus_seg2 = 1,
.prescaler_min = (1U) , .prescaler_max = (32U)
}
}