canfd6 2.0.0.0
CAN FD 6 Click Driver

API for configuring and manipulating CAN FD 6 Click driver. More...

Topics

 CAN FD 6 Register address sections.
 List of register address sections of CAN FD 6 Click driver.
 
 CAN FD 6 SPI and device ID register addresses.
 List of SPI registers and device ID register addresses of CAN FD 6 Click driver.
 
 CAN FD 6 device configuration register addresses.
 List of device configuration register addresses of CAN FD 6 Click driver.
 
 CAN FD 6 MCAN register addresses.
 List of MCAN register addresses of CAN FD 6 Click driver.
 
 CAN FD 6 DLC value defines.
 List of DLC value defines of CAN FD 6 Click driver.
 
 CAN FD 6 test.
 List of test cmd of CAN FD 6 Click driver.
 
 CAN FD 6 CCCR bit masks.
 List of CCCR bit masks of CAN FD 6 Click driver.
 
 CAN FD 6 IE bits.
 List of IE bits of CAN FD 6 Click driver.
 
 CAN FD 6 IR bits.
 List of IR bits of CAN FD 6 Click driver.
 
 CAN FD 6 ILS bits.
 List of ILS bits of CAN FD 6 Click driver.
 
 CAN FD 6 ILE ( interrupt enable ).
 List of ILE ( interrupt enable ) of CAN FD 6 Click driver.
 
 CAN FD 6 GFC bits.
 List of GFC bits of CAN FD 6 Click driver.
 
 CAN FD 6 RXESC bits.
 List of RXESC bits of CAN FD 6 Click driver.
 
 CAN FD 6 TXESC bits.
 List of TXESC bits of CAN FD 6 Click driver.
 
 CAN FD 6 TSCC bits.
 List of TSCC bits of CAN FD 6 Click driver.
 
 CAN FD 6 TXBAR bits.
 List of TXBAR bits of CAN FD 6 Click driver.
 
 CAN FD 6 TXBCR bits.
 List of TXBCR bits of CAN FD 6 Click driver.
 
 CAN FD 6 TXBTIE bits.
 List of TXBTIE bits of CAN FD 6 Click driver.
 
 CAN FD 6 TXBCIE bits.
 List of TXBCIE bits of CAN FD 6 Click driver.
 
 CAN FD 6 device register bit field defines.
 List of device register bit field defines of CAN FD 6 Click driver.
 
 CAN FD 6 device interrupt register values.
 List of device interrupt register values of CAN FD 6 Click driver.
 
 CAN FD 6 device interrupt enable values.
 List of device interrupt enable values of CAN FD 6 Click driver.
 
 CAN FD 6 MikroBUS Map
 MikroBUS pin mapping of CAN FD 6 Click driver.
 

Macros

#define CANFD6_MCAN_CACHE_CONFIGURATION
 CAN FD 6 MCAN cache configuration.
 
#define CANFD6_MCAN_CACHE_SIDFC   0
 
#define CANFD6_MCAN_CACHE_XIDFC   1
 
#define CANFD6_MCAN_CACHE_RXF0C   2
 
#define CANFD6_MCAN_CACHE_RXF1C   3
 
#define CANFD6_MCAN_CACHE_RXBC   4
 
#define CANFD6_MCAN_CACHE_TXEFC   5
 
#define CANFD6_MCAN_CACHE_TXBC   6
 
#define CANFD6_MCAN_CACHE_RXESC   7
 
#define CANFD6_MCAN_CACHE_TXESC   8
 
#define CANFD6_MRAM_SIZE   2048
 CAN FD 6 MRAM size.
 
#define CANFD6_REG_BITS_MCAN_DBTP_TDC_EN   0x00800000
 CAN FD 6 DBTP.
 
#define CANFD6_REG_BITS_MCAN_RXF0C_F0OM_OVERWRITE   0x80000000
 CAN FD 6 MCAN RXF0C overwrite bit.
 
#define CANFD6_REG_BITS_MCAN_TXBC_TFQM   0x40000000
 CAN FD 6 TXBC bit.
 

Functions

void canfd6_cfg_setup (canfd6_cfg_t *cfg)
 CAN FD 6 configuration object setup function.
 
err_t canfd6_init (canfd6_t *ctx, canfd6_cfg_t *cfg)
 CAN FD 6 initialization function.
 
void canfd6_default_cfg (canfd6_t *ctx)
 CAN FD 6 default configuration function.
 
void canfd6_wkr_pin_state (canfd6_t *ctx, canfd6_pin_state_t state)
 CAN FD 6 wkr pin state function.
 
