TCAN4550  1p2
TCAN4550.h File Reference
#include "TCAN4x5x_SPI.h"
#include "TCAN4x5x_Reg.h"
#include "TCAN4x5x_Data_Structs.h"

Go to the source code of this file.

Macros

#define TCAN4x5x_MCAN_CACHE_CONFIGURATION
 If TCAN4x5x_MCAN_CACHE_CONFIGURATION is defined, then the read and write to MRAM functions will cache certain values to reduce the number of SPI reads necessary to send or receive a packet. More...
 
#define TCAN4x5x_MCAN_VERIFY_CONFIGURATION_WRITES
 If TCAN4x5x_MCAN_VERIFY_CONFIGURATION_WRITES is defined, then each MCAN configuration write will be read and verified for correctness. More...
 
#define TCAN4x5x_DEVICE_VERIFY_CONFIGURATION_WRITES
 If TCAN4x5x_DEVICE_VERIFY_CONFIGURATION_WRITES is defined, then each device configuration write will be read and verified for correctness. More...
 
#define TCAN4x5x_MCAN_CACHE_SIDFC   0
 
#define TCAN4x5x_MCAN_CACHE_XIDFC   1
 
#define TCAN4x5x_MCAN_CACHE_RXF0C   2
 
#define TCAN4x5x_MCAN_CACHE_RXF1C   3
 
#define TCAN4x5x_MCAN_CACHE_RXBC   4
 
#define TCAN4x5x_MCAN_CACHE_TXEFC   5
 
#define TCAN4x5x_MCAN_CACHE_TXBC   6
 
#define TCAN4x5x_MCAN_CACHE_RXESC   7
 
#define TCAN4x5x_MCAN_CACHE_TXESC   8
 

Enumerations

enum  TCAN4x5x_MCAN_FIFO_Enum { RXFIFO0, RXFIFO1 }
 
enum  TCAN4x5x_WDT_Timer_Enum { TCAN4x5x_WDT_60MS, TCAN4x5x_WDT_600MS, TCAN4x5x_WDT_3S, TCAN4x5x_WDT_6S }
 
enum  TCAN4x5x_Device_Test_Mode_Enum { TCAN4x5x_DEVICE_TEST_MODE_NORMAL, TCAN4x5x_DEVICE_TEST_MODE_PHY, TCAN4x5x_DEVICE_TEST_MODE_CONTROLLER }
 
enum  TCAN4x5x_Device_Mode_Enum { TCAN4x5x_DEVICE_MODE_NORMAL, TCAN4x5x_DEVICE_MODE_STANDBY, TCAN4x5x_DEVICE_MODE_SLEEP }
 

Functions

bool TCAN4x5x_MCAN_EnableProtectedRegisters (void)
 Enable Protected MCAN Registers. More...
 
bool TCAN4x5x_MCAN_DisableProtectedRegisters (void)
 Disable Protected MCAN Registers. More...
 
bool TCAN4x5x_MCAN_ConfigureCCCRRegister (TCAN4x5x_MCAN_CCCR_Config *cccr)
 Configure the MCAN CCCR Register. More...
 
void TCAN4x5x_MCAN_ReadCCCRRegister (TCAN4x5x_MCAN_CCCR_Config *cccrConfig)
 Read the MCAN CCCR configuration register. More...
 
void TCAN4x5x_MCAN_ReadDataTimingFD_Simple (TCAN4x5x_MCAN_Data_Timing_Simple *dataTiming)
 Reads the MCAN data time settings, using the simple struct. More...
 
void TCAN4x5x_MCAN_ReadDataTimingFD_Raw (TCAN4x5x_MCAN_Data_Timing_Raw *dataTiming)
 Reads the MCAN data time settings, using the raw MCAN struct. More...
 
bool TCAN4x5x_MCAN_ConfigureDataTiming_Simple (TCAN4x5x_MCAN_Data_Timing_Simple *dataTiming)
 Writes the MCAN data time settings, using the simple data timing struct. More...
 
bool TCAN4x5x_MCAN_ConfigureDataTiming_Raw (TCAN4x5x_MCAN_Data_Timing_Raw *dataTiming)
 Writes the MCAN data time settings, using the raw MCAN data timing struct. More...
 
void TCAN4x5x_MCAN_ReadNominalTiming_Simple (TCAN4x5x_MCAN_Nominal_Timing_Simple *nomTiming)
 Reads the MCAN nominal/arbitration time settings, using the simple timing struct. More...
 
void TCAN4x5x_MCAN_ReadNominalTiming_Raw (TCAN4x5x_MCAN_Nominal_Timing_Raw *nomTiming)
 Reads the MCAN nominal/arbitration time settings, using the raw MCAN timing struct. More...
 
bool TCAN4x5x_MCAN_ConfigureNominalTiming_Simple (TCAN4x5x_MCAN_Nominal_Timing_Simple *nomTiming)
 Writes the MCAN nominal timing settings, using the simple nominal timing struct. More...
 
bool TCAN4x5x_MCAN_ConfigureNominalTiming_Raw (TCAN4x5x_MCAN_Nominal_Timing_Raw *nomTiming)
 Writes the MCAN nominal timing settings, using the raw MCAN nominal timing struct. More...
 
bool TCAN4x5x_MCAN_ConfigureGlobalFilter (TCAN4x5x_MCAN_Global_Filter_Configuration *gfc)
 Configures the MCAN global filter configuration register, using the passed Global Filter Configuration struct. More...
 
bool TCAN4x5x_MRAM_Configure (TCAN4x5x_MRAM_Config *MRAMConfig)
 Configures the MRAM registers. More...
 
void TCAN4x5x_MRAM_Clear (void)
 Clear (Zero-fill) the contents of MRAM. More...
 
void TCAN4x5x_MCAN_ReadInterrupts (TCAN4x5x_MCAN_Interrupts *ir)
 Read the MCAN interrupts. More...
 
void TCAN4x5x_MCAN_ClearInterrupts (TCAN4x5x_MCAN_Interrupts *ir)
 Clear the MCAN interrupts. More...
 
void TCAN4x5x_MCAN_ClearInterruptsAll (void)
 Clear all MCAN interrupts. More...
 
void TCAN4x5x_MCAN_ReadInterruptEnable (TCAN4x5x_MCAN_Interrupt_Enable *ie)
 Read the MCAN interrupt enable register. More...
 
void TCAN4x5x_MCAN_ConfigureInterruptEnable (TCAN4x5x_MCAN_Interrupt_Enable *ie)
 Configures the MCAN interrupt enable register. More...
 
uint8_t TCAN4x5x_MCAN_ReadNextFIFO (TCAN4x5x_MCAN_FIFO_Enum FIFODefine, TCAN4x5x_MCAN_RX_Header *header, uint8_t dataPayload[])
 Read the next MCAN FIFO element. More...
 
uint8_t TCAN4x5x_MCAN_ReadRXBuffer (uint8_t bufIndex, TCAN4x5x_MCAN_RX_Header *header, uint8_t dataPayload[])
 Read the specified RX buffer element. More...
 
uint32_t TCAN4x5x_MCAN_WriteTXBuffer (uint8_t bufIndex, TCAN4x5x_MCAN_TX_Header *header, uint8_t dataPayload[])
 Write CAN message to the specified TX buffer. More...
 
