diff --git a/bsp_q7s/boardconfig/busConf.h b/bsp_q7s/boardconfig/busConf.h index 3fb8d801..4ccdc78d 100644 --- a/bsp_q7s/boardconfig/busConf.h +++ b/bsp_q7s/boardconfig/busConf.h @@ -15,7 +15,7 @@ static constexpr char UART_PLOC_MPSOC_DEV[] = "/dev/ul-plmpsoc"; static constexpr char UART_PLOC_SUPERVSIOR_DEV[] = "/dev/ul-plsv"; static constexpr char UART_SYRLINKS_DEV[] = "/dev/ul-syrlinks"; static constexpr char UART_STAR_TRACKER_DEV[] = "/dev/ul-str"; -static constexpr char UART_SCEX_DEV[] = "/dev/ul-scex"; +static constexpr char UART_SCEX_DEV[] = "/dev/ttyS-SCEX"; static constexpr char UIO_PDEC_REGISTERS[] = "/dev/uio0"; static constexpr char UIO_PTME[] = "/dev/uio1"; diff --git a/fsfw b/fsfw index 1c53b604..81955876 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 1c53b60442f5b858b00938169ef1daba41ba272d +Subproject commit 8195587604c5f14f04bf25b16a514cf3c771284b diff --git a/linux/ObjectFactory.cpp b/linux/ObjectFactory.cpp index 43e4109a..5c735983 100644 --- a/linux/ObjectFactory.cpp +++ b/linux/ObjectFactory.cpp @@ -326,9 +326,8 @@ void ObjectFactory::createRtdComponents(std::string spiDev, GpioIF* gpioComIF, void ObjectFactory::createScexComponents(std::string uartDev, PowerSwitchIF* pwrSwitcher, SdCardMountedIF& mountedIF, bool onImmediately, std::optional switchId) { - // objekte anlegen auto* cookie = new UartCookie(objects::SCEX, uartDev, uart::SCEX_BAUD, 4096); - + cookie->setTwoStopBits(); auto scexUartReader = new ScexUartReader(objects::SCEX_UART_READER); auto scexHandler = new ScexDeviceHandler(objects::SCEX, *scexUartReader, cookie, mountedIF); if (onImmediately) { diff --git a/linux/devices/ScexUartReader.cpp b/linux/devices/ScexUartReader.cpp index c8320a11..24461395 100644 --- a/linux/devices/ScexUartReader.cpp +++ b/linux/devices/ScexUartReader.cpp @@ -51,6 +51,9 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) { } } ReturnValue_t result = returnvalue::OK; + // Can be used to read frame, parity and overrun errors + // serial_icounter_struct icounter{}; + // uart::readCountersAndErrors(serialPort, icounter); while (result != DleParser::NO_PACKET_FOUND) { result = tryDleParsing(); } @@ -94,8 +97,15 @@ ReturnValue_t ScexUartReader::initializeInterface(CookieIF *cookie) { return FAILED; } // Setting up UART parameters - tty.c_cflag &= ~PARENB; // Clear parity bit - tty.c_cflag &= ~CSTOPB; // Clear stop field, only one stop bit used in communication + tty.c_cflag &= ~PARENB; // Clear parity bit + if (uartCookie->getStopBits() == StopBits::TWO_STOP_BITS) { + // Use two stop bits + tty.c_cflag |= CSTOPB; + } else { + // Clear stop field, only one stop bit used in communication + tty.c_cflag &= ~CSTOPB; + } + tty.c_cflag &= ~CSIZE; // Clear all the size bits tty.c_cflag |= CS8; // 8 bits per byte tty.c_cflag &= ~CRTSCTS; // Disable RTS/CTS hardware flow control @@ -108,13 +118,10 @@ ReturnValue_t ScexUartReader::initializeInterface(CookieIF *cookie) { tty.c_cc[VTIME] = 0; tty.c_cc[VMIN] = 0; - // Q7S UART Lite has fixed baud rate. For other linux systems, set baud rate here. -#if !defined(XIPHOS_Q7S) - if (cfsetispeed(&tty, B57600) != 0) { + // The SCEX experiment has a fixed baud rate. + if (cfsetispeed(&tty, B38400) != 0) { sif::warning << "ScexUartReader::initializeInterface: Setting baud rate failed" << std::endl; } -#endif - if (tcsetattr(serialPort, TCSANOW, &tty) != 0) { sif::warning << "ScexUartReader::initializeInterface: tcsetattr call failed with error [" << errno << ", " << strerror(errno) << std::endl;