void canfd6_rst_pin_state (canfd6_t *ctx, canfd6_pin_state_t state)
 CAN FD 6 rst pin state function.
 
void canfd6_wkp_pin_state (canfd6_t *ctx, canfd6_pin_state_t state)
 CAN FD 6 wkp pin state function.
 
uint8_t canfd6_get_int_pin (canfd6_t *ctx)
 CAN FD 6 get int pin function.
 
err_t canfd6_enable_protected_registers (canfd6_t *ctx)
 CAN FD 6 enable protected registers function.
 
err_t canfd6_disable_protected_registers (canfd6_t *ctx)
 CAN FD 6 disable protected registers function.
 
void canfd6_configure_cccr_register (canfd6_t *ctx, canfd6_mcan_cccr_config_t *cccr_config)
 CAN FD 6 configure cccr register function.
 
void canfd6_read_cccr_register (canfd6_t *ctx, canfd6_mcan_cccr_config_t *cccr_config)
 CAN FD 6 read cccr register function.
 
void canfd6_mcan_read_datatimingfd_simple (canfd6_t *ctx, canfd6_mcan_data_timing_simple_t *data_timing)
 CAN FD 6 read data timing fd simple function.
 
void canfd6_mcan_read_datatimingfd_raw (canfd6_t *ctx, canfd6_mcan_data_timing_raw_t *data_timing)
 CAN FD 6 read data timing fd raw function.
 
void canfd6_mcan_configure_datatiming_simple (canfd6_t *ctx, canfd6_mcan_data_timing_simple_t *data_timing)
 CAN FD 6 configure data timing simple function.
 
void canfd6_mcan_configure_datatiming_raw (canfd6_t *ctx, canfd6_mcan_data_timing_raw_t *data_timing)
 CAN FD 6 configure data timing raw function.
 
void canfd6_mcan_read_nominaltiming_simple (canfd6_t *ctx, canfd6_mcan_nominal_timing_simple_t *nom_timing)
 CAN FD 6 read nominal timing simple function.
 
void canfd6_mcan_read_nominaltiming_raw (canfd6_t *ctx, canfd6_mcan_nominal_timing_raw_t *nom_timing)
 CAN FD 6 read nominal timing raw function.
 
void canfd6_mcan_configure_nominaltiming_simple (canfd6_t *ctx, canfd6_mcan_nominal_timing_simple_t *nom_timing)
 CAN FD 6 configure nominal timing simple function.
 
void canfd6_mcan_configure_nominaltiming_raw (canfd6_t *ctx, canfd6_mcan_nominal_timing_raw_t *nom_timing)
 CAN FD 6 configure nominal timing raw function.
 
void canfd6_mcan_configure_globalfilter (canfd6_t *ctx, canfd6_mcan_global_filter_configuration_t *gfc)
 CAN FD 6 configure global filter function.
 
err_t canfd6_mram_configure (canfd6_t *ctx, canfd6_mram_config_t *mram_config)
 CAN FD 6 mram configure function.
 
void canfd6_mram_clear (canfd6_t *ctx)
 CAN FD 6 mram clear function.
 
uint8_t canfd6_mcan_read_nextfifo (canfd6_t *ctx, canfd6_mcan_fifo_enum_t fifo_def, canfd6_mcan_rx_header_t *header, uint8_t data_payload[])
 CAN FD 6 read next fifo function.
 
uint8_t canfd6_mcan_read_rxbuffer (canfd6_t *ctx, uint8_t buf_index, canfd6_mcan_rx_header_t *header, uint8_t data_payload[])
 CAN FD 6 read rx buffer function.
 
uint32_t canfd6_mcan_write_txbuffer (canfd6_t *ctx, uint8_t buf_index, canfd6_mcan_tx_header_t *header, uint8_t data_payload[])
 CAN FD 6 write tx buffer function.
 
err_t canfd6_mcan_transmit_buffer_contents (canfd6_t *ctx, uint8_t buf_index)
 CAN FD 6 transmit buffer contents function.
 
err_t canfd6_mcan_write_sid_filter (canfd6_t *ctx, uint8_t filter_index, canfd6_mcan_sid_filter_t *filter)
 CAN FD 6 write sid filter function.
 
err_t canfd6_mcan_read_sid_filter (canfd6_t *ctx, uint8_t filter_index, canfd6_mcan_sid_filter_t *filter)
 CAN FD 6 read sid filter function.
 
err_t canfd6_mcan_write_xid_filter (canfd6_t *ctx, uint8_t filter_index, canfd6_mcan_xid_filter_t *filter)
 CAN FD 6 write xid filter function.
 