bool TCAN4x5x_MCAN_TransmitBufferContents (uint8_t bufIndex)
 Transmit TX buffer contents of the specified tx buffer. More...
 
bool TCAN4x5x_MCAN_WriteSIDFilter (uint8_t filterIndex, TCAN4x5x_MCAN_SID_Filter *filter)
 Write MCAN Standard ID filter into MRAM. More...
 
bool TCAN4x5x_MCAN_ReadSIDFilter (uint8_t filterIndex, TCAN4x5x_MCAN_SID_Filter *filter)
 Read a MCAN Standard ID filter from MRAM. More...
 
bool TCAN4x5x_MCAN_WriteXIDFilter (uint8_t fifoIndex, TCAN4x5x_MCAN_XID_Filter *filter)
 Write MCAN Extended ID filter into MRAM. More...
 
uint8_t TCAN4x5x_MCAN_DLCtoBytes (uint8_t inputDLC)
 Converts the CAN message DLC hex value to the number of bytes it corresponds to. More...
 
uint8_t TCAN4x5x_MCAN_TXRXESC_DataByteValue (uint8_t inputESCValue)
 Converts the MCAN ESC (Element Size) value to number of bytes that it corresponds to. More...
 
uint16_t TCAN4x5x_Device_ReadDeviceVersion (void)
 Read the TCAN4x5x device version register. More...
 
bool TCAN4x5x_Device_Configure (TCAN4x5x_DEV_CONFIG *devCfg)
 Configures the device mode and pin register. More...
 
void TCAN4x5x_Device_ReadConfig (TCAN4x5x_DEV_CONFIG *devCfg)
 Reads the device mode and pin register. More...
 
void TCAN4x5x_Device_ReadInterrupts (TCAN4x5x_Device_Interrupts *ir)
 Read the device interrupts. More...
 
void TCAN4x5x_Device_ClearInterrupts (TCAN4x5x_Device_Interrupts *ir)
 Clear the device interrupts. More...
 
void TCAN4x5x_Device_ClearInterruptsAll (void)
 Clear all device interrupts. More...
 
void TCAN4x5x_Device_ClearSPIERR (void)
 Clears a SPIERR flag that may be set. More...
 
void TCAN4x5x_Device_ReadInterruptEnable (TCAN4x5x_Device_Interrupt_Enable *ie)
 Read the device interrupt enable register. More...
 
bool TCAN4x5x_Device_ConfigureInterruptEnable (TCAN4x5x_Device_Interrupt_Enable *ie)
 Configures the device interrupt enable register. More...
 
bool TCAN4x5x_Device_SetMode (TCAN4x5x_Device_Mode_Enum modeDefine)
 Sets the TCAN4x5x device mode. More...
 
TCAN4x5x_Device_Mode_Enum TCAN4x5x_Device_ReadMode (void)
 Reads the TCAN4x5x device mode. More...
 
bool TCAN4x5x_Device_EnableTestMode (TCAN4x5x_Device_Test_Mode_Enum modeDefine)
 Sets the TCAN4x5x device test mode. More...
 
bool TCAN4x5x_Device_DisableTestMode (void)
 Disables the TCAN4x5x device test mode. More...
 
TCAN4x5x_Device_Test_Mode_Enum TCAN4x5x_Device_ReadTestMode (void)
 Reads the TCAN4x5x device test mode. More...
 
bool TCAN4x5x_WDT_Configure (TCAN4x5x_WDT_Timer_Enum WDTtimeout)
 Configure the watchdog. More...
 
TCAN4x5x_WDT_Timer_Enum TCAN4x5x_WDT_Read (void)
 Read the watchdog configuration. More...
 
bool TCAN4x5x_WDT_Enable (void)
 Enable the watchdog timer. More...
 
bool TCAN4x5x_WDT_Disable (void)
 Disable the watchdog timer. More...
 
void TCAN4x5x_WDT_Reset (void)
 Reset the watchdog timer. More...
 

Macro Definition Documentation

◆ TCAN4x5x_DEVICE_VERIFY_CONFIGURATION_WRITES

#define TCAN4x5x_DEVICE_VERIFY_CONFIGURATION_WRITES

If TCAN4x5x_DEVICE_VERIFY_CONFIGURATION_WRITES is defined, then each device configuration write will be read and verified for correctness.

Definition at line 53 of file TCAN4550.h.

◆ TCAN4x5x_MCAN_CACHE_CONFIGURATION

#define TCAN4x5x_MCAN_CACHE_CONFIGURATION

If TCAN4x5x_MCAN_CACHE_CONFIGURATION is defined, then the read and write to MRAM functions will cache certain values to reduce the number of SPI reads necessary to send or receive a packet.

Definition at line 47 of file TCAN4550.h.

◆ TCAN4x5x_MCAN_CACHE_RXBC

#define TCAN4x5x_MCAN_CACHE_RXBC   4

Definition at line 62 of file TCAN4550.h.

Referenced by TCAN4x5x_MCAN_ReadRXBuffer(), and TCAN4x5x_MRAM_Configure().

◆ TCAN4x5x_MCAN_CACHE_RXESC

#define TCAN4x5x_MCAN_CACHE_RXESC   7

◆ TCAN4x5x_MCAN_CACHE_RXF0C

#define TCAN4x5x_MCAN_CACHE_RXF0C   2

Definition at line 60 of file TCAN4550.h.

Referenced by TCAN4x5x_MCAN_ReadNextFIFO(), and TCAN4x5x_MRAM_Configure().

◆ TCAN4x5x_MCAN_CACHE_RXF1C

#define TCAN4x5x_MCAN_CACHE_RXF1C   3

Definition at line 61 of file TCAN4550.h.

Referenced by TCAN4x5x_MCAN_ReadNextFIFO(), and TCAN4x5x_MRAM_Configure().

◆ TCAN4x5x_MCAN_CACHE_SIDFC

#define TCAN4x5x_MCAN_CACHE_SIDFC   0

◆ TCAN4x5x_MCAN_CACHE_TXBC

#define TCAN4x5x_MCAN_CACHE_TXBC   6

Definition at line 64 of file TCAN4550.h.

Referenced by TCAN4x5x_MCAN_WriteTXBuffer(), and TCAN4x5x_MRAM_Configure().

◆ TCAN4x5x_MCAN_CACHE_TXEFC

#define TCAN4x5x_MCAN_CACHE_TXEFC   5

Definition at line 63 of file TCAN4550.h.

Referenced by TCAN4x5x_MRAM_Configure().

◆ TCAN4x5x_MCAN_CACHE_TXESC

#define TCAN4x5x_MCAN_CACHE_TXESC   8

Definition at line 66 of file TCAN4550.h.

Referenced by TCAN4x5x_MCAN_WriteTXBuffer(), and TCAN4x5x_MRAM_Configure().

◆ TCAN4x5x_MCAN_CACHE_XIDFC

#define TCAN4x5x_MCAN_CACHE_XIDFC   1

◆ TCAN4x5x_MCAN_VERIFY_CONFIGURATION_WRITES

#define TCAN4x5x_MCAN_VERIFY_CONFIGURATION_WRITES

If TCAN4x5x_MCAN_VERIFY_CONFIGURATION_WRITES is defined, then each MCAN configuration write will be read and verified for correctness.

Definition at line 50 of file TCAN4550.h.

Enumeration Type Documentation

◆ TCAN4x5x_Device_Mode_Enum

