foxBMS - Unit Tests  1.4.1
The foxBMS Unit Tests API Documentation
can_cfg.h File Reference

Headers for the configuration for the CAN module. More...

#include "general.h"
#include "HL_can.h"
#include "database.h"
Include dependency graph for can_cfg.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  CAN_BUFFER_ELEMENT_s
 
struct  CAN_SHIM_s
 
struct  CAN_MESSAGE_PROPERTIES_s
 
struct  CAN_TX_MESSAGE_TIMING_s
 
struct  CAN_RX_MESSAGE_TIMING_s
 
struct  CAN_TX_MESSAGE_TYPE_s
 
struct  CAN_RX_MESSAGE_TYPE_s
 

Macros

#define CAN_NODE_IMD   (CAN_NODE_1)
 
#define CAN_NODE_CURRENT_SENSOR   (CAN_NODE_1)
 
#define CAN_MAX_11BIT_ID   (2048u)
 
#define CAN_MAX_DLC   (8u)
 
#define CAN_DEFAULT_DLC   (8u)
 
#define CAN_FOXBMS_MESSAGES_DEFAULT_DLC   (8u)
 
#define CAN_NODE_1   (canREG1)
 
#define CAN_NODE_2   (canREG2)
 
#define CAN1_ENABLE_PIN   (PEX_PIN00)
 
#define CAN1_STANDBY_PIN   (PEX_PIN01)
 
#define CAN2_ENABLE_PIN   (PEX_PIN02)
 
#define CAN2_STANDBY_PIN   (PEX_PIN03)
 

Typedefs

typedef uint32_t(* CAN_TxCallbackFunction_f) (CAN_MESSAGE_PROPERTIES_s message, uint8_t *canData, uint8_t *pMuxId, const CAN_SHIM_s *const kpkCanShim)
 
typedef uint32_t(* CAN_RxCallbackFunction_f) (CAN_MESSAGE_PROPERTIES_s message, const uint8_t *const kpkCanData, const CAN_SHIM_s *const kpkCanShim)
 

Enumerations

enum  CAN_ENDIANNESS_e { CAN_LITTLE_ENDIAN , CAN_BIG_ENDIAN }
 

Variables

const CAN_SHIM_s can_kShim
 
const CAN_TX_MESSAGE_TYPE_s can_txMessages []
 
const CAN_RX_MESSAGE_TYPE_s can_rxMessages []
 
const uint8_t can_txLength
 
const uint8_t can_rxLength
 

Detailed Description

Headers for the configuration for the CAN module.

SPDX-License-Identifier: BSD-3-Clause

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

We kindly request you to use one or more of the following phrases to refer to foxBMS in your hardware, software, documentation or advertising materials:

  • ″This product uses parts of foxBMS®″
  • ″This product includes parts of foxBMS®″
  • ″This product is derived from foxBMS®″
Author
foxBMS Team
Date
2019-12-04 (date of creation)
Updated
2022-10-27 (date of last update)
Version
v1.4.1
Prefix
CAN

The activation and the length of the message buffers as well as the number of the messages that are received are to be configured here.

Definition in file can_cfg.h.

Macro Definition Documentation

◆ CAN1_ENABLE_PIN

#define CAN1_ENABLE_PIN   (PEX_PIN00)

Configuration of CAN transceiver pins to the respective port expander pins.

Definition at line 82 of file can_cfg.h.

◆ CAN1_STANDBY_PIN

#define CAN1_STANDBY_PIN   (PEX_PIN01)

Configuration of CAN transceiver pins to the respective port expander pins.

Definition at line 83 of file can_cfg.h.

◆ CAN2_ENABLE_PIN

#define CAN2_ENABLE_PIN   (PEX_PIN02)

Configuration of CAN transceiver pins to the respective port expander pins.

Definition at line 84 of file can_cfg.h.

◆ CAN2_STANDBY_PIN

#define CAN2_STANDBY_PIN   (PEX_PIN03)

Configuration of CAN transceiver pins to the respective port expander pins.

Definition at line 85 of file can_cfg.h.

◆ CAN_DEFAULT_DLC

#define CAN_DEFAULT_DLC   (8u)

Default DLC

Definition at line 93 of file can_cfg.h.

◆ CAN_FOXBMS_MESSAGES_DEFAULT_DLC

#define CAN_FOXBMS_MESSAGES_DEFAULT_DLC   (8u)

Default DLC for messages that are defined by the foxBMS project, i.e., not defined by third party software and/or hardware.

Definition at line 96 of file can_cfg.h.

◆ CAN_MAX_11BIT_ID

#define CAN_MAX_11BIT_ID   (2048u)

Maximum ID if 11 bits are used

Definition at line 89 of file can_cfg.h.

◆ CAN_MAX_DLC

#define CAN_MAX_DLC   (8u)

Maximum length of Data Length Code

Definition at line 91 of file can_cfg.h.

◆ CAN_NODE_1

#define CAN_NODE_1   (canREG1)

register on which the CAN interface is connected

Definition at line 71 of file can_cfg.h.

◆ CAN_NODE_2

#define CAN_NODE_2   (canREG2)

register on which the CAN interface is connected

Definition at line 72 of file can_cfg.h.

◆ CAN_NODE_CURRENT_SENSOR

#define CAN_NODE_CURRENT_SENSOR   (CAN_NODE_1)