err_t canfd6_mcan_read_xid_filter (canfd6_t *ctx, uint8_t filter_index, canfd6_mcan_xid_filter_t *filter)
 CAN FD 6 read xid filter function.
 
void canfd6_mcan_read_interrupts (canfd6_t *ctx, canfd6_mcan_interrupts_t *ir)
 CAN FD 6 read interrupts function.
 
void canfd6_mcan_clear_interrupts (canfd6_t *ctx, canfd6_mcan_interrupts_t *ir)
 CAN FD 6 clear interrupts function.
 
void canfd6_mcan_clear_interrupts_all (canfd6_t *ctx)
 CAN FD 6 clear interrupts all function.
 
void canfd6_mcan_read_interrupt_enable (canfd6_t *ctx, canfd6_mcan_interrupt_enable_t *ie)
 CAN FD 6 read interrupt enable function.
 
void canfd6_mcan_configure_interrupt_enable (canfd6_t *ctx, canfd6_mcan_interrupt_enable_t *ie)
 CAN FD 6 configure interrupt enable function.
 
uint8_t canfd6_mcan_dlc_to_bytes (uint8_t input_dlc)
 CAN FD 6 dlc to bytes function.
 
uint8_t canfd6_mcan_txrxesc_data_byte_value (uint8_t input_esc_value)
 CAN FD 6 txrxesc data byte value function.
 
uint16_t canfd6_device_read_version (canfd6_t *ctx)
 CAN FD 6 device read version function.
 
void canfd6_device_configure (canfd6_t *ctx, canfd6_dev_config_t *dev_cfg)
 CAN FD 6 device configure function.
 
void canfd6_device_read_config (canfd6_t *ctx, canfd6_dev_config_t *dev_cfg)
 CAN FD 6 device read config function.
 
void canfd6_device_read_interrupts (canfd6_t *ctx, canfd6_device_interrupts_t *ir)
 CAN FD 6 device read interrupts function.
 
void canfd6_device_clear_interrupts (canfd6_t *ctx, canfd6_device_interrupts_t *ir)
 CAN FD 6 device clear interrupts function.
 
void canfd6_device_clear_interrupts_all (canfd6_t *ctx)
 CAN FD 6 device clear interrupts all function.
 
void canfd6_device_clear_spierr (canfd6_t *ctx)
 CAN FD 6 device clear spierr function.
 
void canfd6_device_read_interrupt_enable (canfd6_t *ctx, canfd6_device_interrupt_enable_t *ie)
 CAN FD 6 device read interrupt enable function.
 
void canfd6_device_configure_ie (canfd6_t *ctx, canfd6_device_interrupt_enable_t *ie)
 CAN FD 6 device configure ie function.
 
err_t canfd6_device_set_mode (canfd6_t *ctx, canfd6_device_mode_enum_t mode_define)
 CAN FD 6 device set mode function.
 
canfd6_device_mode_enum_t canfd6_device_read_mode (canfd6_t *ctx)
 CAN FD 6 device read mode function.
 
err_t canfd6_device_enable_testmode (canfd6_t *ctx, canfd6_device_test_mode_enum_t mode_define)
 CAN FD 6 device enable testmode function.
 
void canfd6_device_disable_testmode (canfd6_t *ctx)
 CAN FD 6 device disable testmode function.
 
canfd6_device_test_mode_enum_t canfd6_device_read_testmode (canfd6_t *ctx)
 CAN FD 6 device read testmode function.
 
err_t canfd6_wdt_configure (canfd6_t *ctx, canfd6_wdt_timer_enum_t wdt_timeout)
 CAN FD 6 wdt configure function.
 
canfd6_wdt_timer_enum_t canfd6_wdt_read (canfd6_t *ctx)
 CAN FD 6 wdt read function.
 
void canfd6_wdt_enable (canfd6_t *ctx)
 CAN FD 6 wdt enable function.
 
void canfd6_wdt_disable (canfd6_t *ctx)
 CAN FD 6 wdt disable function.
 
void canfd6_wdt_reset (canfd6_t *ctx)
 CAN FD 6 wdt reset function.
 

Detailed Description

API for configuring and manipulating CAN FD 6 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Macro Definition Documentation

◆ CANFD6_MCAN_CACHE_CONFIGURATION

#define CANFD6_MCAN_CACHE_CONFIGURATION

CAN FD 6 MCAN cache configuration.

Define MCAN cache configuration to reduce the number of SPI reads necessary to send or receive a packet by caching certain values.

◆ CANFD6_MCAN_CACHE_RXBC

#define CANFD6_MCAN_CACHE_RXBC   4

◆ CANFD6_MCAN_CACHE_RXESC

