From 9e81384c5efc85386f16f212c75dbcb2393e5f7f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 5 Oct 2022 18:44:52 +0200 Subject: [PATCH] two stop bits and even parity helps --- linux/ObjectFactory.cpp | 4 ++-- linux/devices/ScexUartReader.cpp | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/linux/ObjectFactory.cpp b/linux/ObjectFactory.cpp index 43e4109a..392d129a 100644 --- a/linux/ObjectFactory.cpp +++ b/linux/ObjectFactory.cpp @@ -326,9 +326,9 @@ 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(); + cookie->setParityEven(); 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 f1b04be3..2af26781 100644 --- a/linux/devices/ScexUartReader.cpp +++ b/linux/devices/ScexUartReader.cpp @@ -35,7 +35,7 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) { while (true) { semaphore->acquire(); int bytesRead = 0; - debugMode = true; + // debugMode = true; while (true) { bytesRead = read(serialPort, reinterpret_cast(recBuf.data()), static_cast(recBuf.size())); @@ -55,7 +55,7 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) { while (result != DleParser::NO_PACKET_FOUND) { result = dleParser.parseRingBuf(bytesRead); if (result == returnvalue::OK) { - sif::info << "FOund dle packet, read " << bytesRead << " bytes" << std::endl; + // sif::info << "Found dle packet, read " << bytesRead << " bytes" << std::endl; // Packet found, advance read pointer. auto& decodedPacket = dleParser.getContext().decodedPacket; handleFoundDlePacket(decodedPacket.first, decodedPacket.second); @@ -127,8 +127,7 @@ ReturnValue_t ScexUartReader::initializeInterface(CookieIF *cookie) { tty.c_cc[VTIME] = 0; tty.c_cc[VMIN] = 0; - // The SCEX experiment has a fixed baud rate. For other linux systems, set baud rate here. -//#if !defined(XIPHOS_Q7S) + // The SCEX experiment has a fixed baud rate. if (cfsetispeed(&tty, B38400) != 0) { sif::warning << "ScexUartReader::initializeInterface: Setting baud rate failed" << std::endl; }