From 863328c5af95c0986cb1f3199c723570385ca4a0 Mon Sep 17 00:00:00 2001 From: Nathan Seidle Date: Wed, 18 Mar 2020 15:42:27 -0600 Subject: [PATCH] Increase buffers to 4k. Remove loop from RX ISR. --- cores/arduino/ard_sup/ap3_uart.h | 6 +++--- cores/arduino/ard_sup/uart/ap3_uart.cpp | 13 +++++-------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/cores/arduino/ard_sup/ap3_uart.h b/cores/arduino/ard_sup/ap3_uart.h index 9358e6a..4dfc0ae 100644 --- a/cores/arduino/ard_sup/ap3_uart.h +++ b/cores/arduino/ard_sup/ap3_uart.h @@ -30,11 +30,11 @@ SOFTWARE. #include "RingBuffer.h" #ifndef AP3_UART_RINGBUFF_SIZE -#define AP3_UART_RINGBUFF_SIZE 256 +#define AP3_UART_RINGBUFF_SIZE 256 * 16 #endif #ifndef AP3_UART_LINBUFF_SIZE -#define AP3_UART_LINBUFF_SIZE 256 +#define AP3_UART_LINBUFF_SIZE 256 * 16 #endif typedef RingBufferN AP3UartRingBuffer; @@ -78,7 +78,7 @@ class Uart : public HardwareSerial operator bool() { return true; } // todo: wait for a serial terminal to be open... probably depends on RTS or CTS... private: -public: //temporary +public: //temporary AP3UartRingBuffer _rx_buffer; // These buffers guarantee the lifespan of the data to transmit AP3UartRingBuffer _tx_buffer; // to allow for asynchronous tranfsers diff --git a/cores/arduino/ard_sup/uart/ap3_uart.cpp b/cores/arduino/ard_sup/uart/ap3_uart.cpp index 19ca226..0724371 100644 --- a/cores/arduino/ard_sup/uart/ap3_uart.cpp +++ b/cores/arduino/ard_sup/uart/ap3_uart.cpp @@ -543,19 +543,16 @@ inline void Uart::uart_isr(void) { .ui32Direction = AM_HAL_UART_READ, .pui8Data = (uint8_t *)&rx_c, - .ui32NumBytes = 1, + .ui32NumBytes = sizeof(rx_c), .ui32TimeoutMs = 0, .pui32BytesTransferred = &ui32BytesRead, }; - do + am_hal_uart_transfer(_handle, &sRead); + if (ui32BytesRead) { - am_hal_uart_transfer(_handle, &sRead); - if (ui32BytesRead) - { - _rx_buffer.store_char(rx_c); - } - } while (ui32BytesRead); + _rx_buffer.store_char(rx_c); + } } }