#define CANFD6_MCAN_CACHE_RXESC   7

◆ CANFD6_MCAN_CACHE_RXF0C

#define CANFD6_MCAN_CACHE_RXF0C   2

◆ CANFD6_MCAN_CACHE_RXF1C

#define CANFD6_MCAN_CACHE_RXF1C   3

◆ CANFD6_MCAN_CACHE_SIDFC

#define CANFD6_MCAN_CACHE_SIDFC   0

◆ CANFD6_MCAN_CACHE_TXBC

#define CANFD6_MCAN_CACHE_TXBC   6

◆ CANFD6_MCAN_CACHE_TXEFC

#define CANFD6_MCAN_CACHE_TXEFC   5

◆ CANFD6_MCAN_CACHE_TXESC

#define CANFD6_MCAN_CACHE_TXESC   8

◆ CANFD6_MCAN_CACHE_XIDFC

#define CANFD6_MCAN_CACHE_XIDFC   1

◆ CANFD6_MRAM_SIZE

#define CANFD6_MRAM_SIZE   2048

CAN FD 6 MRAM size.

Specified MRAM size.

◆ CANFD6_REG_BITS_MCAN_DBTP_TDC_EN

#define CANFD6_REG_BITS_MCAN_DBTP_TDC_EN   0x00800000

CAN FD 6 DBTP.

Data timing fd bit.

◆ CANFD6_REG_BITS_MCAN_RXF0C_F0OM_OVERWRITE

#define CANFD6_REG_BITS_MCAN_RXF0C_F0OM_OVERWRITE   0x80000000

CAN FD 6 MCAN RXF0C overwrite bit.

Specified MCAN RXF0C overwrite bit.

◆ CANFD6_REG_BITS_MCAN_TXBC_TFQM

#define CANFD6_REG_BITS_MCAN_TXBC_TFQM   0x40000000

CAN FD 6 TXBC bit.

Specified TXBC bit.

Function Documentation

◆ canfd6_cfg_setup()

void canfd6_cfg_setup ( canfd6_cfg_t * cfg)

CAN FD 6 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See canfd6_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ canfd6_configure_cccr_register()

void canfd6_configure_cccr_register ( canfd6_t * ctx,
canfd6_mcan_cccr_config_t * cccr_config )

CAN FD 6 configure cccr register function.

This function configures the bits of the CCCR register to match the CCCR config struct. This function writes to protected MCAN registers.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[in]cccr_config: Struct containing the configuration bits.
Note
Requires that protected registers have been unlocked.

◆ canfd6_default_cfg()

void canfd6_default_cfg ( canfd6_t * ctx)

CAN FD 6 default configuration function.

This function executes a default configuration of CAN FD 6 click board.

Parameters
[in]ctx: Click context object. See canfd6_t object definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ canfd6_device_clear_interrupts()

void canfd6_device_clear_interrupts ( canfd6_t * ctx,
canfd6_device_interrupts_t * ir )

CAN FD 6 device clear interrupts function.

This function will attempt to clear any interrupts that are marked as a '1' in the passed struct.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[in]ir: Struct containing the interrupt bit fields that will be updated.
Note
None.

◆ canfd6_device_clear_interrupts_all()

void canfd6_device_clear_interrupts_all ( canfd6_t * ctx)

CAN FD 6 device clear interrupts all function.

This function clears all device interrupts.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
Note
None.

◆ canfd6_device_clear_spierr()

void canfd6_device_clear_spierr ( canfd6_t * ctx)

CAN FD 6 device clear spierr function.

This function clears a SPIERR flag that may be set.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
Note
None.

◆ canfd6_device_configure()

void canfd6_device_configure ( canfd6_t * ctx,
canfd6_dev_config_t * dev_cfg )

CAN FD 6 device configure function.

This function configures the device mode and pin register based on the dev config struct masking out the reserved bits on a write.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[in]dev_cfg: Struct containing the desired device mode and pin register values.
Note
None.

◆ canfd6_device_configure_ie()

void canfd6_device_configure_ie ( canfd6_t * ctx,
canfd6_device_interrupt_enable_t * ie )

CAN FD 6 device configure ie function.

This function configures the device interrupt enable register based on the passed struct.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[in]ie: Struct containing the desired enabled interrupt bits.
Note
None.

◆ canfd6_device_disable_testmode()

void canfd6_device_disable_testmode ( canfd6_t * ctx)

CAN FD 6 device disable testmode function.

This function disables the TCAN4550 device test mode.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
Note
None.

◆ canfd6_device_enable_testmode()

