63 #include "HL_reg_system.h"
75 #define CAN_TIMING_LOWER_LIMIT_COUNTS (95u)
78 #define CAN_TIMING_UPPER_LIMIT_COUNTS (105u)
81 #define CAN_HAL_RETVAL_NO_DATA_LOST (1u)
131 #if CURRENT_SENSOR_PRESENT == true
214 if (canIsTxMessagePending(pNode, messageBox) == 0u) {
219 canUpdateID(pNode, messageBox, ((
id << 18u) | (1u << 29u)));
220 canTransmit(pNode, messageBox, pData);
237 static uint32_t counterTicks = 0;
238 uint8_t data[8] = {0};
259 uint32_t current_time;
262 #if CURRENT_SENSOR_PRESENT == true
283 #if CURRENT_SENSOR_PRESENT == true
353 if (command ==
true) {
360 #if CURRENT_SENSOR_PRESENT == true
362 if (command ==
true) {
374 if (command ==
true) {
386 if (command ==
true) {
431 uint32_t retval = canGetData(pNode, messageBox, (uint8 *)&messageData[0]);
438 uint32_t
id = canGetID(pNode, messageBox) >> 18u;
441 can_rxBuffer.
id = id;
442 can_rxBuffer.
data[0] = messageData[0];
443 can_rxBuffer.
data[1] = messageData[1];
444 can_rxBuffer.
data[2] = messageData[2];
445 can_rxBuffer.
data[3] = messageData[3];
446 can_rxBuffer.
data[4] = messageData[4];
447 can_rxBuffer.
data[5] = messageData[5];
448 can_rxBuffer.
data[6] = messageData[6];
449 can_rxBuffer.
data[7] = messageData[7];
475 #ifdef UNITY_UNIT_TEST
#define BS_COULOMB_COUNTING_MEASUREMENT_RESPONSE_TIMEOUT_MS
#define BS_ENERGY_COUNTING_MEASUREMENT_RESPONSE_TIMEOUT_MS
#define BS_NR_OF_STRINGS
Number of parallel strings in the battery pack.
#define BS_CURRENT_MEASUREMENT_RESPONSE_TIMEOUT_MS
Headers for the driver for the insulation monitoring.
static void CAN_RxInterrupt(canBASE_t *pNode, uint32 messageBox)
Called in case of CAN RX interrupt.
bool CAN_IsCurrentSensorCcPresent(uint8_t stringNumber)
get flag if CC message from current sensor is received.
void CAN_MainFunction(void)
Calls the functions to drive the CAN interface. Makes the CAN timing checks and sends the periodic me...
static void CAN_ValidateConfiguredTxMessagePeriod(void)
static void CAN_SetCurrentSensorCcPresent(bool command, uint8_t stringNumber)
Sets flag to indicate current sensor sends C-C values.
static STD_RETURN_TYPE_e CAN_PeriodicTransmit(void)
Handles the processing of messages that are meant to be transmitted. This function looks for the repe...
CAN_STATE_s * TEST_CAN_GetCANState(void)
#define CAN_HAL_RETVAL_NO_DATA_LOST
static void CAN_CheckCanTiming(void)
Checks if the CAN messages come in the specified time window If the (current time stamp) - (previous ...
#define CAN_TIMING_LOWER_LIMIT_COUNTS
static void CAN_InitializeTransceiver(void)
void UNIT_TEST_WEAK_IMPL canMessageNotification(canBASE_t *node, uint32 messageBox)
bool CAN_IsCurrentSensorEcPresent(uint8_t stringNumber)
get flag if EC message from current sensor is received
static void CAN_TxInterrupt(canBASE_t *pNode, uint32 messageBox)
Called in case of CAN TX interrupt.
STD_RETURN_TYPE_e CAN_DataSend(canBASE_t *pNode, uint32_t id, uint8 *pData)
Sends over CAN the data passed in parameters. This function goes over the message boxes and marks the...
void CAN_ReadRxBuffer(void)
Checks the data received per CAN. A receive buffer is used because CAN frames are received in an inte...
bool CAN_IsCurrentSensorPresent(uint8_t stringNumber)
set flag for presence of current sensor.
static void CAN_SetCurrentSensorEcPresent(bool command, uint8_t stringNumber)
Sets flag to indicate current sensor sends C-C values.
#define CAN_TIMING_UPPER_LIMIT_COUNTS
static void CAN_SetCurrentSensorPresent(bool command, uint8_t stringNumber)
Sets flag to indicate current sensor is present.
void CAN_Initialize(void)
Enables the CAN transceiver.. This function sets th pins to enable the CAN transceiver....
static CAN_STATE_s can_state
void CAN_EnablePeriodic(bool command)
enable/disable the periodic transmit/receive.
Header for the driver for the CAN module.
#define CAN_NR_OF_TX_MESSAGE_BOX
const CAN_SHIM_s can_kShim
const CAN_RX_MESSAGE_TYPE_s can_rxMessages[]
const uint8_t can_txLength
const CAN_TX_MESSAGE_TYPE_s can_txMessages[]
const uint8_t can_rxLength
Headers for the helper functions for the CAN module.
#define DATA_READ_DATA(...)
@ DATA_BLOCK_ID_CURRENT_SENSOR
@ DATA_BLOCK_ID_ERRORSTATE
@ DATA_BLOCK_ID_STATEREQUEST
DIAG_RETURNTYPE_e DIAG_Handler(DIAG_ID_e diagId, DIAG_EVENT_e event, DIAG_IMPACT_LEVEL_e impact, uint32_t data)
DIAG_Handler provides generic error handling, based on diagnosis group.
@ DIAG_ID_CAN_CC_RESPONDING
@ DIAG_ID_CURRENT_SENSOR_RESPONDING
@ DIAG_ID_CAN_RX_QUEUE_FULL
@ DIAG_ID_CAN_EC_RESPONDING
#define FAS_ASSERT(x)
Assertion macro that asserts that x is true.
#define FAS_TRAP
Define that evaluates to essential boolean false thus tripping an assert.
math library for often used math functions
#define NULL_PTR
Null pointer.
Header of task driver implementation.
volatile bool ftsk_allQueuesCreated
QueueHandle_t ftsk_canRxQueue
#define GEN_REPEAT_U(x, n)
Macro that helps to generate a series of literals (for array initializers).
#define UNIT_TEST_WEAK_IMPL
OS_STD_RETURN_e OS_ReceiveFromQueue(OS_QUEUE xQueue, void *const pvBuffer, uint32_t ticksToWait)
Receive an item from a queue.
OS_STD_RETURN_e OS_SendToBackOfQueueFromIsr(OS_QUEUE xQueue, const void *const pvItemToQueue, long *const pxHigherPriorityTaskWoken)
Post an item to the back the provided queue during an ISR.
void OS_ExitTaskCritical(void)
Exit Critical interface function for use in FreeRTOS-Tasks and FreeRTOS-ISR.
void OS_EnterTaskCritical(void)
Enter Critical interface function for use in FreeRTOS-Tasks and FreeRTOS-ISR.
uint32_t OS_GetTickCount(void)
Returns OS based system tick value.
void PEX_SetPin(uint8_t portExpander, uint8_t pin)
sets pin to high.
void PEX_SetPinDirectionOutput(uint8_t portExpander, uint8_t pin)
sets pin to input.
Header for the driver for the NXP PCA9539 port expander module.
#define PEX_PORT_EXPANDER2
uint8_t data[CAN_MAX_DLC]
CAN_RxCallbackFunction_f callbackFunction
CAN_MESSAGE_PROPERTIES_s message
bool currentSensorCCPresent[BS_NR_OF_STRINGS]
bool currentSensorECPresent[BS_NR_OF_STRINGS]
bool currentSensorPresent[BS_NR_OF_STRINGS]
CAN_TxCallbackFunction_f callbackFunction
CAN_TX_MESSAGE_TIMING_s timing
uint32_t timestampCurrent[BS_NR_OF_STRINGS]
DATA_BLOCK_HEADER_s header
uint32_t timestampEnergyCounting[BS_NR_OF_STRINGS]
uint32_t timestampCurrentCounting[BS_NR_OF_STRINGS]
DATA_BLOCK_HEADER_s header
DATA_BLOCK_HEADER_s header
Header file for the version information that is generated by the toolchain.