acd board tests continued
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
2021-09-13 18:07:07 +02:00
parent c67a7ef1d8
commit 3354f2a696
13 changed files with 99 additions and 77 deletions

View File

@ -1,5 +1,4 @@
#include "SpiTestClass.h"
#include "OBSWConfig.h"
#include "devices/gpioIds.h"
@ -20,7 +19,6 @@
#include <sys/ioctl.h>
#include <bitset>
SpiTestClass::SpiTestClass(object_id_t objectId, GpioIF* gpioIF): TestTask(objectId),
gpioIF(gpioIF) {
if(gpioIF == nullptr) {
@ -37,11 +35,11 @@ ReturnValue_t SpiTestClass::performOneShotAction() {
break;
}
case(TestModes::MGM_LIS3MDL): {
performLis3MdlTest(mgm2Lis3mdlChipSelect);
performLis3MdlTest(mgm0Lis3mdlChipSelect);
break;
}
case(TestModes::MGM_RM3100): {
performRm3100Test(mgm3Rm3100ChipSelect);
performRm3100Test(mgm1Rm3100ChipSelect);
break;
}
case(TestModes::GYRO_L3GD20H): {
@ -150,10 +148,10 @@ void SpiTestClass::performRm3100Test(uint8_t mgmId) {
float fieldStrengthY = rawY * scaleFactor;
float fieldStrengthZ = rawZ * scaleFactor;
sif::info << "RM3100 measured field strenghts in microtesla:" << std::endl;
sif::info << "Field Strength X: " << fieldStrengthX << " \xC2\xB5T" << std::endl;
sif::info << "Field Strength Y: " << fieldStrengthY << " \xC2\xB5T" << std::endl;
sif::info << "Field Strength Z: " << fieldStrengthZ << " \xC2\xB5T" << std::endl;
sif::info << "RM3100 measured field strengths in microtesla:" << std::endl;
sif::info << "Field Strength X: " << fieldStrengthX << " uT" << std::endl;
sif::info << "Field Strength Y: " << fieldStrengthY << " uT" << std::endl;
sif::info << "Field Strength Z: " << fieldStrengthZ << " uT" << std::endl;
}
void SpiTestClass::performLis3MdlTest(uint8_t lis3Id) {
@ -174,8 +172,8 @@ void SpiTestClass::performLis3MdlTest(uint8_t lis3Id) {
else {
currentGpioId = gpioIds::MGM_2_LIS3_CS;
}
uint32_t spiSpeed = 3'900'000;
spi::SpiModes spiMode = spi::SpiModes::MODE_3;
uint32_t spiSpeed = 10'000'000;
spi::SpiModes spiMode = spi::SpiModes::MODE_0;
#ifdef RASPBERRY_PI
std::string deviceName = "/dev/spidev0.0";
#else
@ -208,10 +206,10 @@ void SpiTestClass::performL3gTest(uint8_t l3gId) {
/* Configure all SPI chip selects and pull them high */
acsInit();
l3gId = gyro2L3gd20ChipSelect;
l3gId = gyro3L3gd20ChipSelect;
/* Adapt accordingly */
if(l3gId != gyro1L3gd20ChipSelect and l3gId != gyro2L3gd20ChipSelect) {
if(l3gId != gyro1L3gd20ChipSelect and l3gId != gyro3L3gd20ChipSelect) {
sif::warning << "SpiTestClass::performLis3MdlTest: Invalid MGM ID!" << std::endl;
}
gpioId_t currentGpioId = 0;
@ -331,36 +329,32 @@ void SpiTestClass::acsInit() {
gpio::Direction::OUT, 1);
gpioCookie->addGpio(gpioIds::MGM_3_RM3100_CS, gpio);
#elif defined(XIPHOS_Q7S)
std::string q7sGpioName5 = "gpiochip5";
std::string q7sGpioName6 = "gpiochip6";
gpio = new GpiodRegular(q7sGpioName5, mgm0Lis3mdlChipSelect, "MGM_0_LIS3",
gpio::Direction::OUT, gpio::HIGH);
gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, mgm0Lis3mdlChipSelect,
"MGM_0_LIS3", gpio::Direction::OUT, gpio::HIGH);
gpioCookie->addGpio(gpioIds::MGM_0_LIS3_CS, gpio);
gpio = new GpiodRegular(q7sGpioName5, mgm1Rm3100ChipSelect, "MGM_1_RM3100",
gpio::Direction::OUT, gpio::HIGH);
gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, mgm1Rm3100ChipSelect,
"MGM_1_RM3100", gpio::Direction::OUT, gpio::HIGH);
gpioCookie->addGpio(gpioIds::MGM_1_RM3100_CS, gpio);
gpio = new GpiodRegular(q7sGpioName5, gyro0AdisChipSelect, "GYRO_0_ADIS",
gpio::Direction::OUT, gpio::HIGH);
gpioCookie->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio);
gpio = new GpiodRegular(q7sGpioName5, gyro1L3gd20ChipSelect, "GYRO_1_L3G",
gpio::Direction::OUT, gpio::HIGH);
gpioCookie->addGpio(gpioIds::GYRO_1_L3G_CS, gpio);
gpio = new GpiodRegular(q7sGpioName5, gyro2L3gd20ChipSelect, "GYRO_2_L3G",
gpio::Direction::OUT, gpio::HIGH);
gpioCookie->addGpio(gpioIds::GYRO_3_L3G_CS, gpio);
gpio = new GpiodRegular(q7sGpioName6, mgm2Lis3mdlChipSelect, "MGM_2_LIS3",
gpio::Direction::OUT, gpio::HIGH);
gpio = new GpiodRegular(q7s::GPIO_MGM2_LIS3_CHIP, mgm2Lis3mdlChipSelect,
"MGM_2_LIS3", gpio::Direction::OUT, gpio::HIGH);
gpioCookie->addGpio(gpioIds::MGM_2_LIS3_CS, gpio);
gpio = new GpiodRegular(q7sGpioName5, mgm3Rm3100ChipSelect, "MGM_3_RM3100",
gpio::Direction::OUT, gpio::HIGH);
gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, mgm3Rm3100ChipSelect,
"MGM_3_RM3100", gpio::Direction::OUT, gpio::HIGH);
gpioCookie->addGpio(gpioIds::MGM_3_RM3100_CS, gpio);
gpio = new GpiodRegular(q7s::GPIO_GYRO_ADIS_CHIP, gyro0AdisChipSelect,
"GYRO_0_ADIS", gpio::Direction::OUT, gpio::HIGH);
gpioCookie->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio);
gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, gyro1L3gd20ChipSelect,
"GYRO_1_L3G", gpio::Direction::OUT, gpio::HIGH);
gpioCookie->addGpio(gpioIds::GYRO_1_L3G_CS, gpio);
gpio = new GpiodRegular(q7s::GPIO_GYRO_ADIS_CHIP, gyro2AdisChipSelect,
"GYRO_2_ADIS", gpio::Direction::OUT, gpio::HIGH);
gpioCookie->addGpio(gpioIds::GYRO_2_ADIS_CS, gpio);
gpio = new GpiodRegular(q7s::GPIO_ACS_BOARD_DEFAULT_CHIP, gyro3L3gd20ChipSelect,
"GYRO_3_L3G", gpio::Direction::OUT, gpio::HIGH);
gpioCookie->addGpio(gpioIds::GYRO_3_L3G_CS, gpio);
#endif
if(gpioIF != nullptr) {
gpioIF->addGpios(gpioCookie);