err_t canfd6_device_enable_testmode ( canfd6_t * ctx,
canfd6_device_test_mode_enum_t mode_define )

CAN FD 6 device enable testmode function.

This function sets the TCAN4550 device test mode based on the input mode define enum.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[in]mode_define: Mode define enum.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ canfd6_device_read_config()

void canfd6_device_read_config ( canfd6_t * ctx,
canfd6_dev_config_t * dev_cfg )

CAN FD 6 device read config function.

This function reads the device mode and pin register and updates the passed dev cfg struct.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[out]dev_cfg: Struct containing the desired device mode and pin register values.
Note
None.

◆ canfd6_device_read_interrupt_enable()

void canfd6_device_read_interrupt_enable ( canfd6_t * ctx,
canfd6_device_interrupt_enable_t * ie )

CAN FD 6 device read interrupt enable function.

This function reads the device interrupt enable register and updates the passed struct.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[out]ie: Struct containing the interrupt bit fields that will be updated.
Note
None.

◆ canfd6_device_read_interrupts()

void canfd6_device_read_interrupts ( canfd6_t * ctx,
canfd6_device_interrupts_t * ir )

CAN FD 6 device read interrupts function.

This function reads the device interrupts and updates the device interrupts struct that is passed to the function.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[out]ir: Struct containing the interrupt bit fields that will be updated.
Note
None.

◆ canfd6_device_read_mode()

canfd6_device_mode_enum_t canfd6_device_read_mode ( canfd6_t * ctx)

CAN FD 6 device read mode function.

This function reads the TCAN4550 device mode and returns a mode define enum.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
Returns
Mode define enum.
Note
None.

◆ canfd6_device_read_testmode()

canfd6_device_test_mode_enum_t canfd6_device_read_testmode ( canfd6_t * ctx)

CAN FD 6 device read testmode function.

This function reads the TCAN4550 device test mode.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
Returns
Device test mode enum.
Note
None.

◆ canfd6_device_read_version()

uint16_t canfd6_device_read_version ( canfd6_t * ctx)

CAN FD 6 device read version function.

This function reads the TCAN4550 device version register.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
Returns
The value of the device version register.
Note
None.

◆ canfd6_device_set_mode()

err_t canfd6_device_set_mode ( canfd6_t * ctx,
canfd6_device_mode_enum_t mode_define )

CAN FD 6 device set mode function.

This function sets the TCAN4550 device mode based on the input mode define enum.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[in]mode_define: Mode define enum.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ canfd6_disable_protected_registers()

err_t canfd6_disable_protected_registers ( canfd6_t * ctx)

CAN FD 6 disable protected registers function.

This function attempts to disable CCCR.CCE and CCCR.INIT to disallow writes to protected registers.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ canfd6_enable_protected_registers()

err_t canfd6_enable_protected_registers ( canfd6_t * ctx)

CAN FD 6 enable protected registers function.

This function attempts to enable CCCR.CCE and CCCR.INIT to allow writes to protected registers, needed for MCAN configuration.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ canfd6_get_int_pin()

uint8_t canfd6_get_int_pin ( canfd6_t * ctx)

CAN FD 6 get int pin function.

This function checks the interrupt pin state.

Parameters
[in]ctx: Click context object. See canfd6_t object definition for detailed explanation.
Returns
Pin state.
Note
None.

◆ canfd6_init()

err_t canfd6_init ( canfd6_t * ctx,
canfd6_cfg_t * cfg )

CAN FD 6 initialization function.

This function initializes all necessary pins and peripherals used for this click board.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See canfd6_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ canfd6_mcan_clear_interrupts()

void canfd6_mcan_clear_interrupts ( canfd6_t * ctx,
canfd6_mcan_interrupts_t * ir )

CAN FD 6 clear interrupts function.

This function will attempt to clear any interrupts that are marked as a '1' in the passed mcan interrupt struct.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[in]ir: Struct containing the interrupt bit fields that will be updated.
Note
None.

◆ canfd6_mcan_clear_interrupts_all()

void canfd6_mcan_clear_interrupts_all ( canfd6_t * ctx)

CAN FD 6 clear interrupts all function.

This function clears all MCAN interrupts.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
Note
None.

◆ canfd6_mcan_configure_datatiming_raw()

void canfd6_mcan_configure_datatiming_raw ( canfd6_t * ctx,
canfd6_mcan_data_timing_raw_t * data_timing )

CAN FD 6 configure data timing raw function.

This function writes the data timing information to MCAN using the input from the data timing raw struct. This function writes to protected MCAN registers.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[in]data_timing: Struct containing the raw data timing information.
Note
Requires that protected registers have been unlocked.

