From 6d758222b68d1824104d26b9d048ed061d3e3e18 Mon Sep 17 00:00:00 2001 From: Andy Piper Date: Thu, 30 May 2024 16:31:36 +0100 Subject: [PATCH] AP_IOMCU: correct TCIE setting and add more debug --- libraries/AP_IOMCU/AP_IOMCU.cpp | 4 ++-- libraries/AP_IOMCU/iofirmware/iofirmware.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/AP_IOMCU/AP_IOMCU.cpp b/libraries/AP_IOMCU/AP_IOMCU.cpp index ea42bc89e6..96c1c04549 100644 --- a/libraries/AP_IOMCU/AP_IOMCU.cpp +++ b/libraries/AP_IOMCU/AP_IOMCU.cpp @@ -637,8 +637,8 @@ bool AP_IOMCU::read_registers(uint8_t page, uint8_t offset, uint8_t count, uint1 // wait for the expected number of reply bytes or timeout if (!uart.wait_timeout(count*2+4, 10)) { - debug("t=%lu timeout read page=%u offset=%u count=%u\n", - AP_HAL::millis(), page, offset, count); + debug("t=%lu timeout read page=%u offset=%u count=%u avail=%u\n", + AP_HAL::millis(), page, offset, count, uart.available()); protocol_fail_count++; return false; } diff --git a/libraries/AP_IOMCU/iofirmware/iofirmware.cpp b/libraries/AP_IOMCU/iofirmware/iofirmware.cpp index bb24b0dcad..b17d511ff8 100644 --- a/libraries/AP_IOMCU/iofirmware/iofirmware.cpp +++ b/libraries/AP_IOMCU/iofirmware/iofirmware.cpp @@ -91,7 +91,7 @@ static void setup_tx_dma(hal_uart_driver* uart) dmaStreamSetMode(uart->dmatx, uart->dmatxmode | STM32_DMA_CR_DIR_M2P | STM32_DMA_CR_MINC | STM32_DMA_CR_TCIE); // enable transmission complete interrupt - uart->usart->SR = ~USART_SR_TC; + uart->usart->SR &= ~USART_SR_TC; uart->usart->CR1 |= USART_CR1_TCIE; dmaStreamEnable(uart->dmatx);