Decoding Power Distribution Error Codes

As we have a limited number of CAN message ids, it was determined that fault messages should be grouped together as possible. The format of these error messages, identified as SYSTEM_CAN_MESSAGE_[REAR/FRONT]_PD_FAULT respectively is as follows:

msg { id: 61 source: POWER_DISTRIBUTION_REAR target: "CENTRE_CONSOLE" msg_name: "rear pd fault" can_data { u16 { field_name_1: "Fault data" field_name_2: "enclosure temp data" field_name_3: "dcdc temp data" field_name_4: "reference voltage" } } }

 

msg { id: 62 source: POWER_DISTRIBUTION_FRONT target: "CENTRE_CONSOLE" msg_name: "front pd fault" can_data { u16 { field_name_1: "fault_data" } }

The fault data uint16 represents 16 error flags, described in pd_error_defs.h, this field is common to both messages

// Errors flags for PD voltage regulator #define PD_5V_REG_ERROR 0x01 // Indicates error condition has arisen #define PD_5V_REG_DATA 0x02 // Holds a VoltageRegulatorError enum value // Fan Status values - indicates respective fan failure #define FAN1_ERR FAN1_STATUS // (0x04) #define FAN2_ERR FAN2_STATUS // (0x08) #define FAN3_ERR FAN3_STATUS // (0x10) #define FAN4_ERR FAN4_STATUS // (0x20) // Fan control overtemp flags #define FAN_OVERTEMP 0x40 // Indicates if overtemp condition triggered #define DCDC_OVERTEMP 0x80 // DCDC over-temp condition #define ENCLOSURE_OVERTEMP 0x100 // ENCLOSURE VENTILATION over-temp condition #define ERR_VCC_EXCEEDED 0x200 // Indicated an overvoltage in the fan controller

So far, 10 values are being used, and there are room for 6 more. However, PD_5V_REG_DATA and ERR_VCC_EXCEEDED are just for extra information, and can be removed if other functionality is needed.

In addition, there are three data fields in the rear pd message used to transmit temperature data. These can be used for different purposes as needed, and added to front pd if necessary

To decode, include pd_error_defs.h in your file, and unpack the can message using the codegen-tooling libraries. For each condition you want to check against, use a bitwise & with the fault data uint16_t, ie to check for a fan1 error: (front_pd_fault_data_u16 & FAN1_ERR)