foxBMS
1.1.1
The foxBMS Battery Management System API Documentation
|
Headers for the configuration for the CAN module. More...
Go to the source code of this file.
Data Structures | |
struct | CAN_BUFFERELEMENT |
struct | CAN_SHIM |
struct | CAN_MSG_TX_TYPE |
struct | CAN_MSG_RX_TYPE |
Typedefs | |
typedef struct CAN_BUFFERELEMENT | CAN_BUFFERELEMENT_s |
typedef enum CAN_ENDIANNESS | CAN_ENDIANNESS_e |
typedef struct CAN_SHIM | CAN_SHIM_s |
typedef uint32_t(* | can_callback_funcPtr) (uint32_t ID, uint8_t DLC, CAN_ENDIANNESS_e endianness, uint8_t *candata, uint8_t *pMuxId, const CAN_SHIM_s *const kpkCanShim) |
typedef struct CAN_MSG_TX_TYPE | CAN_MSG_TX_TYPE_s |
typedef struct CAN_MSG_RX_TYPE | CAN_MSG_RX_TYPE_s |
Enumerations | |
enum | CAN_ENDIANNESS { CAN_LITTLE_ENDIAN , CAN_BIG_ENDIAN } |
Variables | |
const CAN_SHIM_s | can_kShim |
const CAN_MSG_TX_TYPE_s | can_txMessages [] |
const CAN_MSG_RX_TYPE_s | can_rxMessages [] |
const uint8_t | can_txLength |
const uint8_t | can_rxLength |
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:
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:
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.
#define CAN_HET1_EN_PIN (14U) |
#define CAN_HET1_GIO (hetREG1) |
#define CAN_HET1_STB_PIN (16U) |
#define CAN_ID_BOOT_MESSAGE (0x199u) |
#define CAN_ID_COMMAND (0x230U) |
#define CAN_ID_DEBUG (0x200U) |
#define CAN_ID_IMD_INFO (0x37U) |
----------------------—CAUTION----------------------— The 3 following defines are used by the insulation monitoring device (IMD). If they are changed, the IMD will not work anymore ----------------------—CAUTION----------------------— CAN message ID for info message from iso165c
#define CAN_ID_IMD_REQUEST (0x22U) |
#define CAN_ID_IMD_RESPONSE (0x23U) |
#define CAN_ID_SOFTWARE_RESET (0x95U) |
#define CAN_ID_SW_VERSION (0x777U) |
#define CAN_ID_TX_LIMIT_VALUES (0x224U) |
#define CAN_ID_TX_MINIMUM_MAXIMUM_VALUES (0x223U) |
#define CAN_ID_TX_PACK_STATE_ESTIMATION (0x225U) |
#define CAN_ID_TX_PACK_VALUES (0x222U) |
#define CAN_ID_TX_STATE (0x220U) |
#define CAN_ID_TX_STRING_MINIMUM_MAXIMUM (0x281U) |
#define CAN_ID_TX_STRING_STATE (0x221U) |
#define CAN_ID_TX_STRING_STATE_ESTIMATION (0x282U) |
#define CAN_ID_TX_STRING_VALUES (0x280U) |
#define CAN_ID_TX_STRING_VALUES_2 (0x283U) |
#define CAN_ID_TX_TEMPERATURES (0x250U) |
#define CAN_MAX_11BIT_ID (2048u) |
#define CAN_MAX_DLC (8u) |
#define CAN_PIN_TOGGLE_DELAY_US (5u) |
delay in µs used in CAN_InitializeTransceiver for pin-toggling
#define CAN_TX_LIMIT_VALUES_PERIOD_MS (100U) |
#define CAN_TX_LIMIT_VALUES_PHASE_MS (30U) |
#define CAN_TX_MINIMUM_MAXIMUM_VALUES_PERIOD_MS (100U) |
#define CAN_TX_MINIMUM_MAXIMUM_VALUES_PHASE_MS (40U) |
#define CAN_TX_PACK_STATE_ESTIMATION_PERIOD_MS (1000U) |
#define CAN_TX_PACK_STATE_ESTIMATION_PHASE_MS (50U) |
#define CAN_TX_PACK_VALUES_PERIOD_MS (100U) |
#define CAN_TX_PACK_VALUES_PHASE_MS (60U) |
#define CAN_TX_STATE_PERIOD_MS (100U) |
#define CAN_TX_STATE_PHASE_MS (0U) |
#define CAN_TX_STRING_MINIMUM_MAXIMUM_PERIOD_MS (100U) |
#define CAN_TX_STRING_MINIMUM_MAXIMUM_PHASE_MS (90U) |
#define CAN_TX_STRING_STATE_ESTIMATION_PERIOD_MS (1000U) |
#define CAN_TX_STRING_STATE_ESTIMATION_PHASE_MS (0U) |
#define CAN_TX_STRING_STATE_PERIOD_MS (100U) |
#define CAN_TX_STRING_STATE_PHASE_MS (70U) |
#define CAN_TX_STRING_VALUES_2_PERIOD_MS (100U) |
#define CAN_TX_STRING_VALUES_2_PHASE_MS (10U) |
#define CAN_TX_STRING_VALUES_PERIOD_MS (100U) |
#define CAN_TX_STRING_VALUES_PHASE_MS (80U) |
#define CAN_TX_TEMPERATURES_PERIOD_MS (200U) |
#define CAN_TX_TEMPERATURES_PHASE_MS (20U) |
#define CAN_TX_VOLTAGES_PERIOD_MS (100U) |
#define CAN_TX_VOLTAGES_PHASE_MS (10U) |
typedef struct CAN_BUFFERELEMENT CAN_BUFFERELEMENT_s |
Buffer element used to store the ID and data of a CAN RX message
typedef uint32_t(* can_callback_funcPtr) (uint32_t ID, uint8_t DLC, CAN_ENDIANNESS_e endianness, uint8_t *candata, uint8_t *pMuxId, const CAN_SHIM_s *const kpkCanShim) |
typedef enum CAN_ENDIANNESS 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 *
typedef struct CAN_MSG_RX_TYPE CAN_MSG_RX_TYPE_s |
type definition for structure of an RX CAN message
typedef struct CAN_MSG_TX_TYPE CAN_MSG_TX_TYPE_s |
type definition for structure of a TX CAN message
typedef struct CAN_SHIM CAN_SHIM_s |
composite type for storing and passing on the local database table handles
enum CAN_ENDIANNESS |
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 |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |