Merge pull request 'PDEC corrupted Config Event' (#773) from meier/pdec-config-readback into main
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

Reviewed-on: #773
Reviewed-by: Marius Eggert <eggertm@irs.uni-stuttgart.de>
This commit is contained in:
Robin Müller 2023-08-15 13:24:02 +02:00
commit 77e3b8c359
14 changed files with 150 additions and 42 deletions

View File

@ -40,6 +40,9 @@ will consitute of a breaking change warranting a new major release:
return the actual GPS data will be ignored once SPG4 is running. However, by setting the
according parameter, the ACS Controller can be directed to ignore the SGP4 solution.
- Skyview dataset for more GPS TM has been added
- `PDEC_CONFIG_CORRUPTED` event which is triggered when the PDEC configuration does not match the
expected configuration. P1 will contain the readback of the first word and P2 will contain the
readback of the second word.
- The MGM and SUS vectors being too close together does not prevent the usage of the safe
mode controller anymore.
- Parameter to disable usage of MGM4, which is part of the MTQ and therefore cannot be

View File

@ -1,7 +1,7 @@
/**
* @brief Auto-generated event translation file. Contains 302 translations.
* @brief Auto-generated event translation file. Contains 303 translations.
* @details
* Generated on: 2023-08-02 09:40:31
* Generated on: 2023-08-14 15:09:10
*/
#include "translateEvents.h"
@ -167,6 +167,7 @@ const char *PDEC_TRYING_RESET_NO_INIT_STRING = "PDEC_TRYING_RESET_NO_INIT";
const char *PDEC_RESET_FAILED_STRING = "PDEC_RESET_FAILED";
const char *OPEN_IRQ_FILE_FAILED_STRING = "OPEN_IRQ_FILE_FAILED";
const char *PDEC_INIT_FAILED_STRING = "PDEC_INIT_FAILED";
const char *PDEC_CONFIG_CORRUPTED_STRING = "PDEC_CONFIG_CORRUPTED";
const char *IMAGE_UPLOAD_FAILED_STRING = "IMAGE_UPLOAD_FAILED";
const char *IMAGE_DOWNLOAD_FAILED_STRING = "IMAGE_DOWNLOAD_FAILED";
const char *IMAGE_UPLOAD_SUCCESSFUL_STRING = "IMAGE_UPLOAD_SUCCESSFUL";
@ -634,6 +635,8 @@ const char *translateEvents(Event event) {
return OPEN_IRQ_FILE_FAILED_STRING;
case (12414):
return PDEC_INIT_FAILED_STRING;
case (12415):
return PDEC_CONFIG_CORRUPTED_STRING;
case (12500):
return IMAGE_UPLOAD_FAILED_STRING;
case (12501):

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file.
* @details
* Contains 171 translations.
* Generated on: 2023-08-02 09:40:31
* Generated on: 2023-08-14 15:09:10
*/
#include "translateObjects.h"

View File

@ -161,6 +161,7 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
12412;0x307c;PDEC_RESET_FAILED;HIGH;Failed to pull PDEC reset to low;linux/ipcore/pdec.h
12413;0x307d;OPEN_IRQ_FILE_FAILED;HIGH;Failed to open the IRQ uio file;linux/ipcore/pdec.h
12414;0x307e;PDEC_INIT_FAILED;HIGH;PDEC initialization failed. This might also be due to the persistent confiuration never becoming available, for example due to SD card issues.;linux/ipcore/pdec.h
12415;0x307f;PDEC_CONFIG_CORRUPTED;HIGH;The PDEC configuration area has been corrupted P1: The first configuration word P2: The second configuration word;linux/ipcore/pdec.h
12500;0x30d4;IMAGE_UPLOAD_FAILED;LOW;Image upload failed;linux/acs/StrComHandler.h
12501;0x30d5;IMAGE_DOWNLOAD_FAILED;LOW;Image download failed;linux/acs/StrComHandler.h
12502;0x30d6;IMAGE_UPLOAD_SUCCESSFUL;LOW;Uploading image to star tracker was successfulop;linux/acs/StrComHandler.h

1 Event ID (dec) Event ID (hex) Name Severity Description File Path
161 12412 0x307c PDEC_RESET_FAILED HIGH Failed to pull PDEC reset to low linux/ipcore/pdec.h
162 12413 0x307d OPEN_IRQ_FILE_FAILED HIGH Failed to open the IRQ uio file linux/ipcore/pdec.h
163 12414 0x307e PDEC_INIT_FAILED HIGH PDEC initialization failed. This might also be due to the persistent confiuration never becoming available, for example due to SD card issues. linux/ipcore/pdec.h
164 12415 0x307f PDEC_CONFIG_CORRUPTED HIGH The PDEC configuration area has been corrupted P1: The first configuration word P2: The second configuration word linux/ipcore/pdec.h
165 12500 0x30d4 IMAGE_UPLOAD_FAILED LOW Image upload failed linux/acs/StrComHandler.h
166 12501 0x30d5 IMAGE_DOWNLOAD_FAILED LOW Image download failed linux/acs/StrComHandler.h
167 12502 0x30d6 IMAGE_UPLOAD_SUCCESSFUL LOW Uploading image to star tracker was successfulop linux/acs/StrComHandler.h

View File

@ -161,6 +161,7 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
12412;0x307c;PDEC_RESET_FAILED;HIGH;Failed to pull PDEC reset to low;linux/ipcore/pdec.h
12413;0x307d;OPEN_IRQ_FILE_FAILED;HIGH;Failed to open the IRQ uio file;linux/ipcore/pdec.h
12414;0x307e;PDEC_INIT_FAILED;HIGH;PDEC initialization failed. This might also be due to the persistent confiuration never becoming available, for example due to SD card issues.;linux/ipcore/pdec.h
12415;0x307f;PDEC_CONFIG_CORRUPTED;HIGH;The PDEC configuration area has been corrupted P1: The first configuration word P2: The second configuration word;linux/ipcore/pdec.h
12500;0x30d4;IMAGE_UPLOAD_FAILED;LOW;Image upload failed;linux/acs/StrComHandler.h
12501;0x30d5;IMAGE_DOWNLOAD_FAILED;LOW;Image download failed;linux/acs/StrComHandler.h
12502;0x30d6;IMAGE_UPLOAD_SUCCESSFUL;LOW;Uploading image to star tracker was successfulop;linux/acs/StrComHandler.h

1 Event ID (dec) Event ID (hex) Name Severity Description File Path
161 12412 0x307c PDEC_RESET_FAILED HIGH Failed to pull PDEC reset to low linux/ipcore/pdec.h
162 12413 0x307d OPEN_IRQ_FILE_FAILED HIGH Failed to open the IRQ uio file linux/ipcore/pdec.h
163 12414 0x307e PDEC_INIT_FAILED HIGH PDEC initialization failed. This might also be due to the persistent confiuration never becoming available, for example due to SD card issues. linux/ipcore/pdec.h
164 12415 0x307f PDEC_CONFIG_CORRUPTED HIGH The PDEC configuration area has been corrupted P1: The first configuration word P2: The second configuration word linux/ipcore/pdec.h
165 12500 0x30d4 IMAGE_UPLOAD_FAILED LOW Image upload failed linux/acs/StrComHandler.h
166 12501 0x30d5 IMAGE_DOWNLOAD_FAILED LOW Image download failed linux/acs/StrComHandler.h
167 12502 0x30d6 IMAGE_UPLOAD_SUCCESSFUL LOW Uploading image to star tracker was successfulop linux/acs/StrComHandler.h

View File

@ -1,7 +1,7 @@
/**
* @brief Auto-generated event translation file. Contains 302 translations.
* @brief Auto-generated event translation file. Contains 303 translations.
* @details
* Generated on: 2023-08-02 09:40:31
* Generated on: 2023-08-14 15:09:10
*/
#include "translateEvents.h"
@ -167,6 +167,7 @@ const char *PDEC_TRYING_RESET_NO_INIT_STRING = "PDEC_TRYING_RESET_NO_INIT";
const char *PDEC_RESET_FAILED_STRING = "PDEC_RESET_FAILED";
const char *OPEN_IRQ_FILE_FAILED_STRING = "OPEN_IRQ_FILE_FAILED";
const char *PDEC_INIT_FAILED_STRING = "PDEC_INIT_FAILED";
const char *PDEC_CONFIG_CORRUPTED_STRING = "PDEC_CONFIG_CORRUPTED";
const char *IMAGE_UPLOAD_FAILED_STRING = "IMAGE_UPLOAD_FAILED";
const char *IMAGE_DOWNLOAD_FAILED_STRING = "IMAGE_DOWNLOAD_FAILED";
const char *IMAGE_UPLOAD_SUCCESSFUL_STRING = "IMAGE_UPLOAD_SUCCESSFUL";
@ -634,6 +635,8 @@ const char *translateEvents(Event event) {
return OPEN_IRQ_FILE_FAILED_STRING;
case (12414):
return PDEC_INIT_FAILED_STRING;
case (12415):
return PDEC_CONFIG_CORRUPTED_STRING;
case (12500):
return IMAGE_UPLOAD_FAILED_STRING;
case (12501):

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file.
* @details
* Contains 175 translations.
* Generated on: 2023-08-02 09:40:31
* Generated on: 2023-08-14 15:09:10
*/
#include "translateObjects.h"

View File

@ -1,7 +1,7 @@
/**
* @brief Auto-generated event translation file. Contains 302 translations.
* @brief Auto-generated event translation file. Contains 303 translations.
* @details
* Generated on: 2023-08-02 09:40:31
* Generated on: 2023-08-14 15:09:10
*/
#include "translateEvents.h"
@ -167,6 +167,7 @@ const char *PDEC_TRYING_RESET_NO_INIT_STRING = "PDEC_TRYING_RESET_NO_INIT";
const char *PDEC_RESET_FAILED_STRING = "PDEC_RESET_FAILED";
const char *OPEN_IRQ_FILE_FAILED_STRING = "OPEN_IRQ_FILE_FAILED";
const char *PDEC_INIT_FAILED_STRING = "PDEC_INIT_FAILED";
const char *PDEC_CONFIG_CORRUPTED_STRING = "PDEC_CONFIG_CORRUPTED";
const char *IMAGE_UPLOAD_FAILED_STRING = "IMAGE_UPLOAD_FAILED";
const char *IMAGE_DOWNLOAD_FAILED_STRING = "IMAGE_DOWNLOAD_FAILED";
const char *IMAGE_UPLOAD_SUCCESSFUL_STRING = "IMAGE_UPLOAD_SUCCESSFUL";
@ -634,6 +635,8 @@ const char *translateEvents(Event event) {
return OPEN_IRQ_FILE_FAILED_STRING;
case (12414):
return PDEC_INIT_FAILED_STRING;
case (12415):
return PDEC_CONFIG_CORRUPTED_STRING;
case (12500):
return IMAGE_UPLOAD_FAILED_STRING;
case (12501):

View File

@ -2,7 +2,7 @@
* @brief Auto-generated object translation file.
* @details
* Contains 175 translations.
* Generated on: 2023-08-02 09:40:31
* Generated on: 2023-08-14 15:09:10
*/
#include "translateObjects.h"

View File

@ -22,11 +22,11 @@ ReturnValue_t PdecConfig::write() {
if (result != returnvalue::OK) {
return result;
}
result = writeFrameHeaderFirstOctet();
result = writeFrameHeaderFirstWord();
if (result != returnvalue::OK) {
return result;
}
result = writeFrameHeaderSecondOctet();
result = writeFrameHeaderSecondWord();
if (result != returnvalue::OK) {
return result;
}
@ -77,7 +77,7 @@ ReturnValue_t PdecConfig::setPositiveWindow(uint8_t pw) {
return result;
}
// Rewrite second config word which contains the positive window parameter
writeFrameHeaderSecondOctet();
writeFrameHeaderSecondWord();
return returnvalue::OK;
}
@ -92,7 +92,7 @@ ReturnValue_t PdecConfig::setNegativeWindow(uint8_t nw) {
return result;
}
// Rewrite second config word which contains the negative window parameter
writeFrameHeaderSecondOctet();
writeFrameHeaderSecondWord();
return returnvalue::OK;
}
@ -114,43 +114,23 @@ ReturnValue_t PdecConfig::getNegativeWindow(uint8_t& negativeWindow) {
return returnvalue::OK;
}
ReturnValue_t PdecConfig::writeFrameHeaderFirstOctet() {
ReturnValue_t PdecConfig::writeFrameHeaderFirstWord() {
uint32_t word = 0;
word |= (VERSION_ID << 30);
// Setting the bypass flag and the control command flag should not have any
// implication on the operation of the PDEC IP Core
word |= (BYPASS_FLAG << 29);
word |= (CONTROL_COMMAND_FLAG << 28);
word |= (RESERVED_FIELD_A << 26);
word |= (SPACECRAFT_ID << 16);
word |= (VIRTUAL_CHANNEL << 10);
word |= (DUMMY_BITS << 8);
uint8_t positiveWindow = 0;
ReturnValue_t result =
localParameterHandler.getValue(pdecconfigdefs::paramkeys::POSITIVE_WINDOW, positiveWindow);
ReturnValue_t result = createFirstWord(&word);
if (result != returnvalue::OK) {
return result;
}
word |= static_cast<uint32_t>(positiveWindow);
*(memoryBaseAddress + FRAME_HEADER_OFFSET) = word;
*(memoryBaseAddress + FRAME_HEADER_OFFSET + OFFSET_FIRST_CONFIG_WORD) = word;
return returnvalue::OK;
}
ReturnValue_t PdecConfig::writeFrameHeaderSecondOctet() {
uint8_t negativeWindow = 0;
ReturnValue_t result =
localParameterHandler.getValue(pdecconfigdefs::paramkeys::NEGATIVE_WINDOW, negativeWindow);
ReturnValue_t PdecConfig::writeFrameHeaderSecondWord() {
uint32_t word = 0;
ReturnValue_t result = createSecondWord(&word);
if (result != returnvalue::OK) {
return result;
}
uint32_t word = 0;
word = 0;
word |= (static_cast<uint32_t>(negativeWindow) << 24);
word |= (HIGH_AU_MAP_ID << 16);
word |= (ENABLE_DERANDOMIZER << 8);
*(memoryBaseAddress + FRAME_HEADER_OFFSET + 1) = word;
*(memoryBaseAddress + FRAME_HEADER_OFFSET + OFFSET_SECOND_CONFIG_WORD) = word;
return returnvalue::OK;
}
@ -189,3 +169,49 @@ uint8_t PdecConfig::getOddParity(uint8_t number) {
parityBit = ~(countBits & 0x1) & 0x1;
return parityBit;
}
ReturnValue_t PdecConfig::createFirstWord(uint32_t* word) {
*word = 0;
*word |= (VERSION_ID << 30);
// Setting the bypass flag and the control command flag should not have any
// implication on the operation of the PDEC IP Core
*word |= (BYPASS_FLAG << 29);
*word |= (CONTROL_COMMAND_FLAG << 28);
*word |= (RESERVED_FIELD_A << 26);
*word |= (SPACECRAFT_ID << 16);
*word |= (VIRTUAL_CHANNEL << 10);
*word |= (DUMMY_BITS << 8);
uint8_t positiveWindow = 0;
ReturnValue_t result =
localParameterHandler.getValue(pdecconfigdefs::paramkeys::POSITIVE_WINDOW, positiveWindow);
if (result != returnvalue::OK) {
return result;
}
*word |= static_cast<uint32_t>(positiveWindow);
return returnvalue::OK;
}
ReturnValue_t PdecConfig::createSecondWord(uint32_t* word) {
uint8_t negativeWindow = 0;
ReturnValue_t result =
localParameterHandler.getValue(pdecconfigdefs::paramkeys::NEGATIVE_WINDOW, negativeWindow);
if (result != returnvalue::OK) {
return result;
}
*word = 0;
*word = 0;
*word |= (static_cast<uint32_t>(negativeWindow) << 24);
*word |= (HIGH_AU_MAP_ID << 16);
*word |= (ENABLE_DERANDOMIZER << 8);
return returnvalue::OK;
}
uint32_t PdecConfig::readbackFirstWord() {
return *(memoryBaseAddress + FRAME_HEADER_OFFSET + OFFSET_FIRST_CONFIG_WORD);
}
uint32_t PdecConfig::readbackSecondWord() {
return *(memoryBaseAddress + FRAME_HEADER_OFFSET + OFFSET_SECOND_CONFIG_WORD);
}

View File

@ -48,6 +48,39 @@ class PdecConfig {
ReturnValue_t getPositiveWindow(uint8_t& positiveWindow);
ReturnValue_t getNegativeWindow(uint8_t& negativeWindow);
/**
* @brief Creates the first word of the PDEC configuration
*
* @param word The created word will be written to this pointer
*
* @return OK if successful, otherwise error return value
*
*/
ReturnValue_t createFirstWord(uint32_t* word);
/**
* @brief Creates the second word of the PDEC configuration
*
* @param word The created word will be written to this pointer
*
* @return OK if successful, otherwise error return value
*/
ReturnValue_t createSecondWord(uint32_t* word);
/**
* @brief Reads first config word from the config memory
*
* @return The config word
*/
uint32_t readbackFirstWord();
/**
* @brief Reads the second config word from the config memory
*
* @return The config word
*/
uint32_t readbackSecondWord();
private:
// TC transfer frame configuration parameters
static const uint8_t VERSION_ID = 0;
@ -66,6 +99,8 @@ class PdecConfig {
// 0x200 / 4 = 0x80
static const uint32_t FRAME_HEADER_OFFSET = 0x80;
static const uint32_t OFFSET_FIRST_CONFIG_WORD = 0;
static const uint32_t OFFSET_SECOND_CONFIG_WORD = 1;
static const uint32_t MAP_ADDR_LUT_OFFSET = 0xA0;
static const uint32_t MAP_CLK_FREQ_OFFSET = 0x90;
@ -102,8 +137,8 @@ class PdecConfig {
*/
ReturnValue_t createPersistentConfig();
ReturnValue_t writeFrameHeaderFirstOctet();
ReturnValue_t writeFrameHeaderSecondOctet();
ReturnValue_t writeFrameHeaderFirstWord();
ReturnValue_t writeFrameHeaderSecondWord();
void writeMapConfig();
/**

View File

@ -478,6 +478,7 @@ bool PdecHandler::checkFrameAna(uint32_t pdecFar) {
}
case (FrameAna_t::FRAME_DIRTY): {
triggerEvent(INVALID_TC_FRAME, FRAME_DIRTY_RETVAL);
checkConfig();
sif::warning << "PdecHandler::checkFrameAna: Frame dirty" << std::endl;
break;
}
@ -577,6 +578,29 @@ void PdecHandler::handleIReason(uint32_t pdecFar, ReturnValue_t parameter1) {
}
}
void PdecHandler::checkConfig() {
uint32_t firstWord = 0;
ReturnValue_t result = pdecConfig.createFirstWord(&firstWord);
if (result != returnvalue::OK) {
// This should normally never happen during runtime. So here is just
// output a warning
sif::warning << "PdecHandler::checkConfig: Failed to create first word" << std::endl;
return;
}
uint32_t secondWord = 0;
result = pdecConfig.createSecondWord(&secondWord);
if (result != returnvalue::OK) {
// This should normally never happen during runtime. So here is just
// output a warning
sif::warning << "PdecHandler::checkConfig: Failed to create second word" << std::endl;
return;
}
if (firstWord != pdecConfig.readbackFirstWord() or
secondWord != pdecConfig.readbackSecondWord()) {
triggerEvent(PDEC_CONFIG_CORRUPTED, firstWord, secondWord);
}
}
void PdecHandler::handleNewTc() {
ReturnValue_t result = returnvalue::OK;

View File

@ -282,6 +282,11 @@ class PdecHandler : public SystemObject,
*/
void handleIReason(uint32_t pdecFar, ReturnValue_t parameter1);
/**
* @brief Checks if PDEC configuration is still correct
*/
void checkConfig();
/**
* @brief Handles the reception of new TCs. Reads the pointer to the storage location of the
* new TC segment, extracts the PUS packet and forwards the data to the object

View File

@ -71,6 +71,10 @@ static constexpr Event OPEN_IRQ_FILE_FAILED = event::makeEvent(SUBSYSTEM_ID, 13,
//! [EXPORT] : [COMMENT] PDEC initialization failed. This might also be due to the persistent
//! confiuration never becoming available, for example due to SD card issues.
static constexpr Event PDEC_INIT_FAILED = event::makeEvent(SUBSYSTEM_ID, 14, severity::HIGH);
//! [EXPORT] : [COMMENT] The PDEC configuration area has been corrupted
//! P1: The first configuration word
//! P2: The second configuration word
static constexpr Event PDEC_CONFIG_CORRUPTED = event::makeEvent(SUBSYSTEM_ID, 15, severity::HIGH);
// Action IDs
static constexpr ActionId_t PRINT_CLCW = 0;