I further optimised the code as follows which allows the system to RX error free at 19.2 but fails badly at the next step up the baud rate to 38.4 dont know about the ones in between.
I can't see how this code is too much slower than the assumed logical AND version of the % but it's enough to make it fail so it just shows you how critical this section is during the inter byte gap.
Im wondering if something can be done around the eating up of the stop bit to buy some extra time.
... Simon
// if ((_receive_buffer_tail + 1) % _SS_MAX_RX_BUFF != _receive_buffer_head)
uint8_t calc_once = _receive_buffer_tail + 1;
if (calc_once >=_SS_MAX_RX_BUFF) calc_once = 0;
if (calc_once != _receive_buffer_head)
{
// save new data in buffer: tail points to where byte goes
_receive_buffer[_receive_buffer_tail] = d; // save new byte
// _receive_buffer_tail = (_receive_buffer_tail + 1) % _SS_MAX_RX_BUFF;
_receive_buffer_tail = calc_once;
}
else ...