Enumerator
TCAN4x5x_DEVICE_MODE_NORMAL 
TCAN4x5x_DEVICE_MODE_STANDBY 
TCAN4x5x_DEVICE_MODE_SLEEP 

Definition at line 72 of file TCAN4550.h.

◆ TCAN4x5x_Device_Test_Mode_Enum

Enumerator
TCAN4x5x_DEVICE_TEST_MODE_NORMAL 
TCAN4x5x_DEVICE_TEST_MODE_PHY 
TCAN4x5x_DEVICE_TEST_MODE_CONTROLLER 

Definition at line 71 of file TCAN4550.h.

◆ TCAN4x5x_MCAN_FIFO_Enum

Enumerator
RXFIFO0 
RXFIFO1 

Definition at line 69 of file TCAN4550.h.

◆ TCAN4x5x_WDT_Timer_Enum

Enumerator
TCAN4x5x_WDT_60MS 
TCAN4x5x_WDT_600MS 
TCAN4x5x_WDT_3S 
TCAN4x5x_WDT_6S 

Definition at line 70 of file TCAN4550.h.

Function Documentation

◆ TCAN4x5x_Device_ClearInterrupts()

void TCAN4x5x_Device_ClearInterrupts ( TCAN4x5x_Device_Interrupts ir)

Clear the device interrupts.

Will attempt to clear any interrupts that are marked as a '1' in the passed TCAN4x5x_Device_Interrupts struct

Parameters
*iris a pointer to a TCAN4x5x_Device_Interrupts struct containing the interrupt bit fields that will be updated

Definition at line 1581 of file TCAN4550.c.

References AHB_WRITE_32(), REG_DEV_IR, and TCAN4x5x_Device_Interrupts::word.

◆ TCAN4x5x_Device_ClearInterruptsAll()

void TCAN4x5x_Device_ClearInterruptsAll ( void  )

Clear all device interrupts.

Clears all device interrupts

Definition at line 1593 of file TCAN4550.c.

References AHB_WRITE_32(), and REG_DEV_IR.

◆ TCAN4x5x_Device_ClearSPIERR()

void TCAN4x5x_Device_ClearSPIERR ( void  )

Clears a SPIERR flag that may be set.

Definition at line 1603 of file TCAN4550.c.

References AHB_WRITE_32(), and REG_SPI_STATUS.

◆ TCAN4x5x_Device_Configure()

◆ TCAN4x5x_Device_ConfigureInterruptEnable()

bool TCAN4x5x_Device_ConfigureInterruptEnable ( TCAN4x5x_Device_Interrupt_Enable ie)

Configures the device interrupt enable register.

Configures the device interrupt enable register based on the passed TCAN4x5x_Device_Interrupt_Enable struct

Parameters
*ieis a pointer to a TCAN4x5x_Device_Interrupt_Enable struct containing the desired enabled interrupt bits
Returns
true if configuration successfully done, false if not

Definition at line 1633 of file TCAN4550.c.

References AHB_READ_32(), AHB_WRITE_32(), REG_BITS_DEVICE_IE_MASK, REG_DEV_IE, and TCAN4x5x_Device_Interrupt_Enable::word.

◆ TCAN4x5x_Device_DisableTestMode()

bool TCAN4x5x_Device_DisableTestMode ( void  )

Disables the TCAN4x5x device test mode.

Returns
true if disabling test mode was successful, false if not

Definition at line 1767 of file TCAN4550.c.

References AHB_READ_32(), AHB_WRITE_32(), REG_BITS_DEVICE_MODE_TESTMODE_ENMASK, REG_BITS_DEVICE_MODE_TESTMODE_MASK, and REG_DEV_MODES_AND_PINS.

Referenced by TCAN4x5x_Device_EnableTestMode().

◆ TCAN4x5x_Device_EnableTestMode()

bool TCAN4x5x_Device_EnableTestMode ( TCAN4x5x_Device_Test_Mode_Enum  modeDefine)

Sets the TCAN4x5x device test mode.

Sets the TCAN4x5x device test mode based on the input modeDefine enum

Parameters
modeDefineis an TCAN4x5x_Device_Test_Mode_Enum enum
Returns
true if configuration successfully done, false if not

Definition at line 1728 of file TCAN4550.c.

References AHB_READ_32(), AHB_WRITE_32(), REG_BITS_DEVICE_MODE_TESTMODE_CONTROLLER, REG_BITS_DEVICE_MODE_TESTMODE_EN, REG_BITS_DEVICE_MODE_TESTMODE_MASK, REG_BITS_DEVICE_MODE_TESTMODE_PHY, REG_DEV_MODES_AND_PINS, TCAN4x5x_Device_DisableTestMode(), TCAN4x5x_DEVICE_TEST_MODE_CONTROLLER, TCAN4x5x_DEVICE_TEST_MODE_NORMAL, and TCAN4x5x_DEVICE_TEST_MODE_PHY.

◆ TCAN4x5x_Device_ReadConfig()

void TCAN4x5x_Device_ReadConfig ( TCAN4x5x_DEV_CONFIG devCfg)

Reads the device mode and pin register.

Reads the device mode and pin register and updates the passed TCAN4x5x_DEV_CONFIG struct

Parameters
*devCfgis a pointer to a TCAN4x5x_DEV_CONFIG struct to be updated with the current mode and pin register values

Definition at line 1553 of file TCAN4550.c.

References AHB_READ_32(), REG_DEV_MODES_AND_PINS, and TCAN4x5x_DEV_CONFIG::word.

◆ TCAN4x5x_Device_ReadDeviceVersion()

uint16_t TCAN4x5x_Device_ReadDeviceVersion ( void  )

Read the TCAN4x5x device version register.

Returns
The register value for the device version register

Definition at line 1485 of file TCAN4550.c.

References AHB_READ_32(), and REG_SPI_REVISION.

◆ TCAN4x5x_Device_ReadInterruptEnable()

void TCAN4x5x_Device_ReadInterruptEnable ( TCAN4x5x_Device_Interrupt_Enable ie)

Read the device interrupt enable register.

Reads the device interrupt enable register and updates the passed TCAN4x5x_Device_Interrupt_Enable struct

Parameters
*ieis a pointer to a TCAN4x5x_Device_Interrupt_Enable struct containing the interrupt bit fields that will be updated

Definition at line 1617 of file TCAN4550.c.

References AHB_READ_32(), REG_DEV_IE, and TCAN4x5x_Device_Interrupt_Enable::word.

◆ TCAN4x5x_Device_ReadInterrupts()

void TCAN4x5x_Device_ReadInterrupts ( TCAN4x5x_Device_Interrupts ir)

Read the device interrupts.

Reads the device interrupts and updates a TCAN4x5x_Device_Interrupts struct that is passed to the function

Parameters
*iris a pointer to a TCAN4x5x_Device_Interrupts struct containing the interrupt bit fields that will be updated

Definition at line 1567 of file TCAN4550.c.

References AHB_READ_32(), REG_DEV_IR, and TCAN4x5x_Device_Interrupts::word.

◆ TCAN4x5x_Device_ReadMode()

TCAN4x5x_Device_Mode_Enum TCAN4x5x_Device_ReadMode ( void  )

Reads the TCAN4x5x device mode.

Reads the TCAN4x5x device mode and returns a modeDefine enum

Returns
A TCAN4x5x_Device_Mode_Enum enum of the current state

