STM32F103CT change the length of RXBUFFER of Seiral1
Posted: Wed Apr 09, 2025 12:49 pm
I am using Arduino IDE to program the STM32F103C8T6. It works. But I can not change the Rx and Tx Buffer size for Seiral1. I know the HardwareSerial.h have the following #defines as:
// NOTE: a "power of 2" buffer size is recommended to dramatically
// optimize all the modulo operations for ring buffers.
#if !defined(SERIAL_TX_BUFFER_SIZE)
#define SERIAL_TX_BUFFER_SIZE 64
#endif
#if !defined(SERIAL_RX_BUFFER_SIZE)
#define SERIAL_RX_BUFFER_SIZE 64
#endif
#if (SERIAL_TX_BUFFER_SIZE>256)
typedef uint16_t tx_buffer_index_t;
#else
typedef uint8_t tx_buffer_index_t;
#endif
#if (SERIAL_RX_BUFFER_SIZE>256)
typedef uint16_t rx_buffer_index_t;
#else
typedef uint8_t rx_buffer_index_t;
#endif
In the program, I using #define to define the Rx_Buffer and Tx_buffer as 256. But when I send the string longs than 64, the content exceed 64 lost.
I am appreciated if somebody could give me advise.
Best regards
Xiaofeng Cai
// NOTE: a "power of 2" buffer size is recommended to dramatically
// optimize all the modulo operations for ring buffers.
#if !defined(SERIAL_TX_BUFFER_SIZE)
#define SERIAL_TX_BUFFER_SIZE 64
#endif
#if !defined(SERIAL_RX_BUFFER_SIZE)
#define SERIAL_RX_BUFFER_SIZE 64
#endif
#if (SERIAL_TX_BUFFER_SIZE>256)
typedef uint16_t tx_buffer_index_t;
#else
typedef uint8_t tx_buffer_index_t;
#endif
#if (SERIAL_RX_BUFFER_SIZE>256)
typedef uint16_t rx_buffer_index_t;
#else
typedef uint8_t rx_buffer_index_t;
#endif
In the program, I using #define to define the Rx_Buffer and Tx_buffer as 256. But when I send the string longs than 64, the content exceed 64 lost.
I am appreciated if somebody could give me advise.
Best regards
Xiaofeng Cai