Skip to content

Increase performance of UART RX. #139

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cores/arduino/ard_sup/ap3_uart.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<AP3_UART_RINGBUFF_SIZE> AP3UartRingBuffer;
Expand Down Expand Up @@ -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

Expand Down
13 changes: 5 additions & 8 deletions cores/arduino/ard_sup/uart/ap3_uart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

Expand Down