Definition at line 1698 of file TCAN4550.c.

References AHB_READ_32(), REG_BITS_DEVICE_MODE_DEVICEMODE_MASK, REG_BITS_DEVICE_MODE_DEVICEMODE_NORMAL, REG_BITS_DEVICE_MODE_DEVICEMODE_SLEEP, REG_BITS_DEVICE_MODE_DEVICEMODE_STANDBY, REG_DEV_MODES_AND_PINS, TCAN4x5x_DEVICE_MODE_NORMAL, TCAN4x5x_DEVICE_MODE_SLEEP, and TCAN4x5x_DEVICE_MODE_STANDBY.

Referenced by TCAN4x5x_MCAN_ConfigureCCCRRegister().

◆ TCAN4x5x_Device_ReadTestMode()

TCAN4x5x_Device_Test_Mode_Enum TCAN4x5x_Device_ReadTestMode ( void  )

Reads the TCAN4x5x device test mode.

Returns
an TCAN4x5x_Device_Test_Mode_Enum of the current device test mode

Definition at line 1788 of file TCAN4550.c.

References AHB_READ_32(), REG_BITS_DEVICE_MODE_TESTMODE_CONTROLLER, REG_BITS_DEVICE_MODE_TESTMODE_ENMASK, REG_DEV_MODES_AND_PINS, TCAN4x5x_DEVICE_TEST_MODE_CONTROLLER, TCAN4x5x_DEVICE_TEST_MODE_NORMAL, and TCAN4x5x_DEVICE_TEST_MODE_PHY.

◆ TCAN4x5x_Device_SetMode()

bool TCAN4x5x_Device_SetMode ( TCAN4x5x_Device_Mode_Enum  modeDefine)

Sets the TCAN4x5x device mode.

Sets the TCAN4x5x device mode based on the input modeDefine enum

Parameters
modeDefineis an TCAN4x5x_Device_Mode_Enum enum
Returns
true if configuration successfully done, false if not

Definition at line 1657 of file TCAN4550.c.

References AHB_READ_32(), AHB_WRITE_32(), REG_BITS_DEVICE_MODE_DEVICEMODE_MASK, REG_BITS_DEVICE_MODE_DEVICEMODE_NORMAL, REG_BITS_DEVICE_MODE_DEVICEMODE_SLEEP, REG_BITS_DEVICE_MODE_DEVICEMODE_STANDBY, REG_DEV_MODES_AND_PINS, TCAN4x5x_DEVICE_MODE_NORMAL, TCAN4x5x_DEVICE_MODE_SLEEP, and TCAN4x5x_DEVICE_MODE_STANDBY.

◆ TCAN4x5x_MCAN_ClearInterrupts()

void TCAN4x5x_MCAN_ClearInterrupts ( TCAN4x5x_MCAN_Interrupts ir)

Clear the MCAN interrupts.

Will attempt to clear any interrupts that are marked as a '1' in the passed TCAN4x5x_MCAN_Interrupts struct

Parameters
*iris a pointer to a TCAN4x5x_MCAN_Interrupts struct containing the interrupt bit fields that will be updated

Definition at line 1388 of file TCAN4550.c.

References AHB_WRITE_32(), REG_MCAN_IR, and TCAN4x5x_MCAN_Interrupts::word.

◆ TCAN4x5x_MCAN_ClearInterruptsAll()

void TCAN4x5x_MCAN_ClearInterruptsAll ( void  )

Clear all MCAN interrupts.

Clears all MCAN interrupts

Definition at line 1400 of file TCAN4550.c.

References AHB_WRITE_32(), and REG_MCAN_IR.

◆ TCAN4x5x_MCAN_ConfigureCCCRRegister()

bool TCAN4x5x_MCAN_ConfigureCCCRRegister ( TCAN4x5x_MCAN_CCCR_Config cccrConfig)

Configure the MCAN CCCR Register.

Configures the bits of the CCCR register to match the CCCR config struct

Warning
This function writes to protected MCAN registers
Note
Requires that protected registers have been unlocked using TCAN4x5x_MCAN_EnableProtectedRegisters() and TCAN4x5x_MCAN_DisableProtectedRegisters() be used to lock the registers after configuration
Parameters
*cccrConfigis a pointer to a TCAN4x5x_MCAN_CCCR_Config struct containing the configuration bits
Returns
true if successfully enabled, otherwise return false

Definition at line 150 of file TCAN4550.c.

References AHB_READ_32(), AHB_WRITE_32(), TCAN4x5x_MCAN_CCCR_Config::CSR, REG_BITS_MCAN_CCCR_CCE, REG_BITS_MCAN_CCCR_CSA, REG_BITS_MCAN_CCCR_CSR, REG_BITS_MCAN_CCCR_INIT, REG_BITS_MCAN_CCCR_RESERVED_MASK, REG_MCAN_CCCR, TCAN4x5x_DEVICE_MODE_STANDBY, TCAN4x5x_Device_ReadMode(), and TCAN4x5x_MCAN_CCCR_Config::word.

◆ TCAN4x5x_MCAN_ConfigureDataTiming_Raw()

bool TCAN4x5x_MCAN_ConfigureDataTiming_Raw ( TCAN4x5x_MCAN_Data_Timing_Raw dataTiming)

Writes the MCAN data time settings, using the raw MCAN data timing struct.

Writes the data timing information to MCAN using the input from the *dataTiming pointer

Warning
This function writes to protected MCAN registers
Note
Requires that protected registers have been unlocked using TCAN4x5x_MCAN_EnableProtectedRegisters() and TCAN4x5x_MCAN_DisableProtectedRegisters() be used to lock the registers after configuration
Parameters
*dataTimingis a pointer of a TCAN4x5x_MCAN_Data_Timing_Raw struct containing the raw data timing information
Returns
true if successfully enabled, otherwise return false

Definition at line 352 of file TCAN4550.c.

References AHB_READ_32(), AHB_WRITE_32(), TCAN4x5x_MCAN_Data_Timing_Raw::DataBitRatePrescaler, TCAN4x5x_MCAN_Data_Timing_Raw::DataSyncJumpWidth, TCAN4x5x_MCAN_Data_Timing_Raw::DataTimeSeg1andProp, TCAN4x5x_MCAN_Data_Timing_Raw::DataTimeSeg2, REG_BITS_MCAN_DBTP_TDC_EN, REG_BITS_MCAN_TSCC_COUNTER_EXTERNAL, REG_MCAN_DBTP, REG_MCAN_TDCR, REG_MCAN_TSCC, TCAN4x5x_MCAN_Data_Timing_Raw::TDCFilter, and TCAN4x5x_MCAN_Data_Timing_Raw::TDCOffset.

◆ TCAN4x5x_MCAN_ConfigureDataTiming_Simple()

bool TCAN4x5x_MCAN_ConfigureDataTiming_Simple ( TCAN4x5x_MCAN_Data_Timing_Simple dataTiming)

Writes the MCAN data time settings, using the simple data timing struct.

Writes the data timing information to MCAN using the input from the *dataTiming pointer

Warning
This function writes to protected MCAN registers
Note
Requires that protected registers have been unlocked using TCAN4x5x_MCAN_EnableProtectedRegisters() and TCAN4x5x_MCAN_DisableProtectedRegisters() be used to lock the registers after configuration
Parameters
*dataTimingis a pointer of a TCAN4x5x_MCAN_Data_Timing_Simple struct containing the simplified data timing information
Returns
true if successfully enabled, otherwise return false