◆ canfd6_mcan_configure_datatiming_simple()

void canfd6_mcan_configure_datatiming_simple ( canfd6_t * ctx,
canfd6_mcan_data_timing_simple_t * data_timing )

CAN FD 6 configure data timing simple function.

This function writes the data timing information to MCAN using the input from the data timing simple struct. This function writes to protected MCAN registers.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[in]data_timing: Struct containing the simplified data timing information.
Note
Requires that protected registers have been unlocked.

◆ canfd6_mcan_configure_globalfilter()

void canfd6_mcan_configure_globalfilter ( canfd6_t * ctx,
canfd6_mcan_global_filter_configuration_t * gfc )

CAN FD 6 configure global filter function.

This function configures the default behavior of the MCAN controller when receiving messages. This can include accepting or rejecting CAN messages by default. This function writes to protected MCAN registers.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[in]gfc: Struct containing the global filter register values.
Note
Requires that protected registers have been unlocked.

◆ canfd6_mcan_configure_interrupt_enable()

void canfd6_mcan_configure_interrupt_enable ( canfd6_t * ctx,
canfd6_mcan_interrupt_enable_t * ie )

CAN FD 6 configure interrupt enable function.

This function configures the MCAN interrupt enable register based on the passed struct. Also enables MCAN interrupts out to the INT1 pin.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[in]ie: Struct containing the interrupt bit fields that will be updated.
Note
None.

◆ canfd6_mcan_configure_nominaltiming_raw()

void canfd6_mcan_configure_nominaltiming_raw ( canfd6_t * ctx,
canfd6_mcan_nominal_timing_raw_t * nom_timing )

CAN FD 6 configure nominal timing raw function.

This function writes the data timing information to MCAN using the input from the nominal timing raw struct. This function writes to protected MCAN registers.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[in]nom_timing: Struct containing the raw nominal timing information.
Note
Requires that protected registers have been unlocked.

◆ canfd6_mcan_configure_nominaltiming_simple()

void canfd6_mcan_configure_nominaltiming_simple ( canfd6_t * ctx,
canfd6_mcan_nominal_timing_simple_t * nom_timing )

CAN FD 6 configure nominal timing simple function.

This function writes the data timing information to MCAN using the input from the nominal timing simple struct. This function writes to protected MCAN registers.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[in]nom_timing: Struct containing the simplified nominal timing information.
Note
Requires that protected registers have been unlocked.

◆ canfd6_mcan_dlc_to_bytes()

uint8_t canfd6_mcan_dlc_to_bytes ( uint8_t input_dlc)

CAN FD 6 dlc to bytes function.

This function converts the CAN message DLC hex value to the number of bytes it corresponds to.

Parameters
[in]input_dlc: DLC value from/to a CAN message struct.
Returns
The number of bytes of data (0-64 bytes).
Note
None.

◆ canfd6_mcan_read_datatimingfd_raw()

void canfd6_mcan_read_datatimingfd_raw ( canfd6_t * ctx,
canfd6_mcan_data_timing_raw_t * data_timing )

CAN FD 6 read data timing fd raw function.

This function reads the MCAN data timing registers and updates the data timing raw struct. This function writes to protected MCAN registers.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[out]data_timing: Struct containing the raw data timing information.
Note
None.

◆ canfd6_mcan_read_datatimingfd_simple()

void canfd6_mcan_read_datatimingfd_simple ( canfd6_t * ctx,
canfd6_mcan_data_timing_simple_t * data_timing )

CAN FD 6 read data timing fd simple function.

This function reads the MCAN data timing registers and updates the data timing simple struct. This function writes to protected MCAN registers.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[out]data_timing: Struct containing the simplified data timing information.
Note
None.

◆ canfd6_mcan_read_interrupt_enable()

void canfd6_mcan_read_interrupt_enable ( canfd6_t * ctx,
canfd6_mcan_interrupt_enable_t * ie )

CAN FD 6 read interrupt enable function.

This function reads the MCAN interrupt enable register and updates the passed mcan interrupt enable struct.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[out]ie: Struct containing the interrupt bit fields that will be updated.
Note
None.

◆ canfd6_mcan_read_interrupts()

void canfd6_mcan_read_interrupts ( canfd6_t * ctx,
canfd6_mcan_interrupts_t * ir )

CAN FD 6 read interrupts function.

Reads and updates the mcan interrupts struct that is passed to the function.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[out]ir: Struct containing the interrupt bit fields that will be updated.
Note
None.

◆ canfd6_mcan_read_nextfifo()

