From eb1b4f1b053cb1be9c55aed563344554dfe779ca Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 22 Feb 2022 10:49:00 +0100 Subject: [PATCH] ping working on Pi now --- linux/boardtest/UartTestClass.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/linux/boardtest/UartTestClass.cpp b/linux/boardtest/UartTestClass.cpp index 9336df9f..326e9072 100644 --- a/linux/boardtest/UartTestClass.cpp +++ b/linux/boardtest/UartTestClass.cpp @@ -151,6 +151,13 @@ void UartTestClass::scexInit() { tty.c_cc[VTIME] = 1; // In units of 0.1 seconds tty.c_cc[VMIN] = 255; // Read up to 255 bytes + // Q7S UART Lite has fixed baud rate. For other linux systems, set baud rate here. +#if !defined(XIPHOS_Q7S) + if (cfsetispeed(&tty, B57600) != 0) { + sif::warning << "UartTestClass::scexInit: Setting baud rate failed" << std::endl; + } +#endif + if (tcsetattr(serialPort, TCSANOW, &tty) != 0) { sif::warning << "tcsetattr call failed with error [" << errno << ", " << strerror(errno) << std::endl; @@ -183,8 +190,8 @@ void UartTestClass::scexPeriodic() { sif::debug << "UartTestClass::performPeriodicAction: recv buffer might not be large enough" << std::endl; } else if (bytesRead > 0) { - sif::info << "Received " << bytesRead << " from the Solar Cell Experiment:" << std::endl; - arrayprinter::print(recBuf.data(), bytesRead); + sif::info << "Received " << bytesRead << " bytes from the Solar Cell Experiment:" << std::endl; + arrayprinter::print(recBuf.data(), bytesRead, OutputType::HEX, false); } } while (bytesRead > 0); }