Definition at line 277 of file TCAN4550.c.

References AHB_READ_32(), AHB_WRITE_32(), TCAN4x5x_MCAN_Data_Timing_Simple::DataBitRatePrescaler, TCAN4x5x_MCAN_Data_Timing_Simple::DataTqAfterSamplePoint, TCAN4x5x_MCAN_Data_Timing_Simple::DataTqBeforeSamplePoint, REG_BITS_MCAN_DBTP_TDC_EN, REG_BITS_MCAN_TSCC_COUNTER_EXTERNAL, REG_MCAN_DBTP, REG_MCAN_TDCR, and REG_MCAN_TSCC.

◆ TCAN4x5x_MCAN_ConfigureGlobalFilter()

bool TCAN4x5x_MCAN_ConfigureGlobalFilter ( TCAN4x5x_MCAN_Global_Filter_Configuration gfc)

Configures the MCAN global filter configuration register, using the passed Global Filter Configuration struct.

Configures the default behavior of the MCAN controller when receiving messages. This can include accepting or rejecting CAN messages by default.

Warning
This function writes to protected MCAN registers
Note
Requires that protected registers have been unlocked using TCAN4x5x_MCAN_EnableProtectedRegisters() and TCAN4x5x_MCAN_DisableProtectedRegisters() be used to lock the registers after configuration
Parameters
*gfcis a pointer of a TCAN4x5x_MCAN_Global_Filter_Configuration struct containing the register values
Returns
true if successfully enabled, otherwise return false

Definition at line 547 of file TCAN4550.c.

References AHB_READ_32(), AHB_WRITE_32(), REG_BITS_MCAN_GFC_MASK, REG_MCAN_GFC, and TCAN4x5x_MCAN_Global_Filter_Configuration::word.

◆ TCAN4x5x_MCAN_ConfigureInterruptEnable()

void TCAN4x5x_MCAN_ConfigureInterruptEnable ( TCAN4x5x_MCAN_Interrupt_Enable ie)

Configures the MCAN interrupt enable register.

Configures the MCAN interrupt enable register based on the passed TCAN4x5x_MCAN_Interrupt_Enable struct Also enables MCAN interrupts out to the INT1 pin.

Parameters
*ieis a pointer to a TCAN4x5x_MCAN_Interrupt_Enable struct containing the desired enabled interrupt bits

Definition at line 1429 of file TCAN4550.c.

References AHB_WRITE_32(), REG_BITS_MCAN_ILE_EINT0, REG_MCAN_IE, REG_MCAN_ILE, and TCAN4x5x_MCAN_Interrupt_Enable::word.

◆ TCAN4x5x_MCAN_ConfigureNominalTiming_Raw()

bool TCAN4x5x_MCAN_ConfigureNominalTiming_Raw ( TCAN4x5x_MCAN_Nominal_Timing_Raw nomTiming)

Writes the MCAN nominal timing settings, using the raw MCAN nominal timing struct.

Writes the data timing information to MCAN using the input from the *nomTiming pointer

Warning
This function writes to protected MCAN registers
Note
Requires that protected registers have been unlocked using TCAN4x5x_MCAN_EnableProtectedRegisters() and TCAN4x5x_MCAN_DisableProtectedRegisters() be used to lock the registers after configuration
Parameters
*nomTimingis a pointer of a TCAN4x5x_MCAN_Nominal_Timing_Raw struct containing the raw MCAN nominal timing information
Returns
true if successfully enabled, otherwise return false

Definition at line 514 of file TCAN4550.c.

References AHB_READ_32(), AHB_WRITE_32(), TCAN4x5x_MCAN_Nominal_Timing_Raw::NominalBitRatePrescaler, TCAN4x5x_MCAN_Nominal_Timing_Raw::NominalSyncJumpWidth, TCAN4x5x_MCAN_Nominal_Timing_Raw::NominalTimeSeg1andProp, TCAN4x5x_MCAN_Nominal_Timing_Raw::NominalTimeSeg2, and REG_MCAN_NBTP.

◆ TCAN4x5x_MCAN_ConfigureNominalTiming_Simple()

bool TCAN4x5x_MCAN_ConfigureNominalTiming_Simple ( TCAN4x5x_MCAN_Nominal_Timing_Simple nomTiming)

Writes the MCAN nominal timing settings, using the simple nominal timing struct.

Writes the data timing information to MCAN using the input from the *nomTiming pointer

Warning
This function writes to protected MCAN registers
Note
Requires that protected registers have been unlocked using TCAN4x5x_MCAN_EnableProtectedRegisters() and TCAN4x5x_MCAN_DisableProtectedRegisters() be used to lock the registers after configuration
Parameters
*nomTimingis a pointer of a TCAN4x5x_MCAN_Nominal_Timing_Simple struct containing the simplified nominal timing information
Returns
true if successfully enabled, otherwise return false

Definition at line 457 of file TCAN4550.c.

References AHB_READ_32(), AHB_WRITE_32(), TCAN4x5x_MCAN_Nominal_Timing_Simple::NominalBitRatePrescaler, TCAN4x5x_MCAN_Nominal_Timing_Simple::NominalTqAfterSamplePoint, TCAN4x5x_MCAN_Nominal_Timing_Simple::NominalTqBeforeSamplePoint, and REG_MCAN_NBTP.

◆ TCAN4x5x_MCAN_DisableProtectedRegisters()

bool TCAN4x5x_MCAN_DisableProtectedRegisters ( void  )

Disable Protected MCAN Registers.

Attempts to disable CCCR.CCE and CCCR.INIT to disallow writes to protected registers

Returns
true if successfully enabled, otherwise return false

Definition at line 113 of file TCAN4550.c.

References AHB_READ_32(), AHB_WRITE_32(), REG_BITS_MCAN_CCCR_CCE, REG_BITS_MCAN_CCCR_CSA, REG_BITS_MCAN_CCCR_CSR, REG_BITS_MCAN_CCCR_INIT, and REG_MCAN_CCCR.

◆ TCAN4x5x_MCAN_DLCtoBytes()

uint8_t TCAN4x5x_MCAN_DLCtoBytes ( uint8_t  inputDLC)

Converts the CAN message DLC hex value to the number of bytes it corresponds to.

Parameters
inputDLCis the DLC value from/to a CAN message struct
Returns
The number of bytes of data (0-64 bytes)

Definition at line 1443 of file TCAN4550.c.

Referenced by TCAN4x5x_MCAN_ReadNextFIFO(), TCAN4x5x_MCAN_ReadRXBuffer(), and TCAN4x5x_MCAN_WriteTXBuffer().

◆ TCAN4x5x_MCAN_EnableProtectedRegisters()

bool TCAN4x5x_MCAN_EnableProtectedRegisters ( void  )

Enable Protected MCAN Registers.

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

Returns
true if successfully enabled, otherwise return false

Definition at line 79 of file TCAN4550.c.

References AHB_READ_32(), AHB_WRITE_32(), REG_BITS_MCAN_CCCR_CCE, REG_BITS_MCAN_CCCR_CSA, REG_BITS_MCAN_CCCR_CSR, REG_BITS_MCAN_CCCR_INIT, and REG_MCAN_CCCR.

◆ TCAN4x5x_MCAN_ReadCCCRRegister()