uint8_t canfd6_mcan_read_nextfifo ( canfd6_t * ctx,
canfd6_mcan_fifo_enum_t fifo_def,
canfd6_mcan_rx_header_t * header,
uint8_t data_payload[] )

CAN FD 6 read next fifo function.

This function will read the next MCAN FIFO element specified and return the corresponding header information and data payload. The start address of the elment is automatically calculated by looking at the MCAN's register that says where the next element to read exists.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[in]fifo_def: Enum corresponding to either RXFIFO0 or RXFIFO1.
[out]header: Struct containing the CAN-specific header information.
[out]data_payload[] : Byte array that will be updated with the read data.
Returns
The number of bytes that were read.
Note
data_payload[ ] must be at least as big as the largest possible data payload, otherwise writing to out of bounds memory may occur.

◆ canfd6_mcan_read_nominaltiming_raw()

void canfd6_mcan_read_nominaltiming_raw ( canfd6_t * ctx,
canfd6_mcan_nominal_timing_raw_t * nom_timing )

CAN FD 6 read nominal timing raw function.

This function reads the MCAN nominal timing registers and updates the nominal timing raw struct.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[out]nom_timing: Struct containing the raw nominal timing information.
Note
None.

◆ canfd6_mcan_read_nominaltiming_simple()

void canfd6_mcan_read_nominaltiming_simple ( canfd6_t * ctx,
canfd6_mcan_nominal_timing_simple_t * nom_timing )

CAN FD 6 read nominal timing simple function.

This function reads the MCAN nominal timing registers and updates the nominal timing simple struct.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[out]nom_timing: Struct containing the simplified nominal timing information.
Note
None.

◆ canfd6_mcan_read_rxbuffer()

uint8_t canfd6_mcan_read_rxbuffer ( canfd6_t * ctx,
uint8_t buf_index,
canfd6_mcan_rx_header_t * header,
uint8_t data_payload[] )

CAN FD 6 read rx buffer function.

This function will read the specified MCAN buffer element and return the corresponding header information and data payload. The start address of the element is automatically calculated.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[in]buf_index: RX buffer index to read from (starts at 0).
[out]header: Struct containing the CAN-specific header information.
[out]data_payload[] : Byte array that will be updated with the read data.
Returns
The number of bytes that were read.
Note
data_payload[ ] must be at least as big as the largest possible data payload, otherwise writing to out of bounds memory may occur.

◆ canfd6_mcan_read_sid_filter()

err_t canfd6_mcan_read_sid_filter ( canfd6_t * ctx,
uint8_t filter_index,
canfd6_mcan_sid_filter_t * filter )

CAN FD 6 read sid filter function.

This function will read a standard ID MCAN filter from a specified filter element.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[in]filter_index: SID filter index in MRAM to read from (starts at 0).
[out]filter: Struct containing the MCAN filter information.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ canfd6_mcan_read_xid_filter()

err_t canfd6_mcan_read_xid_filter ( canfd6_t * ctx,
uint8_t filter_index,
canfd6_mcan_xid_filter_t * filter )

CAN FD 6 read xid filter function.

This function will read an extended ID MCAN filter from a specified filter element.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[in]filter_index: XID filter index in MRAM to read from (starts at 0).
[out]filter: Struct containing the MCAN filter information.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ canfd6_mcan_transmit_buffer_contents()

err_t canfd6_mcan_transmit_buffer_contents ( canfd6_t * ctx,
uint8_t buf_index )

CAN FD 6 transmit buffer contents function.

This function writes the specified buffer index bit value into the TXBAR register to request a message to send.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[in]buf_index: TX buffer index to write to (starts at 0).
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
Function does NOT check if the buffer contents are valid.

◆ canfd6_mcan_txrxesc_data_byte_value()

uint8_t canfd6_mcan_txrxesc_data_byte_value ( uint8_t input_esc_value)

CAN FD 6 txrxesc data byte value function.

This function converts the MCAN ESC (Element Size) value to number of bytes that it corresponds to.

Parameters
[in]input_esc_value: Value from an element size configuration register.
Returns
The number of bytes of data (8-64 bytes).
Note
None.

◆ canfd6_mcan_write_sid_filter()

err_t canfd6_mcan_write_sid_filter ( canfd6_t * ctx,
uint8_t filter_index,
canfd6_mcan_sid_filter_t * filter )

CAN FD 6 write sid filter function.

This function will write a standard ID MCAN filter to a specified filter element.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[in]filter_index: SID filter index in MRAM to write to (starts at 0).
[in]filter: Struct containing the MCAN filter information.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ canfd6_mcan_write_txbuffer()

