From a47c8d91a0c2a794d6cd16d67372de5af9be8bf5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 23 Feb 2021 17:01:25 +0100 Subject: [PATCH] continued test task --- linux/boardtest/SpiTestClass.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/linux/boardtest/SpiTestClass.cpp b/linux/boardtest/SpiTestClass.cpp index 537709fb..f3baa778 100644 --- a/linux/boardtest/SpiTestClass.cpp +++ b/linux/boardtest/SpiTestClass.cpp @@ -43,9 +43,13 @@ ReturnValue_t SpiTestClass::performPeriodicAction() { } void SpiTestClass::performRm3100Test() { + /* Configure all SPI chip selects and pull them high */ + acsInit(); + /* Adapt accordingly */ uint8_t chipSelectPin = mgm1Rm3100ChipSelect; uint32_t rm3100Speed = 3'900'000; + uint8_t rm3100whoAmIReg = 0b0000'1111; int rm3100mode = SPI_MODE_3; #ifdef RASPBERRY_PI std::string deviceName = "spidev0.0"; @@ -61,11 +65,16 @@ void SpiTestClass::performRm3100Test() { return; } - int retval = ioctl(fileDescriptor, SPI_IOC_WR_MODE, rm3100Speed); + int retval = ioctl(fileDescriptor, SPI_IOC_WR_MODE, rm3100mode); if(retval != 0) { utility::handleIoctlError("SpiTestClass::performRm3100Test: Setting SPI mode failed!"); } - acsInit(); + + retval = ioctl(fileDescriptor, SPI_IOC_WR_MAX_SPEED_HZ, rm3100Speed); + if(retval != 0) { + utility::handleIoctlError("SpiTestClass::performRm3100Test: Setting SPI speed failed!"); + } + } void SpiTestClass::acsInit() {