Merge branch 'mueller/scex-em-tests' into scex-additions
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2022-10-06 15:36:26 +02:00
commit 6d9999292c
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
4 changed files with 17 additions and 11 deletions

View File

@ -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";

2
fsfw

@ -1 +1 @@
Subproject commit 1c53b60442f5b858b00938169ef1daba41ba272d
Subproject commit 8195587604c5f14f04bf25b16a514cf3c771284b

View File

@ -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<power::Switch_t> 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) {

View File

@ -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;