void TCAN4x5x_MCAN_ReadCCCRRegister ( TCAN4x5x_MCAN_CCCR_Config cccrConfig)

Read the MCAN CCCR configuration register.

Reads the MCAN CCCR configuration register and updates the passed TCAN4x5x_MCAN_CCCR_Config struct

Parameters
*cccrConfigis a pointer to a TCAN4x5x_MCAN_CCCR_Config struct containing the CCCR bit fields that will be updated

Definition at line 200 of file TCAN4550.c.

References AHB_READ_32(), REG_MCAN_CCCR, and TCAN4x5x_MCAN_CCCR_Config::word.

◆ TCAN4x5x_MCAN_ReadDataTimingFD_Raw()

void TCAN4x5x_MCAN_ReadDataTimingFD_Raw ( TCAN4x5x_MCAN_Data_Timing_Raw dataTiming)

Reads the MCAN data time settings, using the raw MCAN struct.

Reads the MCAN data timing registers and updates the *dataTiming struct

Parameters
*dataTimingis a pointer of a TCAN4x5x_MCAN_Data_Timing_Simple struct containing the raw data timing information

Definition at line 239 of file TCAN4550.c.

References AHB_READ_32(), TCAN4x5x_MCAN_Data_Timing_Raw::DataBitRatePrescaler, TCAN4x5x_MCAN_Data_Timing_Raw::DataSyncJumpWidth, TCAN4x5x_MCAN_Data_Timing_Raw::DataTimeSeg1andProp, TCAN4x5x_MCAN_Data_Timing_Raw::DataTimeSeg2, REG_BITS_MCAN_DBTP_TDC_EN, REG_MCAN_DBTP, REG_MCAN_TDCR, TCAN4x5x_MCAN_Data_Timing_Raw::TDCFilter, and TCAN4x5x_MCAN_Data_Timing_Raw::TDCOffset.

◆ TCAN4x5x_MCAN_ReadDataTimingFD_Simple()

void TCAN4x5x_MCAN_ReadDataTimingFD_Simple ( TCAN4x5x_MCAN_Data_Timing_Simple dataTiming)

Reads the MCAN data time settings, using the simple struct.

Reads the MCAN data timing registers and updates the *dataTiming struct

Warning
This function writes to protected MCAN registers
Note
Requires that protected registers have been unlocked using TCAN4x5x_MCAN_EnableProtectedRegisters() and TCAN4x5x_MCAN_DisableProtectedRegisters() be used to lock the registers after configuration
Parameters
*dataTimingis a pointer of a TCAN4x5x_MCAN_Data_Timing_Simple struct containing the simplified data timing information

Definition at line 217 of file TCAN4550.c.

References AHB_READ_32(), TCAN4x5x_MCAN_Data_Timing_Simple::DataBitRatePrescaler, TCAN4x5x_MCAN_Data_Timing_Simple::DataTqAfterSamplePoint, TCAN4x5x_MCAN_Data_Timing_Simple::DataTqBeforeSamplePoint, and REG_MCAN_DBTP.

◆ TCAN4x5x_MCAN_ReadInterruptEnable()

void TCAN4x5x_MCAN_ReadInterruptEnable ( TCAN4x5x_MCAN_Interrupt_Enable ie)

Read the MCAN interrupt enable register.

Reads the MCAN interrupt enable register and updates the passed TCAN4x5x_MCAN_Interrupt_Enable struct

Parameters
*ieis a pointer to a TCAN4x5x_MCAN_Interrupt_Enable struct containing the interrupt bit fields that will be updated

Definition at line 1414 of file TCAN4550.c.

References AHB_READ_32(), REG_MCAN_IE, and TCAN4x5x_MCAN_Interrupt_Enable::word.

◆ TCAN4x5x_MCAN_ReadInterrupts()

void TCAN4x5x_MCAN_ReadInterrupts ( TCAN4x5x_MCAN_Interrupts ir)

Read the MCAN interrupts.

Reads the MCAN interrupts and updates a TCAN4x5x_MCAN_Interrupts struct that is passed to the function

Parameters
*iris a pointer to a TCAN4x5x_MCAN_Interrupts struct containing the interrupt bit fields that will be updated

Definition at line 1374 of file TCAN4550.c.

References AHB_READ_32(), REG_MCAN_IR, and TCAN4x5x_MCAN_Interrupts::word.

◆ TCAN4x5x_MCAN_ReadNextFIFO()

uint8_t TCAN4x5x_MCAN_ReadNextFIFO ( TCAN4x5x_MCAN_FIFO_Enum  FIFODefine,
TCAN4x5x_MCAN_RX_Header header,
uint8_t  dataPayload[] 
)

Read the next MCAN FIFO element.

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
FIFODefineis an TCAN4x5x_MCAN_FIFO_Enum enum corresponding to either RXFIFO0 or RXFIFO1
*headeris a pointer to a TCAN4x5x_MCAN_RX_Header struct containing the CAN-specific header information
dataPayload[]is a byte array that will be updated with the read data
Warning
dataPayload[] must be at least as big as the largest possible data payload, otherwise writing to out of bounds memory may occur
Returns
the number of bytes that were read from the TCAN4x5x and stored into dataPayload[]

Definition at line 828 of file TCAN4550.c.

References AHB_READ_32(), AHB_READ_BURST_END(), AHB_READ_BURST_READ(), AHB_READ_BURST_START(), AHB_WRITE_32(), TCAN4x5x_MCAN_RX_Header::ANMF, TCAN4x5x_MCAN_RX_Header::BRS, TCAN4x5x_MCAN_RX_Header::DLC, TCAN4x5x_MCAN_RX_Header::ESI, TCAN4x5x_MCAN_RX_Header::FDF, TCAN4x5x_MCAN_RX_Header::FIDX, TCAN4x5x_MCAN_RX_Header::ID, REG_MCAN_RXESC, REG_MCAN_RXF0A, REG_MCAN_RXF0C, REG_MCAN_RXF0S, REG_MCAN_RXF1A, REG_MCAN_RXF1C, REG_MCAN_RXF1S, REG_MRAM, TCAN4x5x_MCAN_RX_Header::RTR, RXFIFO1, TCAN4x5x_MCAN_RX_Header::RXTS, TCAN4x5x_MCAN_CACHE, TCAN4x5x_MCAN_CACHE_RXESC, TCAN4x5x_MCAN_CACHE_RXF0C, TCAN4x5x_MCAN_CACHE_RXF1C, TCAN4x5x_MCAN_DLCtoBytes(), TCAN4x5x_MCAN_TXRXESC_DataByteValue(), and TCAN4x5x_MCAN_RX_Header::XTD.

◆ TCAN4x5x_MCAN_ReadNominalTiming_Raw()

void TCAN4x5x_MCAN_ReadNominalTiming_Raw ( TCAN4x5x_MCAN_Nominal_Timing_Raw nomTiming)

Reads the MCAN nominal/arbitration time settings, using the raw MCAN timing struct.

Reads the MCAN nominal timing registers and updates the *nomTiming struct

Parameters
*nomTimingis a pointer of a TCAN4x5x_MCAN_Nominal_Timing_Raw struct containing the raw MCAN nominal timing information

Definition at line 431 of file TCAN4550.c.

