small bugfix for rm3100
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2021-09-15 17:26:23 +02:00
parent 39acc24535
commit c7d0a9551e
10 changed files with 51 additions and 54 deletions

View File

@ -212,7 +212,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen
result = HasReturnvaluesIF::RETURN_OK; result = HasReturnvaluesIF::RETURN_OK;
} }
cookie->assignTransferSize(decodedFrameLen); cookie->setTransferSize(decodedFrameLen);
closeSpi(gpioId, gpioIF, mutex); closeSpi(gpioId, gpioIF, mutex);

View File

@ -482,8 +482,9 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI
spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev, spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev,
L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER,
objects::SPI_COM_IF, spiCookie); objects::SPI_COM_IF, spiCookie, 0);
gyroL3gHandler->setStartUpImmediately(); gyroL3gHandler->setStartUpImmediately();
//gyroL3gHandler->setGoNormalModeAtStartup();
// Gyro 2 Side B // Gyro 2 Side B
spiCookie = new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev, spiCookie = new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev,
ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE, ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE,
@ -495,8 +496,9 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI
spiCookie = new SpiCookie(addresses::GYRO_3_L3G, gpioIds::GYRO_3_L3G_CS, spiDev, spiCookie = new SpiCookie(addresses::GYRO_3_L3G, gpioIds::GYRO_3_L3G_CS, spiDev,
L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED);
gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_3_L3G_HANDLER, gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_3_L3G_HANDLER,
objects::SPI_COM_IF, spiCookie); objects::SPI_COM_IF, spiCookie, 0);
gyroL3gHandler->setStartUpImmediately(); gyroL3gHandler->setStartUpImmediately();
//gyroL3gHandler->setGoNormalModeAtStartup();
resetArgsGnss1.gnss1 = true; resetArgsGnss1.gnss1 = true;
resetArgsGnss1.gpioComIF = gpioComIF; resetArgsGnss1.gpioComIF = gpioComIF;

2
fsfw

@ -1 +1 @@
Subproject commit 97494a84dfd0acb9dc32770ae9d142f80d4bbcfa Subproject commit bdd7d59d82a0b9290d77844fbcc5be61c61bcbcb

View File

@ -74,5 +74,6 @@ static constexpr size_t FSFW_MAX_TM_PACKET_SIZE = 2048;
#define FSFW_HAL_LINUX_SPI_WIRETAPPING 0 #define FSFW_HAL_LINUX_SPI_WIRETAPPING 0
#define FSFW_DEV_HYPERION_GPS_CREATE_NMEA_CSV 0 #define FSFW_DEV_HYPERION_GPS_CREATE_NMEA_CSV 0
#define FSFW_HAL_L3GD20_GYRO_DEBUG 0
#endif /* CONFIG_FSFWCONFIG_H_ */ #endif /* CONFIG_FSFWCONFIG_H_ */

View File

@ -446,7 +446,7 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
// DeviceHandlerIF::SEND_READ); // DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, // thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8,
// DeviceHandlerIF::GET_READ); // DeviceHandlerIF::GET_READ);
// ////
// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, // thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0,
// DeviceHandlerIF::PERFORM_OPERATION); // DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2, // thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2,
@ -469,28 +469,28 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
// thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, // thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8,
// DeviceHandlerIF::GET_READ); // DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.2,
DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.4,
DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6,
DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.8,
DeviceHandlerIF::GET_READ);
// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0,
// DeviceHandlerIF::PERFORM_OPERATION); // DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.2,
// DeviceHandlerIF::SEND_WRITE); // DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.4,
// DeviceHandlerIF::GET_WRITE); // DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6,
// DeviceHandlerIF::SEND_READ); // DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, // thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.8,
// DeviceHandlerIF::GET_READ); // DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2,
DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4,
DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6,
DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8,
DeviceHandlerIF::GET_READ);
// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0, // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0,
// DeviceHandlerIF::PERFORM_OPERATION); // DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.2, // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.2,

View File

