Hi Klaus_K and greg_hauck,
Brilliant sleuthing !
I came up with a very similar TEMPORARY solution in the read_char() function to disable the interrupts. But instead of NVIC_DisableIRQ( UART0_IRQn ), i used noInterrupts() / interrupts()
So far, this seems to have fixed the problem (running for 3 hours now vs 10-30 minutes before).
I understand that this is a hack and the proposed calculation will be much better.
I have quickly looked at the ATOMIC_BLOCK macro, but have not had time yet to fully investigate.
volatile may also be an option (for a buffer <256 bytes). I have done a lot of coding in C/C++ and later C# but not on Arduino and things seem a bit different here.
Cheers,
Richard