Page 2 of 2

Re: UART is dropping bytes :(

Posted: Sun Jun 22, 2014 6:26 pm
by russian
In dbg_check_enter_isr we have two comparisons, OR and increment. Because it is OR (and not AND), it looks like the comparisons do not have to be inside the critical section - cannot the critical section be reduced to just the increment?

On the other hand there is probably not much sense in that since I've tried the lock-free safe_increment/safe_decrement and it did not change the benchmark at all. I guess port_lock_from_isr & port_unlock_from_isr are pretty cheap operations.

I am still trying to figure out which operations are expensive and which ones are cheap.

Re: UART is dropping bytes :(

Posted: Sun Jun 22, 2014 6:32 pm
by Giovanni
Usually. reducing critical sections is not really important in a RT system unless you reduce the longest one in the system. In a RT system you always need to consider the worst case.

Of course reducing critical sections in general is still a good idea in order to have a more benign overall jitter, you gain a better distribution in the system "jitter spectrum" (average jitter closer to the best case).

Not sure if it is clear what I am trying to explain.

Giovanni

Re: UART is dropping bytes :(

Posted: Sun Jun 22, 2014 6:58 pm
by russian
Giovanni wrote:Not sure if it is clear what I am trying to explain.

You might be saying that Premature optimization is the root of all evil