uint32_t canfd6_mcan_write_txbuffer ( canfd6_t * ctx,
uint8_t buf_index,
canfd6_mcan_tx_header_t * header,
uint8_t data_payload[] )

CAN FD 6 write tx buffer function.

This function will write a CAN message to a specified TX buffer that can be transmitted at a later time with the transmit buffer contents function.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[in]buf_index: TX buffer index to write to (starts at 0).
[in]header: Struct containing the CAN-specific header information.
[in]data_payload[] : Byte array that will be updated with the read data.
Returns
The number of bytes that were read.
Note
data_payload[ ] must be at least as big as the largest possible data payload, otherwise writing to out of bounds memory may occur.

◆ canfd6_mcan_write_xid_filter()

err_t canfd6_mcan_write_xid_filter ( canfd6_t * ctx,
uint8_t filter_index,
canfd6_mcan_xid_filter_t * filter )

CAN FD 6 write xid filter function.

This function will write an extended ID MCAN filter to a specified filter element.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[in]filter_index: XID filter index in MRAM to write to (starts at 0).
[in]filter: Struct containing the MCAN filter information.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ canfd6_mram_clear()

void canfd6_mram_clear ( canfd6_t * ctx)

CAN FD 6 mram clear function.

This function clears every address in MRAM. Useful for initializing the MRAM to known values during initial configuration so that accidental ECC errors do not happen.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
Note
None.

◆ canfd6_mram_configure()

err_t canfd6_mram_configure ( canfd6_t * ctx,
canfd6_mram_config_t * mram_config )

CAN FD 6 mram configure function.

This function uses the mram_config pointer to set up the various sections of the MRAM memory space. There are several different elements that may be configured in the MRAM, including their number of elements, as well as size of elements. This function will automatically generate the start addresses for each of the appropriate MRAM sections, attempting to place them immediately back-to-back. This function will check for over allocated memory conditions, and return error if this is found to be the case. This function writes to protected MCAN registers.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[in]mram_config: Struct containing the desired MRAM configuration.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
Requires that protected registers have been unlocked.

◆ canfd6_read_cccr_register()

void canfd6_read_cccr_register ( canfd6_t * ctx,
canfd6_mcan_cccr_config_t * cccr_config )

CAN FD 6 read cccr register function.

This function reads the MCAN CCCR configuration register and updates the MCAN CCCR Config struct.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[out]cccr_config: Struct containing the configuration bits.
Note
None.

◆ canfd6_rst_pin_state()

void canfd6_rst_pin_state ( canfd6_t * ctx,
canfd6_pin_state_t state )

CAN FD 6 rst pin state function.

This function sets the pin state of the reset pin.

Parameters
[in]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[in]state: Pin state.
Note
None.

◆ canfd6_wdt_configure()

err_t canfd6_wdt_configure ( canfd6_t * ctx,
canfd6_wdt_timer_enum_t wdt_timeout )

CAN FD 6 wdt configure function.

This function configures the watchdog.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[in]wdt_timeout: WDT timer enum of different times for the watch dog window.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ canfd6_wdt_disable()

void canfd6_wdt_disable ( canfd6_t * ctx)

CAN FD 6 wdt disable function.

This function disables the watchdog timer.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
Note
None.

◆ canfd6_wdt_enable()

void canfd6_wdt_enable ( canfd6_t * ctx)

CAN FD 6 wdt enable function.

This function enables the watchdog timer.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
Note
None.

◆ canfd6_wdt_read()

canfd6_wdt_timer_enum_t canfd6_wdt_read ( canfd6_t * ctx)

CAN FD 6 wdt read function.

This function reads the watchdog configuration.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
Returns
WDT timer enum of the currently configured time window.
Note
None.

◆ canfd6_wdt_reset()

void canfd6_wdt_reset ( canfd6_t * ctx)

CAN FD 6 wdt reset function.

This function resets the watchdog timer.

Parameters
[out]ctx: Click context object. See canfd6_t object definition for detailed explanation.
Note
None.

◆ canfd6_wkp_pin_state()

void canfd6_wkp_pin_state ( canfd6_t * ctx,
canfd6_pin_state_t state )

CAN FD 6 wkp pin state function.

This function sets the pin state of the wake pin.

Parameters
[in]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[in]state: Pin state.
Note
None.

◆ canfd6_wkr_pin_state()

void canfd6_wkr_pin_state ( canfd6_t * ctx,
canfd6_pin_state_t state )

CAN FD 6 wkr pin state function.

This function sets the pin state of the wake request pin.

Parameters
[in]ctx: Click context object. See canfd6_t object definition for detailed explanation.
[in]state: Pin state.
Note
None.