42#include "../../../revision.h"
43#include "can/can_interface.h"
44#include "system/pins.h"
49#include "../sources_common/Totempole_Application_Setup.h"
76 } __attribute__((packed))
bits;
99 REV_MAJOR,
'.',REV_MINOR,
'.',REV_PATCH,
100 ',',
' ',
's',
'e',
'c',
':',
' ',
'.',
'.',
'.',
'.',
'.',
'.',
'.'};
301 if (MSI1FIFOCSbits.RFFULL)
303 volatile uint16_t can_word_index;
315 for (can_word_index = 0; can_word_index < 3; can_word_index++)
317 can_sendbuffer[can_word_index << 1] = (uint8_t) (vin_avg[can_word_index] >> 8);
318 can_sendbuffer[(can_word_index << 1) + 1] = (uint8_t) (vin_avg[can_word_index] & 0x00FF);
328 for (can_word_index = 3; can_word_index < 7; can_word_index++)
330 can_sendbuffer[can_word_index << 1] = (uint8_t) (coreBuf[can_word_index] >> 8);
331 can_sendbuffer[(can_word_index << 1) + 1] = (uint8_t) (coreBuf[can_word_index] & 0x00FF);
336 uint16_t fifo_word_index = 0;
338 while (!MSI1FIFOCSbits.RFEMPTY)
344 if (fifo_word_index < 12)
367 uint16_t i2c_byte_index;
368 for (i2c_byte_index = 2; i2c_byte_index < 6; i2c_byte_index++)
370 int16_t temperature = (int16_t) ((int8_t) i2c_write_data.
frame.
array[i2c_byte_index] + 128);
373 can_sendbuffer[can_word_index << 1] = (uint8_t) (temperature >> 8);
374 can_sendbuffer[(can_word_index << 1) + 1] = (uint8_t) (temperature & 0x00FF);
378 static uint16_t transmit_firmware_version_counter = 100;
379 transmit_firmware_version_counter--;
380 if (transmit_firmware_version_counter <= 0)
389 transmit_firmware_version_counter = 2000;
This is the generated driver header file for the CAN1 driver using CCL.
This is the generated driver header file for the SEC_CORE1 driver.
static CAN_MSG_OBJ_t CANBRIDGE_MSGOBJ_RX
static CAN_MSG_OBJ_t CANBRIDGE_FIRMWARE_VERSION_TX
void CAN_TX_Obj_Init(void)
void CAN_Receive_from_GUI(void)
static CAN_MSG_OBJ_t CANBRIDGE_MSGOBJ_TX
void CAN_Transmit_to_GUI(void)
void Housekeeping_Flags_Update(void)
static uint8_t can_sendbuffer[64]
static uint8_t firmware_version[32]
static uint16_t protocolAData[5]
static uint16_t MSIFIFOrec[32]
static HOUSEKEEPING_STATUS_t housekeeping_status
void DRV_DMA_getVinAverage(uint16_t *vinAvg)
uint16_t * DRV_DMA_getCoreBuffer(void)
This is the driver header file for DMA driver.
I2C_t Drv_I2C_Get_Write_Data(void)
This is the driver header file for DMA driver.
bool Drv_SPI_get_Connected_Flag(void)
bool Drv_SPI_get_ChecksumOK_Flag(void)
This is the driver source file for spi builds upon mcc.
bool CAN1_Receive(struct CAN_MSG_OBJ *rxCanMsg)
Reads the received single message object.
uint8_t CAN1_ReceivedMessageCountGet(void)
Returns the number of CAN messages received in all the FIFO.
enum CAN_TX_MSG_REQUEST_STATUS CAN1_Transmit(const enum CAN1_TX_FIFO_CHANNELS fifoChannel, struct CAN_MSG_OBJ *txCanMsg)
Writes the CAN message object to specified transmit FIFO channel.
bool SEC_CORE1_ProtocolWrite(enum SEC_CORE_PROTOCOLS protocolName, uint16_t *pData)
This routine writes data to mailbox.
This data structure used to configure the CAN FD message object.
struct CAN_MSG_FIELD field
volatile uint8_t spi_connection_ok
Bit #13
volatile uint8_t aux_24v_ok
Bit #10.
volatile unsigned
Bit #14: unused
volatile uint8_t sic1_comms_ok
Bit #4.
struct HOUSEKEEPING_STATUS_s::@0::@2 bits
volatile uint8_t aux_5v_ok
Bit #8.
volatile uint8_t sic1_5v_ok
Bit #0.
volatile uint8_t sic2_comms_ok
Bit #5.
volatile uint8_t sic3_5v_ok
Bit #2.
volatile uint8_t aux_comms_ok
Bit #11.
volatile uint8_t aux_12v_ok
Bit #9.
volatile uint8_t sic3_comms_ok
Bit #6.
volatile uint8_t sic4_comms_ok
Bit #7.
volatile uint8_t sic4_5v_ok
Bit #3.
volatile uint8_t sic2_5v_ok
Bit #1.
volatile uint8_t spi_checksum_ok
Bit #12.
volatile bool cmd_ok
Bit #0: flag indicating the validity of the command byte.
struct I2C_STATUS_s::@3::@5 bits
volatile bool timeout
Bit #3: flag indicating that I2C message has not been received withing timeout period.
volatile uint8_t sic4
Bit 6:7
struct SIC_FLAGS_s::@6::@8 bits
volatile uint8_t sic2
Bit 2:3
volatile uint8_t sic3
Bit 4:5
volatile uint8_t sic1
Bit 0:1
volatile uint8_t _24v
Bit 4:5 -> 0 = no fault.
struct AUX_FLAGS_s::@9::@11 bits
volatile uint8_t _5v
Bit 0:1 -> 0 = no fault
volatile uint8_t _12v
Bit 2:3 -> 0 = no fault.
uint8_t array[I2C_WRITE_BUFFER_SIZE]
struct SIC_CLIENT_RECEIVE_FRAME_s::@12::@14 bytes
SIC_FLAGS_t sic_status_flags
AUX_FLAGS_t aux_fault_flags
SIC_CLIENT_RECEIVE_FRAME_t frame
buffer to store I2C data
I2C_STATUS_t status
status flags