Not sure if this is the best place to ask... Better as issue? Better in different category...
Quick overview - trying another version of SerialX speedup that does not require any changes to FSP, and makes usage of the ring buffer that is already built into the UART class.
arduino::SafeRingBufferN<SERIAL_BUFFER_SIZE> txBuffer;
The speed of this does not feel right, for example here is a logic analyzer output, showing one write operation for a ping operation to Robotis servos:
The message is 14 bytes long. The Channel 6 data shows the time that the code is within the UART::Write(buffer, cnt) function, which with the timing markers on the right hand side is almost: 50us. Channel 7 I do a toggle when I am about to call the lower layer to start the transfer. From the point until the return from the write took a little over 4ms
So this code:
size_t UART::write(const uint8_t* c, size_t len) {
if(init_ok && (len > 0)) {
DBGDigitalWrite(A5, HIGH);
size_t cb_left = len;
while (cb_left) {
// see if we have room in the FIFO to store this character.
bool tx_active_on_entry = tx_fsi_active;
// Put as much of data into txBuffer as will fit
while(cb_left && !txBuffer.isFull()) {
txBuffer.store_char(*c++);
cb_left--;
}
// if the UART was not active at the start we will start it.
if (!tx_active_on_entry) {
size_t cb = 0;
while (cb < sizeof(tx_fsi_buffer)) {
int ch = txBuffer.read_char();
if (ch == -1) break;
tx_fsi_buffer[cb++] = ch;
}
tx_fsi_active = true;
DBGDigitalToggle(A2);
R_SCI_UART_Write(&(uart_ctrl), tx_fsi_buffer, cb);
Tooks about 45us, or about the time the UART took to output 4.5 characters at 1mbs.
Just feels like it should be faster. Not sure if it is because the Safe part, disables interrupts to do almost every operation?
Investigating. May try the unsafe version to see if it makes any differences.