Definition at line 76 of file can_cfg.h.

◆ CAN_NODE_IMD

#define CAN_NODE_IMD   (CAN_NODE_1)

Definition at line 75 of file can_cfg.h.

Typedef Documentation

◆ CAN_RxCallbackFunction_f

typedef uint32_t(* CAN_RxCallbackFunction_f) (CAN_MESSAGE_PROPERTIES_s message, const uint8_t *const kpkCanData, const CAN_SHIM_s *const kpkCanShim)

type definition for rx callback functions used in CAN messages

Definition at line 203 of file can_cfg.h.

◆ CAN_TxCallbackFunction_f

typedef uint32_t(* CAN_TxCallbackFunction_f) (CAN_MESSAGE_PROPERTIES_s message, uint8_t *canData, uint8_t *pMuxId, const CAN_SHIM_s *const kpkCanShim)

type definition for tx callback functions used in CAN messages

Definition at line 196 of file can_cfg.h.

Enumeration Type Documentation

◆ CAN_ENDIANNESS_e

Enum for byte order (endianness)

* CAN data example:
*
* LittleEndian
* bitStart = 27; bitLength = 19
* DataLE: 45-44-43-42-41-40-39-38-37-36-35-34-33-32-31-30-29-28-27
*         MSB                                                   LSB
*
* BigEndian
* bitStart = 21; bitLength = 19
* DataBE: 21-20-19-18-17-16-31-30-29-28-27-26-25-24-39-38-37-36-35
*         MSB                                                   LSB
*                                             |||
*                                   Receive data on CAN bus
*                                             |||
*                                             |||
*                                             \_/
*                  LE                          |                  BE
* CAN Data Byte 0  07 06 05 04 03 02 01 00     | CAN Data Byte 0  07 06 05 04 03 02 01 00
* CAN Data Byte 1  15 14 13 12 11 10 09 08     | CAN Data Byte 1  15 14 13 12 11 10 09 08
* CAN Data Byte 2  23 22 21 20 19 18 17 16     | CAN Data Byte 2  23 22 21-20-19-18-17-16 MSB
* CAN Data Byte 3  31-30-29-28-27 26 25 24 LSB | CAN Data Byte 3  31-30-29-28-27-26-25-24
* CAN Data Byte 4  39-38-37-36-35-34-33-32     | CAN Data Byte 4  39-38-37-36-35 34 33 32 LSB
* CAN Data Byte 5  47 46 45-44-43-42-41-40 MSB | CAN Data Byte 5  47 46 45 44 43 42 41 40
* CAN Data Byte 6  55 54 53 52 51 50 49 48     | CAN Data Byte 6  55 54 53 52 51 50 49 48
* CAN Data Byte 7  63 62 61 60 59 58 57 56     | CAN Data Byte 7  63 62 61 60 59 58 57 56
*                                             |||
*                                  Store received data in RAM
*                                             |||
*                                             |||
*                                             \_/
*                  LE                          |                  BE
* CAN Data Byte 7  63 62 61 60 59 58 57 56     | CAN Data Byte 0  07 06 05 04 03 02 01 00     | RAM data[7]
* CAN Data Byte 6  55 54 53 52 51 50 49 48     | CAN Data Byte 1  15 14 13 12 11 10 09 08     | RAM data[6]
* CAN Data Byte 5  47 46 45-44-43-42-41-40 MSB | CAN Data Byte 2  23 22 21-20-19-18-17-16 MSB | RAM data[5]
* CAN Data Byte 4  39-38-37-36-35-34-33-32     | CAN Data Byte 3  31-30-29-28-27-26-25-24     | RAM data[4]
* CAN Data Byte 3  31-30-29-28-27 26 25 24 LSB | CAN Data Byte 4  39-38-37-36-35 34 33 32 LSB | RAM data[3]
* CAN Data Byte 2  23 22 21 20 19 18 17 16     | CAN Data Byte 5  47 46 45 44 43 42 41 40     | RAM data[2]
* CAN Data Byte 1  15 14 13 12 11 10 09 08     | CAN Data Byte 6  55 54 53 52 51 50 49 48     | RAM data[1]
* CAN Data Byte 0  07 06 05 04 03 02 01 00     | CAN Data Byte 7  63 62 61 60 59 58 57 56     | RAM data[0]
*                                      DataLE  =  DataBE
* 
Enumerator
CAN_LITTLE_ENDIAN 
CAN_BIG_ENDIAN 

Definition at line 146 of file can_cfg.h.

Variable Documentation

◆ can_kShim

const CAN_SHIM_s can_kShim
extern

variable for storing and passing on the local database table handles

Definition at line 92 of file can_cfg.c.

◆ can_rxLength

const uint8_t can_rxLength
extern

length of CAN message arrays

Definition at line 92 of file can_cfg_rx.c.

◆ can_rxMessages

const CAN_RX_MESSAGE_TYPE_s can_rxMessages[]
extern

registry of CAN RX messages

Definition at line 74 of file can_cfg_rx.c.

◆ can_txLength

const uint8_t can_txLength
extern

array length for transmission CAN0 message definition

length of CAN message arrays

Definition at line 101 of file can_cfg_tx.c.

◆ can_txMessages

const CAN_TX_MESSAGE_TYPE_s can_txMessages[]
extern

registry of CAN TX messages

Definition at line 84 of file can_cfg_tx.c.