From 77f293f789b8b87c72cf66ce87346a8f947f00d1 Mon Sep 17 00:00:00 2001 From: "Jakob.Meier" Date: Fri, 5 Feb 2021 07:37:21 +0100 Subject: [PATCH] save before changing pdu hk table dataset --- bsp_q7s/comIF/CspComIF.cpp | 76 +++++-- bsp_q7s/comIF/CspComIF.h | 4 +- fsfw | 2 +- mission/devices/GomspaceDeviceHandler.cpp | 10 +- mission/devices/GomspaceDeviceHandler.h | 4 +- mission/devices/PCDUHandler.cpp | 29 ++- mission/devices/PDU1Handler.cpp | 5 +- mission/devices/PDU2Handler.cpp | 31 ++- .../devicedefinitions/GomspaceDefinitions.h | 186 +++++++++++++----- 9 files changed, 257 insertions(+), 90 deletions(-) diff --git a/bsp_q7s/comIF/CspComIF.cpp b/bsp_q7s/comIF/CspComIF.cpp index cf72be94..b6505d14 100644 --- a/bsp_q7s/comIF/CspComIF.cpp +++ b/bsp_q7s/comIF/CspComIF.cpp @@ -145,34 +145,76 @@ ReturnValue_t CspComIF::readReceivedMessage(CookieIF *cookie, } ReturnValue_t CspComIF::cspTransfer(uint8_t cspAddress, uint8_t cspPort, - const uint8_t* cmdBuffer, int cmdBufferLen, uint16_t querySize) { + const uint8_t* cmdBuffer, int cmdLen, uint16_t querySize) { - uint32_t timeout_ms = 500; + uint32_t timeout_ms = 1000; + uint16_t bytesRead = 0; + int32_t expectedSize = (int32_t)querySize; vectorBufferIter iter = cspDeviceMap.find(cspAddress); if(iter == cspDeviceMap.end()){ sif::error << "CSP device with address " << cspAddress << " no found in" << " device map" << std::endl; } uint8_t* replyBuffer = iter->second.data(); - uint8_t tmpCmdBuffer[cmdBufferLen]; - memcpy(tmpCmdBuffer, cmdBuffer, cmdBufferLen); +// uint8_t tmpCmdBuffer[cmdBufferLen]; +// memcpy(tmpCmdBuffer, cmdBuffer, cmdBufferLen); csp_conn_t * conn = csp_connect(CSP_PRIO_HIGH, cspAddress, cspPort, 0, CSP_O_NONE); - int result = csp_transaction_persistent(conn, timeout_ms, - tmpCmdBuffer, cmdBufferLen, replyBuffer, querySize); - if(querySize != 0){ - if(result != querySize){ - sif::error << "CSP transfer failed to receive all requested bytes " - << std::endl; - return HasReturnvaluesIF::RETURN_FAILED; - } - } else { - if(result != 1){ - sif::error << "CSP transfer failed" << std::endl; - return HasReturnvaluesIF::RETURN_FAILED; - } +// int result = csp_transaction_persistent(conn, timeout_ms, +// tmpCmdBuffer, cmdBufferLen, replyBuffer, querySize); + + csp_packet_t* commandPacket = (csp_packet_t*)csp_buffer_get(cmdLen); + if (commandPacket == NULL) { + sif::error << "CspComIF::cspTransfer: Failed to get memory for a csp packet from the csp " + << "stack" << std::endl; + return RETURN_FAILED; + } + + memcpy(commandPacket->data, cmdBuffer, cmdLen); + commandPacket->length = cmdLen; + + if (!csp_send(conn, commandPacket, timeout_ms)) { + csp_buffer_free(commandPacket); + sif::error << "CspComIF::cspTransfer: Failed to send csp packet" << std::endl; + return RETURN_FAILED; + } + + /* Return when no reply is expected */ + if (expectedSize == 0) { + return RETURN_OK; + } + + csp_packet_t * reply; + reply = csp_read(conn, timeout_ms); + if (reply == NULL) { + sif::error << "CspComIF::cspTransfer: Failed to read csp packet" << std::endl; + return RETURN_FAILED; + } + memcpy(replyBuffer, reply->data, reply->length); + expectedSize = expectedSize - reply->length; + bytesRead += reply->length; + csp_buffer_free(reply); + while (expectedSize > 0) { + reply = csp_read(conn, timeout_ms); + if (reply == NULL) { + sif::error << "CspComIF::cspTransfer: Failed to read csp packet" << std::endl; + return RETURN_FAILED; + } + if ((reply->length + bytesRead) > iter->second.size()) { + sif::error << "CspComIF::cspTransfer: Reply buffer to short" << std::endl; + return RETURN_FAILED; + } + memcpy(replyBuffer + bytesRead, reply->data, reply->length); + expectedSize = expectedSize - reply->length; + bytesRead += reply->length; + csp_buffer_free(reply); + } + + if(expectedSize != 0){ + sif::error << "CspComIF::cspTransfer: Received more bytes than requested" << std::endl; + return RETURN_FAILED; } csp_close(conn); diff --git a/bsp_q7s/comIF/CspComIF.h b/bsp_q7s/comIF/CspComIF.h index 626b466c..78f5158f 100644 --- a/bsp_q7s/comIF/CspComIF.h +++ b/bsp_q7s/comIF/CspComIF.h @@ -40,11 +40,11 @@ private: * functions. Specifies how long the functions wait * for a successful operation. * @param cmdBuffer The data to send. - * @param cmpBuffer The number of bytes to send. + * @param cmdLen The number of bytes to send. * @param querySize The size of the requested message. */ ReturnValue_t cspTransfer(uint8_t cspAddress, uint8_t cspPort, - const uint8_t* cmdBuffer, int cmdBufferLen, uint16_t querySize); + const uint8_t* cmdBuffer, int cmdLen, uint16_t querySize); enum Ports { CSP_PING = 1, diff --git a/fsfw b/fsfw index 41c0436e..2104d3f3 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 41c0436e29f7a75f737f75e963dc2119a64a3921 +Subproject commit 2104d3f38a409a46210849ea23b0ea7fc7efe617 diff --git a/mission/devices/GomspaceDeviceHandler.cpp b/mission/devices/GomspaceDeviceHandler.cpp index 66ec1d89..f02548c2 100644 --- a/mission/devices/GomspaceDeviceHandler.cpp +++ b/mission/devices/GomspaceDeviceHandler.cpp @@ -3,9 +3,9 @@ GomspaceDeviceHandler::GomspaceDeviceHandler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie, uint16_t maxConfigTableAddress, uint16_t maxHkTableAddress, - uint16_t hkTableSize, LocalPoolDataSetBase* hkTableDataset) : + uint16_t hkTableReplySize, LocalPoolDataSetBase* hkTableDataset) : DeviceHandlerBase(objectId, comIF, comCookie), maxConfigTableAddress(maxConfigTableAddress), - maxHkTableAddress(maxHkTableAddress), hkTableSize(hkTableSize), hkTableDataset(hkTableDataset) { + maxHkTableAddress(maxHkTableAddress), hkTableReplySize(hkTableReplySize), hkTableDataset(hkTableDataset) { mode = MODE_NORMAL; if (comCookie == NULL) { sif::error << "GomspaceDeviceHandler::GomspaceDeviceHandler: Invalid com cookie" @@ -76,7 +76,7 @@ ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand( break; } case(GOMSPACE::REQUEST_HK_TABLE): { - result = generateRequestFullHkTableCmd(hkTableSize); + result = generateRequestFullHkTableCmd(hkTableReplySize); if(result != HasReturnvaluesIF::RETURN_OK){ return result; } @@ -357,9 +357,9 @@ ReturnValue_t GomspaceDeviceHandler::generateResetWatchdogCmd(){ return HasReturnvaluesIF::RETURN_OK; } -ReturnValue_t GomspaceDeviceHandler::generateRequestFullHkTableCmd(uint16_t hkTableSize) { +ReturnValue_t GomspaceDeviceHandler::generateRequestFullHkTableCmd(uint16_t hkTableReplySize) { - uint16_t querySize = hkTableSize + GOMSPACE::GS_HDR_LENGTH; + uint16_t querySize = hkTableReplySize; uint8_t tableId = HK_TABLE_ID; RequestFullTableCommand requestFullTableCommand(querySize, tableId); diff --git a/mission/devices/GomspaceDeviceHandler.h b/mission/devices/GomspaceDeviceHandler.h index 7bdefef3..bd67f989 100644 --- a/mission/devices/GomspaceDeviceHandler.h +++ b/mission/devices/GomspaceDeviceHandler.h @@ -51,8 +51,8 @@ protected: uint16_t maxConfigTableAddress; uint16_t maxHkTableAddress; - /** The size of the housekeeping table (table id 4) */ - uint16_t hkTableSize; + /** The size of the reply following a full hk table request.*/ + uint16_t hkTableReplySize; LocalPoolDataSetBase* hkTableDataset = nullptr; diff --git a/mission/devices/PCDUHandler.cpp b/mission/devices/PCDUHandler.cpp index aaa70c07..0508d56c 100644 --- a/mission/devices/PCDUHandler.cpp +++ b/mission/devices/PCDUHandler.cpp @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include PCDUHandler::PCDUHandler(object_id_t setObjectId, size_t cmdQueueSize) : @@ -85,7 +85,7 @@ void PCDUHandler::handleChangedDataset(sid_t sid, store_address_t storeId) { ReturnValue_t result; if (sid == sid_t(objects::PCDU_HANDLER, PDU2::HK_TABLE_DATA_SET_ID)) { - HousekeepingPacketUpdate packetUpdate(reinterpret_cast(&timeStamp), + HousekeepingSnapshot packetUpdate(reinterpret_cast(&timeStamp), sizeof(timeStamp), &pdu2HkTableDataset); const uint8_t* packet_ptr = NULL; size_t size; @@ -257,7 +257,10 @@ ReturnValue_t PCDUHandler::initializeLocalDataPool(localpool::DataPool &localDat localDataPoolMap.emplace(P60System::PDU2_VCC, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_VBAT, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_TEMPERATURE, new PoolEntry( { 0 })); - localDataPoolMap.emplace(P60System::PDU2_CONV_EN, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_CONV_EN_1, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_CONV_EN_2, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_CONV_EN_3, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_DUMMY_BYTE_CONV_EN, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_OUT_EN_Q7S, new PoolEntry( { pcduSwitches::INIT_STATE_Q7S })); @@ -280,12 +283,25 @@ ReturnValue_t PCDUHandler::initializeLocalDataPool(localpool::DataPool &localDat pcduSwitches::INIT_STATE_ACS_BOARD_SIDE_B })); localDataPoolMap.emplace(P60System::PDU2_OUT_EN_PAYLOAD_CAMERA, new PoolEntry( { pcduSwitches::INIT_STATE_PAYLOAD_CAMERA })); + localDataPoolMap.emplace(P60System::PDU2_DUMMY_BYTE_OUT_EN, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_BOOTCAUSE, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_BOOTCNT, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_UPTIME, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_RESETCAUSE, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_BATT_MODE, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_DUMMY_BYTE_BATT_MODE, new PoolEntry( { 0 })); + + localDataPoolMap.emplace(P60System::PDU2_LATCHUP_Q7S, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_LATCHUP_PAYLOAD_PCDU_CH1, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_LATCHUP_RW, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_LATCHUP_TCS_BOARD_HEATER_IN, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_LATCHUP_TCS_BOARD_HEATER_IN, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_LATCHUP_SUS_REDUNDANT, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_LATCHUP_DEPLOYMENT_MECHANISM, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_LATCHUP_PAYLOAD_PCDU_CH6, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_LATCHUP_ACS_BOARD_SIDE_B, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_LATCHUP_PAYLOAD_CAMERA, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_DEVICE_0, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_DEVICE_1, new PoolEntry( { 0 })); @@ -304,15 +320,18 @@ ReturnValue_t PCDUHandler::initializeLocalDataPool(localpool::DataPool &localDat localDataPoolMap.emplace(P60System::PDU2_DEVICE_5_STATUS, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_DEVICE_6_STATUS, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_DEVICE_7_STATUS, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_DUMMY_DEVICE_STATUS, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_WDT_CNT_GND, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_WDT_CNT_I2C, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_WDT_CNT_CAN, new PoolEntry( { 0 })); - localDataPoolMap.emplace(P60System::PDU2_WDT_CNT_CSP, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_WDT_CNT_CSP1, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_WDT_CNT_CSP2, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_WDT_GND_LEFT, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_WDT_I2C_LEFT, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_WDT_CAN_LEFT, new PoolEntry( { 0 })); - localDataPoolMap.emplace(P60System::PDU2_WDT_CSP_LEFT, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_WDT_CSP_LEFT1, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_WDT_CSP_LEFT2, new PoolEntry( { 0 })); return HasReturnvaluesIF::RETURN_OK; } diff --git a/mission/devices/PDU1Handler.cpp b/mission/devices/PDU1Handler.cpp index cddfccce..3d3503e9 100644 --- a/mission/devices/PDU1Handler.cpp +++ b/mission/devices/PDU1Handler.cpp @@ -12,8 +12,9 @@ PDU1Handler::~PDU1Handler() { ReturnValue_t PDU1Handler::buildNormalDeviceCommand( DeviceCommandId_t * id) { - *id = GOMSPACE::REQUEST_HK_TABLE; - return buildCommandFromCommand(*id, NULL, 0); +// *id = GOMSPACE::REQUEST_HK_TABLE; +// return buildCommandFromCommand(*id, NULL, 0); + return RETURN_OK; } void PDU1Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *packet) { diff --git a/mission/devices/PDU2Handler.cpp b/mission/devices/PDU2Handler.cpp index 0718790d..c9d80c1a 100644 --- a/mission/devices/PDU2Handler.cpp +++ b/mission/devices/PDU2Handler.cpp @@ -3,9 +3,9 @@ #include PDU2Handler::PDU2Handler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie, - uint16_t maxConfigTableAddress, uint16_t maxHkTableAddress, uint16_t hkTableSize) : + uint16_t maxConfigTableAddress, uint16_t maxHkTableAddress) : GomspaceDeviceHandler(objectId, comIF, comCookie, maxConfigTableAddress, maxHkTableAddress, - hkTableSize, &pdu2HkTableDataset), pdu2HkTableDataset(this) { + PDU::HK, &pdu2HkTableDataset), pdu2HkTableDataset(this) { } PDU2Handler::~PDU2Handler() { @@ -23,7 +23,7 @@ void PDU2Handler::letChildHandleHkReply(DeviceCommandId_t id, const uint8_t *pac /* Pointer points to beginning of payload data */ pdu2HkTableDataset.read(); - const uint8_t* payloadPtr = packet + GOMSPACE::GS_HDR_LENGTH; + const uint8_t* payloadPtr = packet + 12; size_t size = (size_t)hkTableSize; result = pdu2HkTableDataset.deSerialize(&payloadPtr, &size, SerializeIF::Endianness::BIG); if (result != RETURN_OK) { @@ -67,7 +67,10 @@ ReturnValue_t PDU2Handler::initializeLocalDataPool( localDataPoolMap.emplace(P60System::PDU2_VCC, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_VBAT, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_TEMPERATURE, new PoolEntry( { 0 })); - localDataPoolMap.emplace(P60System::PDU2_CONV_EN, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_CONV_EN_1, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_CONV_EN_2, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_CONV_EN_3, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_DUMMY_BYTE_CONV_EN, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_OUT_EN_Q7S, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_OUT_EN_PAYLOAD_PCDU_CH1, new PoolEntry( { 0 })); @@ -82,12 +85,25 @@ ReturnValue_t PDU2Handler::initializeLocalDataPool( localDataPoolMap.emplace(P60System::PDU2_OUT_EN_PAYLOAD_PCDU_CH6, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_OUT_EN_ACS_BOARD_SIDE_B, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_OUT_EN_PAYLOAD_CAMERA, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_DUMMY_BYTE_OUT_EN, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_BOOTCAUSE, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_BOOTCNT, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_UPTIME, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_RESETCAUSE, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_BATT_MODE, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_DUMMY_BYTE_BATT_MODE, new PoolEntry( { 0 })); + + localDataPoolMap.emplace(P60System::PDU2_LATCHUP_Q7S, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_LATCHUP_PAYLOAD_PCDU_CH1, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_LATCHUP_RW, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_LATCHUP_TCS_BOARD_HEATER_IN, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_LATCHUP_TCS_BOARD_HEATER_IN, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_LATCHUP_SUS_REDUNDANT, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_LATCHUP_DEPLOYMENT_MECHANISM, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_LATCHUP_PAYLOAD_PCDU_CH6, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_LATCHUP_ACS_BOARD_SIDE_B, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_LATCHUP_PAYLOAD_CAMERA, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_DEVICE_0, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_DEVICE_1, new PoolEntry( { 0 })); @@ -106,15 +122,18 @@ ReturnValue_t PDU2Handler::initializeLocalDataPool( localDataPoolMap.emplace(P60System::PDU2_DEVICE_5_STATUS, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_DEVICE_6_STATUS, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_DEVICE_7_STATUS, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_DUMMY_DEVICE_STATUS, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_WDT_CNT_GND, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_WDT_CNT_I2C, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_WDT_CNT_CAN, new PoolEntry( { 0 })); - localDataPoolMap.emplace(P60System::PDU2_WDT_CNT_CSP, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_WDT_CNT_CSP1, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_WDT_CNT_CSP2, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_WDT_GND_LEFT, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_WDT_I2C_LEFT, new PoolEntry( { 0 })); localDataPoolMap.emplace(P60System::PDU2_WDT_CAN_LEFT, new PoolEntry( { 0 })); - localDataPoolMap.emplace(P60System::PDU2_WDT_CSP_LEFT, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_WDT_CSP_LEFT1, new PoolEntry( { 0 })); + localDataPoolMap.emplace(P60System::PDU2_WDT_CSP_LEFT2, new PoolEntry( { 0 })); return HasReturnvaluesIF::RETURN_OK; } diff --git a/mission/devices/devicedefinitions/GomspaceDefinitions.h b/mission/devices/devicedefinitions/GomspaceDefinitions.h index ac0f0ac4..2f10fb89 100644 --- a/mission/devices/devicedefinitions/GomspaceDefinitions.h +++ b/mission/devices/devicedefinitions/GomspaceDefinitions.h @@ -159,7 +159,10 @@ namespace P60System { PDU1_VCC, PDU1_VBAT, PDU1_TEMPERATURE, - PDU1_CONV_EN, + PDU1_CONV_EN_1, + PDU1_CONV_EN_2, + PDU1_CONV_EN_3, + PDU1_DUMMY_BYTE_CONV_EN, PDU1_OUT_EN_TCS_BOARD_3V3, PDU1_OUT_EN_SYRLINKS, PDU1_OUT_EN_STAR_TRACKER, @@ -169,12 +172,22 @@ namespace P60System { PDU1_OUT_EN_PLOC, PDU1_OUT_EN_ACS_BOARD_SIDE_A, PDU1_OUT_EN_CHANNEL8, + PDU1_DUMMY_BYTE_OUT_EN, PDU1_BOOTCAUSE, PDU1_BOOTCNT, PDU1_UPTIME, PDU1_RESETCAUSE, PDU1_BATT_MODE, - PDU1_LATCHUP, + PDU1_DUMMY_BYTE_BATT_MODE, + PDU1_LATCHUP_TCS_BOARD_3V3, + PDU1_LATCHUP_SYRLINKS, + PDU1_LATCHUP_STAR_TRACKER, + PDU1_LATCHUP_MGT, + PDU1_LATCHUP_SUS_NOMINAL, + PDU1_LATCHUP_SOLAR_CELL_EXP, + PDU1_LATCHUP_PLOC, + PDU1_LATCHUP_ACS_BOARD_SIDE_A, + PDU1_LATCHUP_CHANNEL8, PDU1_DEVICE_0, PDU1_DEVICE_1, PDU1_DEVICE_2, @@ -191,14 +204,17 @@ namespace P60System { PDU1_DEVICE_5_STATUS, PDU1_DEVICE_6_STATUS, PDU1_DEVICE_7_STATUS, + PDU1_DUMMY_DEVICE_STATUS, PDU1_WDT_CNT_GND, PDU1_WDT_CNT_I2C, PDU1_WDT_CNT_CAN, - PDU1_WDT_CNT_CSP, + PDU1_WDT_CNT_CSP1, + PDU1_WDT_CNT_CSP2, PDU1_WDT_GND_LEFT, PDU1_WDT_I2C_LEFT, PDU1_WDT_CAN_LEFT, - PDU1_WDT_CSP_LEFT, + PDU1_WDT_CSP_LEFT1, + PDU1_WDT_CSP_LEFT2, /** PDU2 Ids */ PDU2_CURRENT_OUT_Q7S, @@ -222,7 +238,10 @@ namespace P60System { PDU2_VCC, PDU2_VBAT, PDU2_TEMPERATURE, - PDU2_CONV_EN, + PDU2_CONV_EN_1, + PDU2_CONV_EN_2, + PDU2_CONV_EN_3, + PDU2_DUMMY_BYTE_CONV_EN, PDU2_OUT_EN_Q7S, PDU2_OUT_EN_PAYLOAD_PCDU_CH1, PDU2_OUT_EN_RW, @@ -232,20 +251,22 @@ namespace P60System { PDU2_OUT_EN_PAYLOAD_PCDU_CH6, PDU2_OUT_EN_ACS_BOARD_SIDE_B, PDU2_OUT_EN_PAYLOAD_CAMERA, + PDU2_DUMMY_BYTE_OUT_EN, PDU2_BOOTCAUSE, PDU2_BOOTCNT, PDU2_UPTIME, PDU2_RESETCAUSE, PDU2_BATT_MODE, - PDU2_LATCHUP_OUT_Q7S, - PDU2_LATCHUP_OUT_PAYLOAD_PCDU_CH1, - PDU2_LATCHUP_OUT_RW, - PDU2_LATCHUP_OUT_TCS_BOARD_HEATER_IN, - PDU2_LATCHUP_OUT_SUS_REDUNDANT, - PDU2_LATCHUP_OUT_DEPLOYMENT_MECHANISM, - PDU2_LATCHUP_OUT_PAYLOAD_PCDU_CH6, - PDU2_LATCHUP_OUT_ACS_BOARD_SIDE_B, - PDU2_LATCHUP_OUT_PAYLOAD_CAMERA, + PDU2_DUMMY_BYTE_BATT_MODE, + PDU2_LATCHUP_Q7S, + PDU2_LATCHUP_PAYLOAD_PCDU_CH1, + PDU2_LATCHUP_RW, + PDU2_LATCHUP_TCS_BOARD_HEATER_IN, + PDU2_LATCHUP_SUS_REDUNDANT, + PDU2_LATCHUP_DEPLOYMENT_MECHANISM, + PDU2_LATCHUP_PAYLOAD_PCDU_CH6, + PDU2_LATCHUP_ACS_BOARD_SIDE_B, + PDU2_LATCHUP_PAYLOAD_CAMERA, PDU2_DEVICE_0, PDU2_DEVICE_1, PDU2_DEVICE_2, @@ -262,14 +283,17 @@ namespace P60System { PDU2_DEVICE_5_STATUS, PDU2_DEVICE_6_STATUS, PDU2_DEVICE_7_STATUS, + PDU2_DUMMY_DEVICE_STATUS, PDU2_WDT_CNT_GND, PDU2_WDT_CNT_I2C, PDU2_WDT_CNT_CAN, - PDU2_WDT_CNT_CSP, + PDU2_WDT_CNT_CSP1, + PDU2_WDT_CNT_CSP2, PDU2_WDT_GND_LEFT, PDU2_WDT_I2C_LEFT, PDU2_WDT_CAN_LEFT, - PDU2_WDT_CSP_LEFT, + PDU2_WDT_CSP_LEFT1, + PDU2_WDT_CSP_LEFT2, /** ACU Ids */ ACU_CURRENT_IN_CHANNEL0, @@ -587,12 +611,15 @@ namespace P60Dock { * @brief Constants common for both PDU1 and PDU2. */ namespace PDU{ - /* When retrieving full configuration parameter table */ + /** When retrieving full configuration parameter table */ static const uint16_t MAX_REPLY_LENGTH = 318; static const uint16_t MAX_CONFIGTABLE_ADDRESS = 316; - static const uint16_t MAX_HKTABLE_ADDRESS = 142; - static const uint16_t HK_TABLE_SIZE = 143; + static const uint16_t MAX_HKTABLE_ADDRESS = 141; +// static const uint16_t HK_TABLE_SIZE = 142; + static const uint16_t HK_TABLE_REPLY_SIZE = 303; static const uint8_t HK_TABLE_ENTRIES = 60; + /** The length of the header holding information about the received housekeeping table reply */ + static const uint8_t HK_REPLY_HEADER_LENGTH = 13; } @@ -674,8 +701,15 @@ namespace PDU1 { lp_var_t temperature = lp_var_t(sid.objectId, P60System::PDU1_TEMPERATURE, this); /** Output converter enable status */ - lp_var_t converterEnable = lp_var_t(sid.objectId, - P60System::PDU1_CONV_EN, this); + lp_var_t converterEnable1 = lp_var_t(sid.objectId, + P60System::PDU1_CONV_EN_1, this); + lp_var_t converterEnable2 = lp_var_t(sid.objectId, + P60System::PDU1_CONV_EN_2, this); + lp_var_t converterEnable3 = lp_var_t(sid.objectId, + P60System::PDU1_CONV_EN_3, this); + /** Dummy byte inserted by the full hk table request. */ + lp_var_t dummyByteConvEn = lp_var_t(sid.objectId, + P60System::PDU1_DUMMY_BYTE_CONV_EN, this); /** Output channels enable status */ lp_var_t outEnabledTCSBoard3V3 = lp_var_t(sid.objectId, P60System::PDU1_OUT_EN_TCS_BOARD_3V3, this); @@ -708,6 +742,30 @@ namespace PDU1 { /** Battery mode: 1 = Critical, 2 = Safe, 3 = Normal, 4 = Full */ lp_var_t battMode = lp_var_t(sid.objectId, P60System::PDU1_BATT_MODE, this); + /** Dummy byte which is received with full hk table request: */ + lp_var_t dummyByteBattMode = lp_var_t(sid.objectId, + P60System::PDU1_DUMMY_BYTE_BATT_MODE, this); + + /** Number of detected latchups on each output channel */ + lp_var_t latchupsTcsBoard3V3 = lp_var_t(sid.objectId, + P60System::PDU1_LATCHUP_TCS_BOARD_3V3, this); + lp_var_t latchupsSyrlinks = lp_var_t(sid.objectId, + P60System::PDU1_LATCHUP_SYRLINKS, this); + lp_var_t latchupsStarTracker = lp_var_t(sid.objectId, + P60System::PDU1_LATCHUP_STAR_TRACKER, this); + lp_var_t latchupsMgt = lp_var_t(sid.objectId, + P60System::PDU1_LATCHUP_MGT, this); + lp_var_t latchupsSusNominal = lp_var_t(sid.objectId, + P60System::PDU1_LATCHUP_SUS_NOMINAL, this); + lp_var_t latchupsSolarCellExp = lp_var_t(sid.objectId, + P60System::PDU1_LATCHUP_SOLAR_CELL_EXP, this); + lp_var_t latchupsPloc = lp_var_t(sid.objectId, + P60System::PDU1_LATCHUP_PLOC, this); + lp_var_t latchupsAcsBoardSideA = lp_var_t(sid.objectId, + P60System::PDU1_LATCHUP_ACS_BOARD_SIDE_A, this); + lp_var_t latchupsChannel8 = lp_var_t(sid.objectId, + P60System::PDU1_LATCHUP_CHANNEL8, this); + /** * There are 8 devices on the PDU. FRAM, ADCs, temperature sensor etc. Each device is * identified by an ID. Refer also to gs-man-nanopower-p60-pdu-200-1.pdf on pages 17 and 18. @@ -745,6 +803,9 @@ namespace PDU1 { P60System::PDU1_DEVICE_6_STATUS, this); lp_var_t device7Status = lp_var_t(sid.objectId, P60System::PDU1_DEVICE_7_STATUS, this); + /** Two dummy bytes will be inserted here by a full hk table request. */ + lp_var_t dummyBytesdeviceStatus = lp_var_t(sid.objectId, + P60System::PDU1_DUMMY_DEVICE_STATUS, this); /** Number of reboots triggered by the ground watchdog */ lp_var_t gndWdtReboots = lp_var_t(sid.objectId, P60System::PDU1_WDT_CNT_GND, this); @@ -755,8 +816,10 @@ namespace PDU1 { lp_var_t canWdtReboots = lp_var_t(sid.objectId, P60System::PDU1_WDT_CNT_CAN, this); /** Number of reboots triggered through the CSP watchdog */ - lp_var_t cspWdtReboots = lp_var_t(sid.objectId, - P60System::PDU1_WDT_CNT_CSP, this); + lp_var_t csp1WdtReboots = lp_var_t(sid.objectId, + P60System::PDU1_WDT_CNT_CSP1, this); + lp_var_t csp2WdtReboots = lp_var_t(sid.objectId, + P60System::PDU1_WDT_CNT_CSP2, this); /** Ground watchdog remaining seconds before rebooting */ lp_var_t groundWatchdogSecondsLeft = lp_var_t(sid.objectId, P60System::PDU1_WDT_GND_LEFT, this); @@ -766,9 +829,11 @@ namespace PDU1 { /** CAN watchdog remaining seconds before rebooting. */ lp_var_t canWatchdogSecondsLeft = lp_var_t(sid.objectId, P60System::PDU1_WDT_CAN_LEFT, this); - /** CSP watchdog remaining seconds before rebooting. */ - lp_var_t cspWatchdogSecondsLeft = lp_var_t(sid.objectId, - P60System::PDU1_WDT_CSP_LEFT, this); + /** CSP watchdogs remaining pings before rebooting. */ + lp_var_t csp2WatchdogSecondsLeft = lp_var_t(sid.objectId, + P60System::PDU1_WDT_CSP_LEFT1, this); + lp_var_t csp1WatchdogSecondsLeft = lp_var_t(sid.objectId, + P60System::PDU1_WDT_CSP_LEFT2, this); }; } @@ -851,8 +916,14 @@ namespace PDU2 { lp_var_t temperature = lp_var_t(sid.objectId, P60System::PDU2_TEMPERATURE, this); /** Output converter enable status */ - lp_var_t converterEnable = lp_var_t(sid.objectId, - P60System::PDU2_CONV_EN, this); + lp_var_t converterEnable1 = lp_var_t(sid.objectId, + P60System::PDU2_CONV_EN_1, this); + lp_var_t converterEnable2 = lp_var_t(sid.objectId, + P60System::PDU2_CONV_EN_2, this); + lp_var_t converterEnable3 = lp_var_t(sid.objectId, + P60System::PDU2_CONV_EN_3, this); + lp_var_t dummyByteConvEn = lp_var_t(sid.objectId, + P60System::PDU2_DUMMY_BYTE_CONV_EN, this); /** Output channels enable status */ lp_var_t outEnabledQ7S = lp_var_t(sid.objectId, P60System::PDU2_OUT_EN_Q7S, this); @@ -872,6 +943,9 @@ namespace PDU2 { P60System::PDU2_OUT_EN_ACS_BOARD_SIDE_B, this); lp_var_t outEnabledPayloadCamera = lp_var_t(sid.objectId, P60System::PDU2_OUT_EN_PAYLOAD_CAMERA, this); + /** Dummy byte which is received with a full hk table request. */ + lp_var_t dummyByteOutEn = lp_var_t(sid.objectId, + P60System::PDU2_DUMMY_BYTE_OUT_EN, this); lp_var_t bootcause = lp_var_t(sid.objectId, P60System::PDU2_BOOTCAUSE, this); @@ -886,26 +960,30 @@ namespace PDU2 { /** Battery mode: 1 = Critical, 2 = Safe, 3 = Normal, 4 = Full */ lp_var_t battMode = lp_var_t(sid.objectId, P60System::PDU2_BATT_MODE, this); + /** Dummy byte which is received with full hk table request: */ + lp_var_t dummyByteBattMode = lp_var_t(sid.objectId, + P60System::PDU2_DUMMY_BYTE_BATT_MODE, this); /** Number of detected latchups on each output channel */ lp_var_t latchupsQ7S = lp_var_t(sid.objectId, - P60System::P_LATCHUP_, this); - lp_var_t latchupsPdu1Vcc = lp_var_t(sid.objectId, - P60System::P60DOCK_LATCHUP_PDU1_VCC, this); - lp_var_t latchupsX3IdleVcc = lp_var_t(sid.objectId, - P60System::P60DOCK_LATCHUP_X3_IDLE_VCC, this); - lp_var_t latchupsPdu2Vcc = lp_var_t(sid.objectId, - P60System::P60DOCK_LATCHUP_PDU2_VCC, this); - lp_var_t latchupsAcuVbat = lp_var_t(sid.objectId, - P60System::P60DOCK_LATCHUP_ACU_VBAT, this); - lp_var_t latchupsPdu1Vbat = lp_var_t(sid.objectId, - P60System::P60DOCK_LATCHUP_PDU1_VBAT, this); - lp_var_t latchupsX3IdleVbat = lp_var_t(sid.objectId, - P60System::P60DOCK_LATCHUP_X3_IDLE_VBAT, this); - lp_var_t latchupsPdu2Vbat = lp_var_t(sid.objectId, - P60System::P60DOCK_LATCHUP_PDU2_VBAT, this); - lp_var_t latchupsStackVbata = lp_var_t(sid.objectId, - P60System::P60DOCK_LATCHUP_STACK_VBAT, this); + P60System::PDU2_LATCHUP_Q7S, this); + lp_var_t latchupsPayloadPcduCh1 = lp_var_t(sid.objectId, + P60System::PDU2_LATCHUP_PAYLOAD_PCDU_CH1, this); + lp_var_t latchupsRw = lp_var_t(sid.objectId, + P60System::PDU2_LATCHUP_RW, this); + lp_var_t latchupsTcsBoardHeaterIn = lp_var_t(sid.objectId, + P60System::PDU2_LATCHUP_TCS_BOARD_HEATER_IN, this); + lp_var_t latchupsSusRedundant = lp_var_t(sid.objectId, + P60System::PDU2_LATCHUP_SUS_REDUNDANT, this); + lp_var_t latchupsDeplMenchanism = lp_var_t(sid.objectId, + P60System::PDU2_LATCHUP_DEPLOYMENT_MECHANISM, this); + lp_var_t latchupsPayloadPcduCh6 = lp_var_t(sid.objectId, + P60System::PDU2_LATCHUP_PAYLOAD_PCDU_CH6, this); + lp_var_t latchupsAcsBoardSideB = lp_var_t(sid.objectId, + P60System::PDU2_LATCHUP_ACS_BOARD_SIDE_B, this); + lp_var_t latchupsPayloadCamera = lp_var_t(sid.objectId, + P60System::PDU2_LATCHUP_PAYLOAD_CAMERA, this); + /** * There are 8 devices on the PDU. FRAM, ADCs, temperature sensor etc. Each device is * identified by an ID. Refer also to gs-man-nanopower-p60-pdu-200-1.pdf on pages 17 and 18. @@ -943,6 +1021,10 @@ namespace PDU2 { P60System::PDU2_DEVICE_6_STATUS, this); lp_var_t device7Status = lp_var_t(sid.objectId, P60System::PDU2_DEVICE_7_STATUS, this); + /** Two dummy bytes will be inserted here by a full hk table request. */ + lp_var_t dummyBytesdeviceStatus = lp_var_t(sid.objectId, + P60System::PDU2_DUMMY_DEVICE_STATUS, this); + /** Number of reboots triggered by the ground watchdog */ lp_var_t gndWdtReboots = lp_var_t(sid.objectId, P60System::PDU2_WDT_CNT_GND, this); @@ -953,8 +1035,10 @@ namespace PDU2 { lp_var_t canWdtReboots = lp_var_t(sid.objectId, P60System::PDU2_WDT_CNT_CAN, this); /** Number of reboots triggered through the CSP watchdog */ - lp_var_t cspWdtReboots = lp_var_t(sid.objectId, - P60System::PDU2_WDT_CNT_CSP, this); + lp_var_t csp1WdtReboots = lp_var_t(sid.objectId, + P60System::PDU2_WDT_CNT_CSP1, this); + lp_var_t cs2pWdtReboots = lp_var_t(sid.objectId, + P60System::PDU2_WDT_CNT_CSP2, this); /** Ground watchdog remaining seconds before rebooting */ lp_var_t groundWatchdogSecondsLeft = lp_var_t(sid.objectId, P60System::PDU2_WDT_GND_LEFT, this); @@ -964,9 +1048,11 @@ namespace PDU2 { /** CAN watchdog remaining seconds before rebooting. */ lp_var_t canWatchdogSecondsLeft = lp_var_t(sid.objectId, P60System::PDU2_WDT_CAN_LEFT, this); - /** CSP watchdog remaining seconds before rebooting. */ - lp_var_t cspWatchdogSecondsLeft = lp_var_t(sid.objectId, - P60System::PDU2_WDT_CSP_LEFT, this); + /** CSP watchdog remaining pings before rebooting. */ + lp_var_t csp1WatchdogSecondsLeft = lp_var_t(sid.objectId, + P60System::PDU2_WDT_CSP_LEFT1, this); + lp_var_t csp2WatchdogSecondsLeft = lp_var_t(sid.objectId, + P60System::PDU2_WDT_CSP_LEFT2, this); }; }