Skip to content
Open
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
33 changes: 22 additions & 11 deletions src/main/drivers/serial_uart.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,35 @@
// Since serial ports can be used for any function these buffer sizes should be equal
// The two largest things that need to be sent are: 1, MSP responses, 2, UBLOX SVINFO packet.

// Size must be a power of two due to various optimizations which use 'and' instead of 'mod'
// Various serial routines return the buffer occupied size as uint8_t which would need to be extended in order to
// increase size further.
#define UART1_RX_BUFFER_SIZE 256
// Size must be a power of two due to various optimizations which use 'and' instead of 'mod'.
// Occupied and free sizes are returned as uint32_t, so a buffer may exceed 256 bytes.

// At 230400 a GPS delivers up to 460 bytes between two runs of the task that drains its
// port, and whatever does not fit is lost: a u-blox MON-VER reply alone is 258 bytes. The
// F7 and H7 have the RAM to spare, a few KB against 96 KB free on the smallest F7 target
// and 363 KB on the smallest H7 one. The F405 targets have 13 KB left and the AT32F435
// ones between 1 and 3 KB, so those keep their 256
#if defined(STM32H7) || defined(STM32F7)
#define UART_RX_BUFFER_SIZE_DEFAULT 1024
#else
#define UART_RX_BUFFER_SIZE_DEFAULT 256
#endif

#define UART1_RX_BUFFER_SIZE UART_RX_BUFFER_SIZE_DEFAULT
#define UART1_TX_BUFFER_SIZE 256
#define UART2_RX_BUFFER_SIZE 256
#define UART2_RX_BUFFER_SIZE UART_RX_BUFFER_SIZE_DEFAULT
#define UART2_TX_BUFFER_SIZE 256
#define UART3_RX_BUFFER_SIZE 256
#define UART3_RX_BUFFER_SIZE UART_RX_BUFFER_SIZE_DEFAULT
#define UART3_TX_BUFFER_SIZE 256
#define UART4_RX_BUFFER_SIZE 256
#define UART4_RX_BUFFER_SIZE UART_RX_BUFFER_SIZE_DEFAULT
#define UART4_TX_BUFFER_SIZE 256
#define UART5_RX_BUFFER_SIZE 256
#define UART5_RX_BUFFER_SIZE UART_RX_BUFFER_SIZE_DEFAULT
#define UART5_TX_BUFFER_SIZE 256
#define UART6_RX_BUFFER_SIZE 256
#define UART6_RX_BUFFER_SIZE UART_RX_BUFFER_SIZE_DEFAULT
#define UART6_TX_BUFFER_SIZE 256
#define UART7_RX_BUFFER_SIZE 256
#define UART7_RX_BUFFER_SIZE UART_RX_BUFFER_SIZE_DEFAULT
#define UART7_TX_BUFFER_SIZE 256
#define UART8_RX_BUFFER_SIZE 256
#define UART8_RX_BUFFER_SIZE UART_RX_BUFFER_SIZE_DEFAULT
#define UART8_TX_BUFFER_SIZE 256

typedef enum {
Expand Down
Loading