References AHB_READ_32(), TCAN4x5x_MCAN_Nominal_Timing_Raw::NominalBitRatePrescaler, TCAN4x5x_MCAN_Nominal_Timing_Raw::NominalSyncJumpWidth, TCAN4x5x_MCAN_Nominal_Timing_Raw::NominalTimeSeg1andProp, TCAN4x5x_MCAN_Nominal_Timing_Raw::NominalTimeSeg2, and REG_MCAN_NBTP.

◆ TCAN4x5x_MCAN_ReadNominalTiming_Simple()

void TCAN4x5x_MCAN_ReadNominalTiming_Simple ( TCAN4x5x_MCAN_Nominal_Timing_Simple nomTiming)

Reads the MCAN nominal/arbitration time settings, using the simple timing struct.

Reads the MCAN nominal timing registers and updates the *nomTiming struct

Parameters
*nomTimingis a pointer of a TCAN4x5x_MCAN_Nominal_Timing_Simple struct containing the simplified nominal timing information

Definition at line 410 of file TCAN4550.c.

References AHB_READ_32(), TCAN4x5x_MCAN_Nominal_Timing_Simple::NominalBitRatePrescaler, TCAN4x5x_MCAN_Nominal_Timing_Simple::NominalTqAfterSamplePoint, TCAN4x5x_MCAN_Nominal_Timing_Simple::NominalTqBeforeSamplePoint, and REG_MCAN_NBTP.

◆ TCAN4x5x_MCAN_ReadRXBuffer()

uint8_t TCAN4x5x_MCAN_ReadRXBuffer ( uint8_t  bufIndex,
TCAN4x5x_MCAN_RX_Header header,
uint8_t  dataPayload[] 
)

Read the specified RX buffer element.

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
bufIndexis the RX buffer index to read from (starts at 0)
*headeris a pointer to a TCAN4x5x_MCAN_RX_Header struct containing the CAN-specific header information
dataPayload[]is a byte array that will be updated with the read data
Warning
dataPayload[] must be at least as big as the largest possible data payload, otherwise writing to out of bounds memory may occur
Returns
the number of bytes that were read from the TCAN4x5x and stored into dataPayload[]

Definition at line 964 of file TCAN4550.c.

References AHB_READ_32(), AHB_READ_BURST_END(), AHB_READ_BURST_READ(), AHB_READ_BURST_START(), AHB_WRITE_32(), TCAN4x5x_MCAN_RX_Header::ANMF, TCAN4x5x_MCAN_RX_Header::BRS, TCAN4x5x_MCAN_RX_Header::DLC, TCAN4x5x_MCAN_RX_Header::ESI, TCAN4x5x_MCAN_RX_Header::FDF, TCAN4x5x_MCAN_RX_Header::FIDX, TCAN4x5x_MCAN_RX_Header::ID, REG_MCAN_NDAT1, REG_MCAN_NDAT2, REG_MCAN_RXBC, REG_MCAN_RXESC, REG_MRAM, TCAN4x5x_MCAN_RX_Header::RTR, TCAN4x5x_MCAN_RX_Header::RXTS, TCAN4x5x_MCAN_CACHE, TCAN4x5x_MCAN_CACHE_RXBC, TCAN4x5x_MCAN_CACHE_RXESC, TCAN4x5x_MCAN_DLCtoBytes(), TCAN4x5x_MCAN_TXRXESC_DataByteValue(), and TCAN4x5x_MCAN_RX_Header::XTD.

◆ TCAN4x5x_MCAN_ReadSIDFilter()

bool TCAN4x5x_MCAN_ReadSIDFilter ( uint8_t  filterIndex,
TCAN4x5x_MCAN_SID_Filter filter 
)

Read a MCAN Standard ID filter from MRAM.

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

Parameters
filterIndexis the SID filter index in MRAM to read from (starts at 0)
*filteris a pointer to a TCAN4x5x_MCAN_SID_Filter struct that will be updated with the read MCAN filter
Returns
true if read was successful, false if not

Definition at line 1241 of file TCAN4550.c.

References AHB_READ_32(), REG_MCAN_SIDFC, REG_MRAM, TCAN4x5x_MCAN_CACHE, TCAN4x5x_MCAN_CACHE_SIDFC, and TCAN4x5x_MCAN_SID_Filter::word.

◆ TCAN4x5x_MCAN_TransmitBufferContents()

bool TCAN4x5x_MCAN_TransmitBufferContents ( uint8_t  bufIndex)

Transmit TX buffer contents of the specified tx buffer.

Writes the specified buffer index bit value into the TXBAR register to request a message to send

Parameters
bufIndexis the TX buffer index to write to (starts at 0)
Warning
Function does NOT check if the buffer contents are valid
Returns
true if the request was queued, false if the buffer value was invalid (out of range)

Definition at line 1173 of file TCAN4550.c.

References AHB_WRITE_32(), and REG_MCAN_TXBAR.

◆ TCAN4x5x_MCAN_TXRXESC_DataByteValue()

uint8_t TCAN4x5x_MCAN_TXRXESC_DataByteValue ( uint8_t  inputESCValue)

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

Parameters
inputESCValueis the value from an element size configuration register
Returns
The number of bytes of data (8-64 bytes)

Definition at line 1465 of file TCAN4550.c.

Referenced by TCAN4x5x_MCAN_ReadNextFIFO(), TCAN4x5x_MCAN_ReadRXBuffer(), TCAN4x5x_MCAN_WriteTXBuffer(), and TCAN4x5x_MRAM_Configure().

◆ TCAN4x5x_MCAN_WriteSIDFilter()

bool TCAN4x5x_MCAN_WriteSIDFilter ( uint8_t  filterIndex,
TCAN4x5x_MCAN_SID_Filter filter 
)

Write MCAN Standard ID filter into MRAM.

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

Parameters
filterIndexis the SID filter index in MRAM to write to (starts at 0)
*filteris a pointer to a TCAN4x5x_MCAN_SID_Filter struct containing the MCAN filter information
Returns
true if write was successful, false if not

Definition at line 1199 of file TCAN4550.c.

References AHB_READ_32(), AHB_WRITE_32(), REG_MCAN_SIDFC, REG_MRAM, TCAN4x5x_MCAN_CACHE, TCAN4x5x_MCAN_CACHE_SIDFC, and TCAN4x5x_MCAN_SID_Filter::word.

◆ TCAN4x5x_MCAN_WriteTXBuffer()

uint32_t TCAN4x5x_MCAN_WriteTXBuffer ( uint8_t  bufIndex,
TCAN4x5x_MCAN_TX_Header header,
uint8_t  dataPayload[] 
)

Write CAN message to the specified TX buffer.

This function will write a CAN message to a specified TX buffer that can be transmitted at a later time with the TCAN4x5x_MCAN_TransmitBufferContents() function

Parameters
bufIndexis the TX buffer index to write to (starts at 0)
*headeris a pointer to a TCAN4x5x_MCAN_TX_Header struct containing the CAN-specific header information
dataPayload[]is a byte array that contains the data payload
Warning
dataPayload[] must be at least as big as the specified DLC size inside the *header struct
Returns
the number of bytes that were read from the TCAN4x5x and stored into dataPayload[]

Definition at line 1064 of file TCAN4550.c.

