123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338 |
- function error_handler_dissectors(buffer, pinfo, tree, TC_TM_PROTOCOL, offset, num_of_instance)
- -- Define the fields of the protocol
- --local f_fault_status_ind = ProtoField.uint8("TC_TM_PROTOCOL.fault_status_ind", "Fault Status Indication", base.HEX)
- local f_total_error_groups = ProtoField.uint8("TC_TM_PROTOCOL.total_error_groups", "Total Number of Error code present Groups", base.DEC)
- -- Define the fields for each error group and fault status
- local f_error_group_io = ProtoField.uint8("TC_TM_PROTOCOL.error_group_io", "Total Number of Error code present in IO", base.DEC)
- local f_fault_status_io = ProtoField.uint32("TC_TM_PROTOCOL.fault_status_io", "Fault Status of Group IO", base.HEX)
- local f_error_group_ahw_set_1 = ProtoField.uint8("TC_TM_PROTOCOL.error_group_ahw_set_1", "Total Number of Error code present in AHW_SET-1", base.DEC)
- local f_fault_status_ahw_set_1 = ProtoField.uint32("TC_TM_PROTOCOL.fault_status_ahw_set_1", "Fault Status of Group AHW_SET-1", base.HEX)
- local f_error_group_ahw_set_2 = ProtoField.uint8("TC_TM_PROTOCOL.error_group_ahw_set_2", "Total Number of Error code present in AHW_SET-2", base.DEC)
- local f_fault_status_ahw_set_2 = ProtoField.uint32("TC_TM_PROTOCOL.fault_status_ahw_set_2", "Fault Status of Group AHW_SET-2", base.HEX)
- local f_error_group_system_1 = ProtoField.uint8("TC_TM_PROTOCOL.error_group_system_1", "Total Number of Error code present in SYSTEM Group 1", base.DEC)
- local f_fault_status_system_1 = ProtoField.uint32("TC_TM_PROTOCOL.fault_status_system_1", "Fault Status of Group SYSTEM 1", base.HEX)
- local f_error_group_system_2 = ProtoField.uint8("TC_TM_PROTOCOL.error_group_system_2", "Total Number of Error code present in SYSTEM Group 2", base.DEC)
- local f_fault_status_system_2 = ProtoField.uint32("TC_TM_PROTOCOL.fault_status_system_2", "Fault Status of Group SYSTEM 2", base.HEX)
- local f_error_group_comms = ProtoField.uint8("TC_TM_PROTOCOL.error_group_comms", "Total Number of Error code present in COMMS", base.DEC)
- local f_fault_status_comms = ProtoField.uint32("TC_TM_PROTOCOL.fault_status_comms", "Fault Status of Group COMMS", base.HEX)
- local f_error_group_adcs = ProtoField.uint8("TC_TM_PROTOCOL.error_group_adcs", "Total Number of Error code present in ADCS", base.DEC)
- local f_fault_status_adcs = ProtoField.uint32("TC_TM_PROTOCOL.fault_status_adcs", "Fault Status of Group ADCS", base.HEX)
- local f_error_group_eps = ProtoField.uint8("TC_TM_PROTOCOL.error_group_eps", "Total Number of Error code present in EPS", base.DEC)
- local f_fault_status_eps = ProtoField.uint32("TC_TM_PROTOCOL.fault_status_eps", "Fault Status of Group EPS", base.HEX)
- -- Add all fields to the protocol
- TC_TM_PROTOCOL.fields = {
- f_total_error_groups,
- f_error_group_io, f_fault_status_io,
- f_error_group_ahw_set_1, f_fault_status_ahw_set_1,
- f_error_group_ahw_set_2, f_fault_status_ahw_set_2,
- f_error_group_system_1, f_fault_status_system_1,
- f_error_group_system_2, f_fault_status_system_2,
- f_error_group_comms, f_fault_status_comms,
- f_error_group_adcs, f_fault_status_adcs,
- f_error_group_eps, f_fault_status_eps
- }
- -- Create a subtree for the protocol
- local subtree = tree:add(TC_TM_PROTOCOL, buffer(), "ERROR HANDLER")
-
- for i = 0, num_of_instance - 1 do
-
- local subtree1 = subtree:add(TC_TM_PROTOCOL, buffer(), "INSTANCE "..i)
- -- Fault Status Indication (1 byte)
- --subtree1:add(f_fault_status_ind, buffer(offset, 1):le_uint())
- --offset = offset + 1
- -- Total Number of Error Groups (1 byte)
- subtree1:add(f_total_error_groups, buffer(offset, 1):le_uint())
- subtree1:add(" ")
- offset = offset + 1
- -- Dissect each error group based on the description
- -- Group IO
- local error_group_io = buffer(offset, 1):le_uint()
- subtree1:add(f_error_group_io, buffer(offset, 1):le_uint())
- offset = offset + 1
-
- local err_io_def = {
- "ERR_IO_I2C_FAIL",
- "ERR_IO_SPI_FAIL",
- "ERR_IO_CAN_FAIL",
- "ERR_IO_UART_FAIL",
- "ERR_IO_QSPI_FAIL",
- "ERR_IO_MAX"
- }
- local temp
- local temp1
- temp = buffer(offset, 4):le_uint()
- for i = 1 , error_group_io do
- temp1 = (temp >> i) & 0x01
-
- if temp1 == 0 then
- subtree1:add(f_fault_status_io, temp):set_text(string.format("ERROR CODE %d : NOFAULT - %s",i - 1,err_io_def[i]))
- elseif temp1 == 1 then
- subtree1:add(f_fault_status_io, temp):set_text(string.format("ERROR CODE %d : FAULT",i - 1,err_io_def[i]))
- end
- end
- offset = offset + 4
- subtree1:add(" ")
-
- -- Group AHW_SET-1
- local error_group_ahw_set_1 = buffer(offset, 1):uint()
- subtree1:add(f_error_group_ahw_set_1, buffer(offset, 1):le_uint())
- offset = offset + 1
-
-
- local err_ahw_def_set_1 = {
- "ERR_IMU_BMX160_OBC_1",
- "ERR_IMU_BMX160_OBC_2",
- "ERR_IMU_BMX160_XXX",
- "ERR_DIGITAL_THERMOSTAT_DS620_EDGE",
- "ERR_DIGITAL_THERMOSTAT_DS620_PS",
- "ERR_HSC_ADM1176_EDGE",
- "ERR_HSC_ADM1176_PS_2",
- "ERR_HSC_ADM1176_PS_1",
- "ERR_TEMP_SENSOR_MCP9843_OBC",
- "ERR_TEMP_SENSOR_MCP9843_PS",
- "ERR_TEMP_SENSOR_MCP9843_EDGE",
- "ERR_TEMP_SENSOR_MCP9843_GPS",
- "ERR_TEMP_SENSOR_MCP9843_SPE01",
- "ERR_TEMP_SENSOR_MCP9843_SPE02",
- "ERR_TEMP_SENSOR_MCP9843_SPW01",
- "ERR_TEMP_SENSOR_MCP9843_SPW02",
- "ERR_TEMP_SENSOR_MCP9843_SPB01",
- "ERR_PSM_INA230_OBC",
- "ERR_PSM_INA230_PS",
- "ERR_GPIO_EXPANDER_PCAL6408A_PS",
- "ERR_GPIO_EXPANDER_MCP23008_EDGE_1",
- "ERR_GPIO_EXPANDER_MCP23008_EDGE_2",
- "ERR_GPIO_EXPANDER_MCP23008_OBC_1",
- "ERR_GPIO_EXPANDER_MCP23008_OBC_2",
- "ERR_GPIO_EXPANDER_MCP23008_GPS",
- "ERR_THRUSTER_MORPHEUS_OBC",
- "ERR_VOLTAGE_SEQUENCER_UCD9801_OBC",
- "ERR_DATA_LOGGER_ADS7828_PS",
- "ERR_EXT_MEM_MX25L512_QSPI",
- "ERR_EXT_MEM_MT25QL512_QSPI",
- "ERR_EXT_MEM_S25HL512T_QSPI",
- "ERR_EXT_MEM_MT28EW128_FMC",
- "ERR_AHW_ONE_MAX"
- }
- temp = buffer(offset, 4):le_uint()
- for i = 1 , error_group_ahw_set_1 do
- temp1 = (temp >> i) & 0x01
-
- if temp1 == 0 then
- subtree1:add(f_fault_status_ahw_set_1, temp):set_text(string.format("ERROR CODE %d : NOFAULT - %s",i-1,err_ahw_def_set_1[i]))
- elseif temp1 == 1 then
- subtree1:add(f_fault_status_ahw_set_1, temp):set_text(string.format("ERROR CODE %d : FAULT - %s",i-1,err_ahw_def_set_1[i]))
- end
- end
- offset = offset + 4
- subtree1:add(" ")
- -- Group AHW_SET-2
- local error_group_ahw_set_2 = buffer(offset, 1):uint()
- subtree1:add(f_error_group_ahw_set_2, buffer(offset, 1):le_uint())
- offset = offset + 1
-
- local err_ahw_def_set_2 =
- {
- "ERR_UART_EXPANDER_MAX14830_OBC",
- "ERR_AHW_TWO_MAX"
- }
-
- temp = buffer(offset, 4):le_uint()
- for i = 1 , error_group_ahw_set_2 do
- temp1 = (temp >> i) & 0x01
-
- if temp1 == 0 then
- subtree1:add(f_fault_status_ahw_set_2, temp):set_text(string.format("ERROR CODE %d : NOFAULT - %s",i - 1,err_ahw_def_set_2[i]))
- elseif temp1 == 1 then
- subtree1:add(f_fault_status_ahw_set_2, temp):set_text(string.format("ERROR CODE %d : FAULT",i - 1,err_ahw_def_set_2[i]))
- end
- end
- offset = offset + 4
- subtree1:add(" ")
-
- local err_system_def = {
- "ERR_IRAM_HEAP_FREE_LESSER_THAN_16K",
- "ERR_IRAM_HEAP_FREE_LESSER_THAN_8K",
- "ERR_ERAM_HEAP_FREE_LESSER_THAN_16K",
- "ERR_ERAM_HEAP_FREE_LESSER_THAN_8K",
- "ERR_CMALLOC_FREE_LESSER_THAN_4K",
- "ERR_OBC_FW_UPDATE_FAIL",
- "ERR_SYS_MAX"
- }
- -- Group SYSTEM 1
- local error_group_system_1 = buffer(offset, 1):uint()
- subtree1:add(f_error_group_system_1, buffer(offset, 1):le_uint())
- offset = offset + 1
-
- temp = buffer(offset, 4):le_uint()
- for i = 1, error_group_system_1 do
- temp1 = (temp >> i) & 0x01
-
- if temp1 == 0 then
- subtree1:add(f_fault_status_system_1, temp):set_text(string.format("ERROR CODE %d : NOFAULT - %s",i - 1,err_system_def[i]))
- elseif temp1 == 1 then
- subtree1:add(f_fault_status_system_2, temp):set_text(string.format("ERROR CODE %d : FAULT - %s",i - 1,err_system_def[i]))
- end
- end
- offset = offset + 4
- subtree1:add(" ")
- -- Group SYSTEM 2
- local error_group_system_2 = buffer(offset, 1):uint()
- subtree1:add(f_error_group_system_2, buffer(offset, 1):le_uint())
- offset = offset + 1
-
- local err_services_def =
- {
- "ERR_SER_1",
- "ERR_SER_MAX"
- }
- temp = buffer(offset, 4):le_uint()
- for i = 1, error_group_system_2 do
- temp1 = (temp >> i) & 0x01
-
- if temp1 == 0 then
- subtree1:add(f_fault_status_system_2, temp):set_text(string.format("ERROR CODE %d : NOFAULT - %s",i - 1,err_services_def[i]))
- elseif temp1 == 1 then
- subtree1:add(f_fault_status_system_2, temp):set_text(string.format("ERROR CODE %d : FAULT - %s",i - 1,err_services_def[i]))
- end
- end
- offset = offset + 4
- subtree1:add(" ")
- -- Group COMMS
- local error_group_comms = buffer(offset, 1):uint()
- subtree1:add(f_error_group_comms, buffer(offset, 1):le_uint())
- offset = offset + 1
-
-
- local err_comms_modules_def =
- {
- "ERR_COMMS_PKT_DROP",
- "ERR_COMMS_PKT_LEN_MISMATCH",
- "ERR_COMMS_SBAND_BUSY",
- "ERR_COMMS_SBAND_TCP_READ_FAIL",
- "ERR_COMMS_SBAND_TCP_CONNECTION_FAIL",
- "ERR_COMMS_SBAND_OFF_VOLT_TEMP_EXCEED",
- "ERR_COMMS_NACK_RCV_UHF",
- "ERR_COMMS_RESTART_UHF",
- "ERR_COMMS_SBAND_RSP_CMD",
- "ERR_COMMS_SBAND_BUSY_TCP_WRITE",
- "ERR_COMMS_SBAND_READ_UDP_RX_FAIL",
- "ERR_COMMS_SBAND_UDP_TX_CONNECTION_FAIL",
- "ERR_COMMS_SBAND_SEND_UDP_TX_FAIL",
- "ERR_COMMS_SBAND_READ_UDP_TX_FAIL",
- "ERR_COMMS_SBAND_FW_UPD_FAIL",
- "ERR_COMMS_UHF_RSP_TIMEOUT",
- "ERR_COMMS_SBAND_CFG_STE_SET_RESET_FAIL",
- "ERR_COMMS_SBAND_CFG_GET_FEATURE_SELECT_FAIL",
- "ERR_COMMS_SBAND_CFG_GET_DEVICE_CFG_FAIL",
- "ERR_COMMS_SBAND_CFG_SET_DEVICE_CFG_FAIL",
- "ERR_COMMS_SBAND_CFG_SET_DEVICE_CFG_RX_TX_ON_FAIL",
- "ERR_COMMS_SBAND_CFG_SET_IP_ADR_CFG_FAIL",
- "ERR_COMMS_SBAND_CFG_SET_RX_RCV_CFG_FAIL",
- "ERR_COMMS_SBAND_DFU_STE_SET_RESET_FAIL",
- "ERR_COMMS_SBAND_DFU_GET_FEATURE_SELECT_FAIL",
- "ERR_COMMS_SBAND_DFU_GET_DEVICE_CFG_FAIL",
- "ERR_COMMS_SBAND_DFU_SET_DEVICE_CFG_FAIL",
- "ERR_COMMS_SBAND_DFU_SET_DEVICE_CFG_RX_TX_ON_FAIL",
- "ERR_COMMS_SBAND_DFU_SET_IP_ADR_CFG_FAIL",
- "ERR_COMMS_SBAND_DFU_SET_RX_RCV_CFG_FAIL",
- "ERR_COMMS_MAX"
- }
- temp = buffer(offset, 4):le_uint()
- for i = 1, error_group_comms do
- temp1 = (temp >> i) & 0x01
-
- if temp1 == 0 then
- subtree1:add(f_fault_status_comms, temp):set_text(string.format("ERROR CODE %d : NO FAULT- %s",i - 1,err_comms_modules_def[i]))
- elseif temp1 == 1 then
- subtree1:add(f_fault_status_comms, temp):set_text(string.format("ERROR CODE %d : FAULT - %s",i - 1,err_comms_modules_def[i]))
- end
- end
- offset = offset + 4
-
- subtree1:add(" ")
- -- Group ADCS
- local error_group_adcs = buffer(offset, 1):uint()
- subtree1:add(f_error_group_adcs, buffer(offset, 1):le_uint())
- offset = offset + 1
-
- local err_adcs_module_def =
- {
- "ERR_IO_INTERFACE_ERR",
- "ERR_OPERATION_FAILURE",
- "ERR_TC_TM_ERROR",
- "ERR_INVLD_PWR_STATE",
- "ERR_ADCS_MAX"
- }
-
- temp = buffer(offset, 4):le_uint()
- for i = 1, error_group_adcs do
- temp1 = (temp >> i) & 0x01
-
- if temp1 == 0 then
- subtree1:add(f_fault_status_adcs, temp):set_text(string.format("ERROR CODE %d : NOFAULT - %s",i - 1,err_adcs_module_def[i] ))
- elseif temp1 == 1 then
- subtree1:add(f_fault_status_adcs, temp):set_text(string.format("ERROR CODE %d : FAULT - %s",i - 1,err_adcs_module_def[i]))
- end
- end
- offset = offset + 4
-
- subtree1:add(" ")
- -- Group EPS
- local error_group_eps = buffer(offset, 1):uint()
- subtree1:add(f_error_group_eps, buffer(offset, 1):le_uint())
- offset = offset + 1
-
- local err_eps_def =
- {
- "ERR_EPS_COM_FAIL",
- "ERR_EPS_CRC_FAIL",
- "ERR_EPS_RESP_ERR",
- "ERR_EPS_CTRL_FW_MISMATCH",
- "ERR_EPS_MAX"
- }
- temp = buffer(offset, 4):le_uint()
- for i = 1, error_group_eps do
- temp1 = (temp >> i) & 0x01
-
- if temp1 == 0 then
- subtree1:add(f_fault_status_eps, temp):set_text(string.format("ERROR CODE %d : NOFAULT- %s",i - 1,err_eps_def[i]))
- elseif temp1 == 1 then
- subtree1:add(f_fault_status_eps, temp):set_text(string.format("ERROR CODE %d : FAULT - %s",i - 1,err_eps_def[i]))
- end
- end
- offset = offset + 4
-
- end
-
-
- end
|