save before changing pdu hk table dataset

This commit is contained in:
Jakob Meier 2021-02-05 07:37:21 +01:00
parent e5998f20f3
commit 77f293f789
9 changed files with 257 additions and 90 deletions

View File

@ -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);

View File

@ -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,

2
fsfw

@ -1 +1 @@
Subproject commit 41c0436e29f7a75f737f75e963dc2119a64a3921
Subproject commit 2104d3f38a409a46210849ea23b0ea7fc7efe617

View File

@ -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);

View File

@ -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;

View File

@ -2,7 +2,7 @@
#include <fsfwconfig/objects/systemObjectList.h>
#include <mission/devices/devicedefinitions/GomSpacePackets.h>
#include <fsfw/ipc/QueueFactory.h>
#include <fsfw/housekeeping/HousekeepingPacketUpdate.h>
#include <fsfw/housekeeping/HousekeepingSnapshot.h>
#include <fsfwconfig/OBSWConfig.h>
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<uint8_t*>(&timeStamp),
HousekeepingSnapshot packetUpdate(reinterpret_cast<uint8_t*>(&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<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_VBAT, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_TEMPERATURE, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_CONV_EN, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_CONV_EN_1, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_CONV_EN_2, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_CONV_EN_3, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_DUMMY_BYTE_CONV_EN, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_OUT_EN_Q7S, new PoolEntry<uint8_t>( {
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<uint8_t>( {
pcduSwitches::INIT_STATE_PAYLOAD_CAMERA }));
localDataPoolMap.emplace(P60System::PDU2_DUMMY_BYTE_OUT_EN, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_BOOTCAUSE, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_BOOTCNT, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_UPTIME, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_RESETCAUSE, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_BATT_MODE, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_DUMMY_BYTE_BATT_MODE, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_LATCHUP_Q7S, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_LATCHUP_PAYLOAD_PCDU_CH1, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_LATCHUP_RW, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_LATCHUP_TCS_BOARD_HEATER_IN, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_LATCHUP_TCS_BOARD_HEATER_IN, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_LATCHUP_SUS_REDUNDANT, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_LATCHUP_DEPLOYMENT_MECHANISM, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_LATCHUP_PAYLOAD_PCDU_CH6, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_LATCHUP_ACS_BOARD_SIDE_B, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_LATCHUP_PAYLOAD_CAMERA, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_DEVICE_0, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_DEVICE_1, new PoolEntry<uint8_t>( { 0 }));
@ -304,15 +320,18 @@ ReturnValue_t PCDUHandler::initializeLocalDataPool(localpool::DataPool &localDat
localDataPoolMap.emplace(P60System::PDU2_DEVICE_5_STATUS, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_DEVICE_6_STATUS, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_DEVICE_7_STATUS, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_DUMMY_DEVICE_STATUS, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_WDT_CNT_GND, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_WDT_CNT_I2C, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_WDT_CNT_CAN, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_WDT_CNT_CSP, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_WDT_CNT_CSP1, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_WDT_CNT_CSP2, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_WDT_GND_LEFT, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_WDT_I2C_LEFT, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_WDT_CAN_LEFT, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_WDT_CSP_LEFT, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_WDT_CSP_LEFT1, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_WDT_CSP_LEFT2, new PoolEntry<uint8_t>( { 0 }));
return HasReturnvaluesIF::RETURN_OK;
}

View File

@ -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) {

View File

@ -3,9 +3,9 @@
#include <fsfwconfig/OBSWConfig.h>
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<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_VBAT, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_TEMPERATURE, new PoolEntry<int16_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_CONV_EN, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_CONV_EN_1, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_CONV_EN_2, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_CONV_EN_3, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_DUMMY_BYTE_CONV_EN, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_OUT_EN_Q7S, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_OUT_EN_PAYLOAD_PCDU_CH1, new PoolEntry<uint8_t>( { 0 }));
@ -82,12 +85,25 @@ ReturnValue_t PDU2Handler::initializeLocalDataPool(
localDataPoolMap.emplace(P60System::PDU2_OUT_EN_PAYLOAD_PCDU_CH6, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_OUT_EN_ACS_BOARD_SIDE_B, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_OUT_EN_PAYLOAD_CAMERA, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_DUMMY_BYTE_OUT_EN, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_BOOTCAUSE, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_BOOTCNT, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_UPTIME, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_RESETCAUSE, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_BATT_MODE, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_DUMMY_BYTE_BATT_MODE, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_LATCHUP_Q7S, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_LATCHUP_PAYLOAD_PCDU_CH1, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_LATCHUP_RW, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_LATCHUP_TCS_BOARD_HEATER_IN, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_LATCHUP_TCS_BOARD_HEATER_IN, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_LATCHUP_SUS_REDUNDANT, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_LATCHUP_DEPLOYMENT_MECHANISM, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_LATCHUP_PAYLOAD_PCDU_CH6, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_LATCHUP_ACS_BOARD_SIDE_B, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_LATCHUP_PAYLOAD_CAMERA, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_DEVICE_0, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_DEVICE_1, new PoolEntry<uint8_t>( { 0 }));
@ -106,15 +122,18 @@ ReturnValue_t PDU2Handler::initializeLocalDataPool(
localDataPoolMap.emplace(P60System::PDU2_DEVICE_5_STATUS, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_DEVICE_6_STATUS, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_DEVICE_7_STATUS, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_DUMMY_DEVICE_STATUS, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_WDT_CNT_GND, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_WDT_CNT_I2C, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_WDT_CNT_CAN, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_WDT_CNT_CSP, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_WDT_CNT_CSP1, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_WDT_CNT_CSP2, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_WDT_GND_LEFT, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_WDT_I2C_LEFT, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_WDT_CAN_LEFT, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_WDT_CSP_LEFT, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_WDT_CSP_LEFT1, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(P60System::PDU2_WDT_CSP_LEFT2, new PoolEntry<uint8_t>( { 0 }));
return HasReturnvaluesIF::RETURN_OK;
}

View File

@ -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<int16_t> temperature = lp_var_t<int16_t>(sid.objectId,
P60System::PDU1_TEMPERATURE, this);
/** Output converter enable status */
lp_var_t<uint8_t> converterEnable = lp_var_t<uint8_t>(sid.objectId,
P60System::PDU1_CONV_EN, this);
lp_var_t<uint8_t> converterEnable1 = lp_var_t<uint8_t>(sid.objectId,
P60System::PDU1_CONV_EN_1, this);
lp_var_t<uint8_t> converterEnable2 = lp_var_t<uint8_t>(sid.objectId,
P60System::PDU1_CONV_EN_2, this);
lp_var_t<uint8_t> converterEnable3 = lp_var_t<uint8_t>(sid.objectId,
P60System::PDU1_CONV_EN_3, this);
/** Dummy byte inserted by the full hk table request. */
lp_var_t<uint8_t> dummyByteConvEn = lp_var_t<uint8_t>(sid.objectId,
P60System::PDU1_DUMMY_BYTE_CONV_EN, this);
/** Output channels enable status */
lp_var_t<uint8_t> outEnabledTCSBoard3V3 = lp_var_t<uint8_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<uint8_t> battMode = lp_var_t<uint8_t>(sid.objectId,
P60System::PDU1_BATT_MODE, this);
/** Dummy byte which is received with full hk table request: */
lp_var_t<uint8_t> dummyByteBattMode = lp_var_t<uint8_t>(sid.objectId,
P60System::PDU1_DUMMY_BYTE_BATT_MODE, this);
/** Number of detected latchups on each output channel */
lp_var_t<uint16_t> latchupsTcsBoard3V3 = lp_var_t<uint16_t>(sid.objectId,
P60System::PDU1_LATCHUP_TCS_BOARD_3V3, this);
lp_var_t<uint16_t> latchupsSyrlinks = lp_var_t<uint16_t>(sid.objectId,
P60System::PDU1_LATCHUP_SYRLINKS, this);
lp_var_t<uint16_t> latchupsStarTracker = lp_var_t<uint16_t>(sid.objectId,
P60System::PDU1_LATCHUP_STAR_TRACKER, this);
lp_var_t<uint16_t> latchupsMgt = lp_var_t<uint16_t>(sid.objectId,
P60System::PDU1_LATCHUP_MGT, this);
lp_var_t<uint16_t> latchupsSusNominal = lp_var_t<uint16_t>(sid.objectId,
P60System::PDU1_LATCHUP_SUS_NOMINAL, this);
lp_var_t<uint16_t> latchupsSolarCellExp = lp_var_t<uint16_t>(sid.objectId,
P60System::PDU1_LATCHUP_SOLAR_CELL_EXP, this);
lp_var_t<uint16_t> latchupsPloc = lp_var_t<uint16_t>(sid.objectId,
P60System::PDU1_LATCHUP_PLOC, this);
lp_var_t<uint16_t> latchupsAcsBoardSideA = lp_var_t<uint16_t>(sid.objectId,
P60System::PDU1_LATCHUP_ACS_BOARD_SIDE_A, this);
lp_var_t<uint16_t> latchupsChannel8 = lp_var_t<uint16_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<uint8_t> device7Status = lp_var_t<uint8_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<uint16_t> dummyBytesdeviceStatus = lp_var_t<uint16_t>(sid.objectId,
P60System::PDU1_DUMMY_DEVICE_STATUS, this);
/** Number of reboots triggered by the ground watchdog */
lp_var_t<uint32_t> gndWdtReboots = lp_var_t<uint32_t>(sid.objectId,
P60System::PDU1_WDT_CNT_GND, this);
@ -755,8 +816,10 @@ namespace PDU1 {
lp_var_t<uint32_t> canWdtReboots = lp_var_t<uint32_t>(sid.objectId,
P60System::PDU1_WDT_CNT_CAN, this);
/** Number of reboots triggered through the CSP watchdog */
lp_var_t<uint32_t> cspWdtReboots = lp_var_t<uint32_t>(sid.objectId,
P60System::PDU1_WDT_CNT_CSP, this);
lp_var_t<uint32_t> csp1WdtReboots = lp_var_t<uint32_t>(sid.objectId,
P60System::PDU1_WDT_CNT_CSP1, this);
lp_var_t<uint32_t> csp2WdtReboots = lp_var_t<uint32_t>(sid.objectId,
P60System::PDU1_WDT_CNT_CSP2, this);
/** Ground watchdog remaining seconds before rebooting */
lp_var_t<uint32_t> groundWatchdogSecondsLeft = lp_var_t<uint32_t>(sid.objectId,
P60System::PDU1_WDT_GND_LEFT, this);
@ -766,9 +829,11 @@ namespace PDU1 {
/** CAN watchdog remaining seconds before rebooting. */
lp_var_t<uint32_t> canWatchdogSecondsLeft = lp_var_t<uint32_t>(sid.objectId,
P60System::PDU1_WDT_CAN_LEFT, this);
/** CSP watchdog remaining seconds before rebooting. */
lp_var_t<uint32_t> cspWatchdogSecondsLeft = lp_var_t<uint32_t>(sid.objectId,
P60System::PDU1_WDT_CSP_LEFT, this);
/** CSP watchdogs remaining pings before rebooting. */
lp_var_t<uint8_t> csp2WatchdogSecondsLeft = lp_var_t<uint8_t>(sid.objectId,
P60System::PDU1_WDT_CSP_LEFT1, this);
lp_var_t<uint8_t> csp1WatchdogSecondsLeft = lp_var_t<uint8_t>(sid.objectId,
P60System::PDU1_WDT_CSP_LEFT2, this);
};
}
@ -851,8 +916,14 @@ namespace PDU2 {
lp_var_t<int16_t> temperature = lp_var_t<int16_t>(sid.objectId,
P60System::PDU2_TEMPERATURE, this);
/** Output converter enable status */
lp_var_t<uint8_t> converterEnable = lp_var_t<uint8_t>(sid.objectId,
P60System::PDU2_CONV_EN, this);
lp_var_t<uint8_t> converterEnable1 = lp_var_t<uint8_t>(sid.objectId,
P60System::PDU2_CONV_EN_1, this);
lp_var_t<uint8_t> converterEnable2 = lp_var_t<uint8_t>(sid.objectId,
P60System::PDU2_CONV_EN_2, this);
lp_var_t<uint8_t> converterEnable3 = lp_var_t<uint8_t>(sid.objectId,
P60System::PDU2_CONV_EN_3, this);
lp_var_t<uint8_t> dummyByteConvEn = lp_var_t<uint8_t>(sid.objectId,
P60System::PDU2_DUMMY_BYTE_CONV_EN, this);
/** Output channels enable status */
lp_var_t<uint8_t> outEnabledQ7S = lp_var_t<uint8_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<uint8_t> outEnabledPayloadCamera = lp_var_t<uint8_t>(sid.objectId,
P60System::PDU2_OUT_EN_PAYLOAD_CAMERA, this);
/** Dummy byte which is received with a full hk table request. */
lp_var_t<uint8_t> dummyByteOutEn = lp_var_t<uint8_t>(sid.objectId,
P60System::PDU2_DUMMY_BYTE_OUT_EN, this);
lp_var_t<uint32_t> bootcause = lp_var_t<uint32_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<uint8_t> battMode = lp_var_t<uint8_t>(sid.objectId,
P60System::PDU2_BATT_MODE, this);
/** Dummy byte which is received with full hk table request: */
lp_var_t<uint8_t> dummyByteBattMode = lp_var_t<uint8_t>(sid.objectId,
P60System::PDU2_DUMMY_BYTE_BATT_MODE, this);
/** Number of detected latchups on each output channel */
lp_var_t<uint16_t> latchupsQ7S = lp_var_t<uint16_t>(sid.objectId,
P60System::P_LATCHUP_, this);
lp_var_t<uint16_t> latchupsPdu1Vcc = lp_var_t<uint16_t>(sid.objectId,
P60System::P60DOCK_LATCHUP_PDU1_VCC, this);
lp_var_t<uint16_t> latchupsX3IdleVcc = lp_var_t<uint16_t>(sid.objectId,
P60System::P60DOCK_LATCHUP_X3_IDLE_VCC, this);
lp_var_t<uint16_t> latchupsPdu2Vcc = lp_var_t<uint16_t>(sid.objectId,
P60System::P60DOCK_LATCHUP_PDU2_VCC, this);
lp_var_t<uint16_t> latchupsAcuVbat = lp_var_t<uint16_t>(sid.objectId,
P60System::P60DOCK_LATCHUP_ACU_VBAT, this);
lp_var_t<uint16_t> latchupsPdu1Vbat = lp_var_t<uint16_t>(sid.objectId,
P60System::P60DOCK_LATCHUP_PDU1_VBAT, this);
lp_var_t<uint16_t> latchupsX3IdleVbat = lp_var_t<uint16_t>(sid.objectId,
P60System::P60DOCK_LATCHUP_X3_IDLE_VBAT, this);
lp_var_t<uint16_t> latchupsPdu2Vbat = lp_var_t<uint16_t>(sid.objectId,
P60System::P60DOCK_LATCHUP_PDU2_VBAT, this);
lp_var_t<uint16_t> latchupsStackVbata = lp_var_t<uint16_t>(sid.objectId,
P60System::P60DOCK_LATCHUP_STACK_VBAT, this);
P60System::PDU2_LATCHUP_Q7S, this);
lp_var_t<uint16_t> latchupsPayloadPcduCh1 = lp_var_t<uint16_t>(sid.objectId,
P60System::PDU2_LATCHUP_PAYLOAD_PCDU_CH1, this);
lp_var_t<uint16_t> latchupsRw = lp_var_t<uint16_t>(sid.objectId,
P60System::PDU2_LATCHUP_RW, this);
lp_var_t<uint16_t> latchupsTcsBoardHeaterIn = lp_var_t<uint16_t>(sid.objectId,
P60System::PDU2_LATCHUP_TCS_BOARD_HEATER_IN, this);
lp_var_t<uint16_t> latchupsSusRedundant = lp_var_t<uint16_t>(sid.objectId,
P60System::PDU2_LATCHUP_SUS_REDUNDANT, this);
lp_var_t<uint16_t> latchupsDeplMenchanism = lp_var_t<uint16_t>(sid.objectId,
P60System::PDU2_LATCHUP_DEPLOYMENT_MECHANISM, this);
lp_var_t<uint16_t> latchupsPayloadPcduCh6 = lp_var_t<uint16_t>(sid.objectId,
P60System::PDU2_LATCHUP_PAYLOAD_PCDU_CH6, this);
lp_var_t<uint16_t> latchupsAcsBoardSideB = lp_var_t<uint16_t>(sid.objectId,
P60System::PDU2_LATCHUP_ACS_BOARD_SIDE_B, this);
lp_var_t<uint16_t> latchupsPayloadCamera = lp_var_t<uint16_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<uint8_t> device7Status = lp_var_t<uint8_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<uint16_t> dummyBytesdeviceStatus = lp_var_t<uint16_t>(sid.objectId,
P60System::PDU2_DUMMY_DEVICE_STATUS, this);
/** Number of reboots triggered by the ground watchdog */
lp_var_t<uint32_t> gndWdtReboots = lp_var_t<uint32_t>(sid.objectId,
P60System::PDU2_WDT_CNT_GND, this);
@ -953,8 +1035,10 @@ namespace PDU2 {
lp_var_t<uint32_t> canWdtReboots = lp_var_t<uint32_t>(sid.objectId,
P60System::PDU2_WDT_CNT_CAN, this);
/** Number of reboots triggered through the CSP watchdog */
lp_var_t<uint32_t> cspWdtReboots = lp_var_t<uint32_t>(sid.objectId,
P60System::PDU2_WDT_CNT_CSP, this);
lp_var_t<uint32_t> csp1WdtReboots = lp_var_t<uint32_t>(sid.objectId,
P60System::PDU2_WDT_CNT_CSP1, this);
lp_var_t<uint32_t> cs2pWdtReboots = lp_var_t<uint32_t>(sid.objectId,
P60System::PDU2_WDT_CNT_CSP2, this);
/** Ground watchdog remaining seconds before rebooting */
lp_var_t<uint32_t> groundWatchdogSecondsLeft = lp_var_t<uint32_t>(sid.objectId,
P60System::PDU2_WDT_GND_LEFT, this);
@ -964,9 +1048,11 @@ namespace PDU2 {
/** CAN watchdog remaining seconds before rebooting. */
lp_var_t<uint32_t> canWatchdogSecondsLeft = lp_var_t<uint32_t>(sid.objectId,
P60System::PDU2_WDT_CAN_LEFT, this);
/** CSP watchdog remaining seconds before rebooting. */
lp_var_t<uint32_t> cspWatchdogSecondsLeft = lp_var_t<uint32_t>(sid.objectId,
P60System::PDU2_WDT_CSP_LEFT, this);
/** CSP watchdog remaining pings before rebooting. */
lp_var_t<uint8_t> csp1WatchdogSecondsLeft = lp_var_t<uint8_t>(sid.objectId,
P60System::PDU2_WDT_CSP_LEFT1, this);
lp_var_t<uint8_t> csp2WatchdogSecondsLeft = lp_var_t<uint8_t>(sid.objectId,
P60System::PDU2_WDT_CSP_LEFT2, this);
};
}