References AHB_READ_32(), AHB_WRITE_BURST_END(), AHB_WRITE_BURST_START(), AHB_WRITE_BURST_WRITE(), TCAN4x5x_MCAN_TX_Header::BRS, TCAN4x5x_MCAN_TX_Header::DLC, TCAN4x5x_MCAN_TX_Header::EFC, TCAN4x5x_MCAN_TX_Header::ESI, TCAN4x5x_MCAN_TX_Header::FDF, TCAN4x5x_MCAN_TX_Header::ID, TCAN4x5x_MCAN_TX_Header::MM, REG_MCAN_TXBC, REG_MCAN_TXESC, TCAN4x5x_MCAN_TX_Header::RTR, TCAN4x5x_MCAN_CACHE, TCAN4x5x_MCAN_CACHE_TXBC, TCAN4x5x_MCAN_CACHE_TXESC, TCAN4x5x_MCAN_DLCtoBytes(), TCAN4x5x_MCAN_TXRXESC_DataByteValue(), and TCAN4x5x_MCAN_TX_Header::XTD.

◆ TCAN4x5x_MCAN_WriteXIDFilter()

bool TCAN4x5x_MCAN_WriteXIDFilter ( uint8_t  filterIndex,
TCAN4x5x_MCAN_XID_Filter filter 
)

Write MCAN Extended ID filter into MRAM.

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

Parameters
filterIndexis the XID filter index in MRAM to write to (starts at 0)
*filteris a pointer to a TCAN4x5x_MCAN_XID_Filter struct containing the MCAN filter information
Returns
true if write was successful, false if not

Definition at line 1277 of file TCAN4550.c.

References AHB_READ_32(), AHB_WRITE_32(), TCAN4x5x_MCAN_XID_Filter::EFEC, TCAN4x5x_MCAN_XID_Filter::EFID1, TCAN4x5x_MCAN_XID_Filter::EFID2, TCAN4x5x_MCAN_XID_Filter::EFT, REG_MCAN_XIDFC, REG_MRAM, TCAN4x5x_MCAN_CACHE, and TCAN4x5x_MCAN_CACHE_XIDFC.

◆ TCAN4x5x_MRAM_Clear()

void TCAN4x5x_MRAM_Clear ( void  )

Clear (Zero-fill) the contents of MRAM.

Write 0s to every address in MRAM. Useful for initializing the MRAM to known values during initial configuration so that accidental ECC errors do not happen

Definition at line 796 of file TCAN4550.c.

References AHB_WRITE_32(), MRAM_SIZE, and REG_MRAM.

◆ TCAN4x5x_MRAM_Configure()

bool TCAN4x5x_MRAM_Configure ( TCAN4x5x_MRAM_Config MRAMConfig)

Configures the MRAM registers.

Uses the *MRAMConfig 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 false if this is found to be the case.

Warning
This function writes to protected MCAN registers
Note
Requires that protected registers have been unlocked using TCAN4x5x_MCAN_EnableProtectedRegisters() and TCAN4x5x_MCAN_DisableProtectedRegisters() be used to lock the registers after configuration
Parameters
*MRAMConfigis a pointer of a TCAN4x5x_MRAM_Config struct containing the desired MRAM configuration
Returns
true if successful, otherwise return false

Definition at line 584 of file TCAN4550.c.

References AHB_READ_32(), AHB_WRITE_32(), MRAM_SIZE, REG_BITS_MCAN_RXF0C_F0OM_OVERWRITE, REG_BITS_MCAN_TXBC_TFQM, REG_MCAN_RXBC, REG_MCAN_RXESC, REG_MCAN_RXF0C, REG_MCAN_RXF1C, REG_MCAN_SIDFC, REG_MCAN_TXBC, REG_MCAN_TXEFC, REG_MCAN_TXESC, REG_MCAN_XIDFC, REG_MRAM, TCAN4x5x_MRAM_Config::Rx0ElementSize, TCAN4x5x_MRAM_Config::Rx0NumElements, TCAN4x5x_MRAM_Config::Rx1ElementSize, TCAN4x5x_MRAM_Config::Rx1NumElements, TCAN4x5x_MRAM_Config::RxBufElementSize, TCAN4x5x_MRAM_Config::RxBufNumElements, TCAN4x5x_MRAM_Config::SIDNumElements, TCAN4x5x_MCAN_CACHE, TCAN4x5x_MCAN_CACHE_RXBC, TCAN4x5x_MCAN_CACHE_RXESC, TCAN4x5x_MCAN_CACHE_RXF0C, TCAN4x5x_MCAN_CACHE_RXF1C, TCAN4x5x_MCAN_CACHE_SIDFC, TCAN4x5x_MCAN_CACHE_TXBC, TCAN4x5x_MCAN_CACHE_TXEFC, TCAN4x5x_MCAN_CACHE_TXESC, TCAN4x5x_MCAN_CACHE_XIDFC, TCAN4x5x_MCAN_TXRXESC_DataByteValue(), TCAN4x5x_MRAM_Config::TxBufferElementSize, TCAN4x5x_MRAM_Config::TxBufferNumElements, TCAN4x5x_MRAM_Config::TxEventFIFONumElements, and TCAN4x5x_MRAM_Config::XIDNumElements.

◆ TCAN4x5x_WDT_Configure()

bool TCAN4x5x_WDT_Configure ( TCAN4x5x_WDT_Timer_Enum  WDTtimeout)

Configure the watchdog.

Parameters
WDTtimeoutis an TCAN4x5x_WDT_Timer_Enum enum of different times for the watch dog window
Returns
true if successfully configured, or false otherwise

Definition at line 1814 of file TCAN4550.c.

References AHB_READ_32(), AHB_WRITE_32(), REG_BITS_DEVICE_MODE_WD_TIMER_3S, REG_BITS_DEVICE_MODE_WD_TIMER_600MS, REG_BITS_DEVICE_MODE_WD_TIMER_60MS, REG_BITS_DEVICE_MODE_WD_TIMER_6S, REG_BITS_DEVICE_MODE_WD_TIMER_MASK, REG_DEV_MODES_AND_PINS, TCAN4x5x_WDT_3S, TCAN4x5x_WDT_600MS, TCAN4x5x_WDT_60MS, and TCAN4x5x_WDT_6S.

◆ TCAN4x5x_WDT_Disable()

bool TCAN4x5x_WDT_Disable ( void  )

Disable the watchdog timer.

Returns
true if successfully disabled, or false otherwise

Definition at line 1908 of file TCAN4550.c.

References AHB_READ_32(), AHB_WRITE_32(), REG_BITS_DEVICE_MODE_WDT_EN, and REG_DEV_MODES_AND_PINS.

◆ TCAN4x5x_WDT_Enable()

bool TCAN4x5x_WDT_Enable ( void  )

Enable the watchdog timer.

Returns
true if successfully enabled, or false otherwise

Definition at line 1887 of file TCAN4550.c.

References AHB_READ_32(), AHB_WRITE_32(), REG_BITS_DEVICE_MODE_WDT_EN, and REG_DEV_MODES_AND_PINS.

◆ TCAN4x5x_WDT_Read()

TCAN4x5x_WDT_Timer_Enum TCAN4x5x_WDT_Read ( void  )

◆ TCAN4x5x_WDT_Reset()

void TCAN4x5x_WDT_Reset ( void  )

Reset the watchdog timer.

Definition at line 1927 of file TCAN4550.c.

References AHB_READ_32(), AHB_WRITE_32(), REG_BITS_DEVICE_MODE_WDT_RESET_BIT, and REG_DEV_MODES_AND_PINS.