@ -403,7 +403,7 @@ ReturnValue_t GyroADIS16507Handler::spiSendCallback(SpiComIF *comIf, SpiCookie *
cookie->getSpiParameters(spiMode, spiSpeed, nullptr); cookie->getSpiParameters(spiMode, spiSpeed, nullptr);
comIf->setSpiSpeedAndMode(fileDescriptor, spiMode, spiSpeed); comIf->setSpiSpeedAndMode(fileDescriptor, spiMode, spiSpeed);
cookie->assignWriteBuffer(sendData); cookie->assignWriteBuffer(sendData);
cookie->assignTransferSize(2); cookie->setTransferSize(2);
gpioId_t gpioId = cookie->getChipSelectPin(); gpioId_t gpioId = cookie->getChipSelectPin();
GpioIF* gpioIF = comIf->getGpioInterface(); GpioIF* gpioIF = comIf->getGpioInterface();

View File

@ -292,14 +292,14 @@ ReturnValue_t MGMHandlerLIS3MDL::interpretDeviceReply(DeviceCommandId_t id,
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "MGMHandlerLIS3: Magnetic field strength in" sif::info << "MGMHandlerLIS3: Magnetic field strength in"
" microtesla:" << std::endl; " microtesla:" << std::endl;
sif::info << "X: " << mgmX << " \xC2\xB5T" << std::endl; sif::info << "X: " << mgmX << " uT" << std::endl;
sif::info << "Y: " << mgmY << " \xC2\xB5T" << std::endl; sif::info << "Y: " << mgmY << " uT" << std::endl;
sif::info << "Z: " << mgmZ << " \xC2\xB5T" << std::endl; sif::info << "Z: " << mgmZ << " uT" << std::endl;
#else #else
sif::printInfo("MGMHandlerLIS3: Magnetic field strength in microtesla:\n"); sif::printInfo("MGMHandlerLIS3: Magnetic field strength in microtesla:\n");
sif::printInfo("X: %f " "\xC2\xB5" "T\n", mgmX); sif::printInfo("X: %f uT\n", mgmX);
sif::printInfo("Y: %f " "\xC2\xB5" "T\n", mgmY); sif::printInfo("Y: %f uT\n", mgmY);
sif::printInfo("Z: %f " "\xC2\xB5" "T\n", mgmZ); sif::printInfo("Z: %f uT\n", mgmZ);
#endif /* FSFW_CPP_OSTREAM_ENABLED == 0 */ #endif /* FSFW_CPP_OSTREAM_ENABLED == 0 */
} }
#endif /* OBSW_VERBOSE_LEVEL >= 1 */ #endif /* OBSW_VERBOSE_LEVEL >= 1 */
@ -320,10 +320,10 @@ ReturnValue_t MGMHandlerLIS3MDL::interpretDeviceReply(DeviceCommandId_t id,
if(debugDivider->check()) { if(debugDivider->check()) {
/* Set terminal to utf-8 if there is an issue with micro printout. */ /* Set terminal to utf-8 if there is an issue with micro printout. */
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "MGMHandlerLIS3: Temperature: " << tempValue << " \xC2\xB0" << "C" << sif::info << "MGMHandlerLIS3: Temperature: " << tempValue << " C" <<
std::endl; std::endl;
#else #else
sif::printInfo("MGMHandlerLIS3: Temperature: %f" "\xC2\xB0" "C\n"); sif::printInfo("MGMHandlerLIS3: Temperature: %f C\n");
#endif #endif
} }
#endif #endif

View File

@ -63,6 +63,7 @@ void MGMHandlerRM3100::doShutDown() {
ReturnValue_t MGMHandlerRM3100::buildTransitionDeviceCommand( ReturnValue_t MGMHandlerRM3100::buildTransitionDeviceCommand(
DeviceCommandId_t *id) { DeviceCommandId_t *id) {
size_t commandLen = 0;
switch(internalState) { switch(internalState) {
case(InternalState::NONE): case(InternalState::NONE):
case(InternalState::NORMAL): { case(InternalState::NORMAL): {
@ -77,6 +78,8 @@ ReturnValue_t MGMHandlerRM3100::buildTransitionDeviceCommand(
break; break;
} }
case(InternalState::STATE_CONFIGURE_TMRC): { case(InternalState::STATE_CONFIGURE_TMRC): {
commandBuffer[0] = RM3100::TMRC_DEFAULT_VALUE;
commandLen = 1;
*id = RM3100::CONFIGURE_TMRC; *id = RM3100::CONFIGURE_TMRC;
break; break;
} }
@ -85,18 +88,17 @@ ReturnValue_t MGMHandlerRM3100::buildTransitionDeviceCommand(
break; break;
} }
default: default:
/* Might be a configuration error. */ // Might be a configuration error
sif::debug << "GyroHandler::buildTransitionDeviceCommand: Unknown internal state!" << sif::warning << "MGMHandlerRM3100::buildTransitionDeviceCommand: Unknown internal state!" <<
std::endl; std::endl;
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
return buildCommandFromCommand(*id, nullptr, 0); return buildCommandFromCommand(*id, commandBuffer, commandLen);
} }
ReturnValue_t MGMHandlerRM3100::buildCommandFromCommand( ReturnValue_t MGMHandlerRM3100::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
DeviceCommandId_t deviceCommand, const uint8_t *commandData, const uint8_t *commandData, size_t commandDataLen) {
size_t commandDataLen) {
switch(deviceCommand) { switch(deviceCommand) {
case(RM3100::CONFIGURE_CMM): { case(RM3100::CONFIGURE_CMM): {
commandBuffer[0] = RM3100::CMM_REGISTER; commandBuffer[0] = RM3100::CMM_REGISTER;
@ -113,8 +115,7 @@ ReturnValue_t MGMHandlerRM3100::buildCommandFromCommand(
break; break;
} }
case(RM3100::CONFIGURE_TMRC): { case(RM3100::CONFIGURE_TMRC): {
return handleTmrcConfigCommand(deviceCommand, commandData, return handleTmrcConfigCommand(deviceCommand, commandData, commandDataLen);
commandDataLen);
} }
case(RM3100::READ_TMRC): { case(RM3100::READ_TMRC): {
commandBuffer[0] = RM3100::TMRC_REGISTER | RM3100::READ_MASK; commandBuffer[0] = RM3100::TMRC_REGISTER | RM3100::READ_MASK;
@ -124,8 +125,7 @@ ReturnValue_t MGMHandlerRM3100::buildCommandFromCommand(
break; break;
} }
case(RM3100::CONFIGURE_CYCLE_COUNT): { case(RM3100::CONFIGURE_CYCLE_COUNT): {
return handleCycleCountConfigCommand(deviceCommand, commandData, return handleCycleCountConfigCommand(deviceCommand, commandData, commandDataLen);
commandDataLen);
} }
case(RM3100::READ_CYCLE_COUNT): { case(RM3100::READ_CYCLE_COUNT): {
commandBuffer[0] = RM3100::CYCLE_COUNT_START_REGISTER | RM3100::READ_MASK; commandBuffer[0] = RM3100::CYCLE_COUNT_START_REGISTER | RM3100::READ_MASK;
@ -162,8 +162,7 @@ ReturnValue_t MGMHandlerRM3100::scanForReply(const uint8_t *start,
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t MGMHandlerRM3100::interpretDeviceReply( ReturnValue_t MGMHandlerRM3100::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
DeviceCommandId_t id, const uint8_t *packet) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
switch(id) { switch(id) {
case(RM3100::CONFIGURE_CMM): case(RM3100::CONFIGURE_CMM):
@ -281,19 +280,14 @@ ReturnValue_t MGMHandlerRM3100::handleCycleCommand(bool oneCycleValue,
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
ReturnValue_t MGMHandlerRM3100::handleTmrcConfigCommand( ReturnValue_t MGMHandlerRM3100::handleTmrcConfigCommand(DeviceCommandId_t deviceCommand,
DeviceCommandId_t deviceCommand, const uint8_t *commandData, const uint8_t *commandData, size_t commandDataLen) {
size_t commandDataLen) { if(commandData == nullptr or commandDataLen != 1) {
if(commandData == nullptr) {
return DeviceHandlerIF::INVALID_COMMAND_PARAMETER;
}
if(commandDataLen != 1) {
return DeviceHandlerIF::INVALID_COMMAND_PARAMETER; return DeviceHandlerIF::INVALID_COMMAND_PARAMETER;
} }
commandBuffer[0] = RM3100::TMRC_REGISTER; commandBuffer[0] = RM3100::TMRC_REGISTER;
commandBuffer[1] = commandData[1]; commandBuffer[1] = commandData[0];
rawPacketLen = 2; rawPacketLen = 2;
rawPacket = commandBuffer; rawPacket = commandBuffer;
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
@ -325,7 +319,7 @@ ReturnValue_t MGMHandlerRM3100::initializeLocalDataPool(
} }
uint32_t MGMHandlerRM3100::getTransitionDelayMs(Mode_t from, Mode_t to) { uint32_t MGMHandlerRM3100::getTransitionDelayMs(Mode_t from, Mode_t to) {
return 10000; return 25000;
} }
ReturnValue_t MGMHandlerRM3100::getSwitches(const uint8_t **switches, uint8_t *numberOfSwitches) { ReturnValue_t MGMHandlerRM3100::getSwitches(const uint8_t **switches, uint8_t *numberOfSwitches) {

View File

@ -45,7 +45,7 @@ static constexpr uint8_t TMRC_75HZ_VALUE = 0x95;
static constexpr uint8_t TMRC_DEFAULT_37HZ_VALUE = 0x96; static constexpr uint8_t TMRC_DEFAULT_37HZ_VALUE = 0x96;
static constexpr uint8_t TMRC_REGISTER = 0x0B; static constexpr uint8_t TMRC_REGISTER = 0x0B;
static constexpr uint8_t TMRC_DEFAULT_VALUE = TMRC_DEFAULT_37HZ_VALUE; static constexpr uint8_t TMRC_DEFAULT_VALUE = TMRC_75HZ_VALUE;
static constexpr uint8_t MEASUREMENT_REG_START = 0x24; static constexpr uint8_t MEASUREMENT_REG_START = 0x24;
static constexpr uint8_t BIST_REGISTER = 0x33; static constexpr uint8_t BIST_REGISTER = 0x33;

2
tmtc

@ -1 +1 @@
Subproject commit d9968031d641249ca0ad62e7c1c19ed22390078c Subproject commit dff569e93ff3cb5e62627c89cfa2229f464c76de