Hi @lakshan,
I haven’t managed to look into this in detail but thought I would offer a brief update.
I thought I would try and insert a delay for every transmit that hit the uart tx buffer when it was not empty rather than in the underlysingsend function that transmits in bulk.
I’ve has some success with a 100us delay as per below; this change is in addition to removing all delays in underlyingsend.
I’ve only run it for about 48 hours but I have seen no crashes with this change yet.
size_t EUart::write(const uint8_t data)
{
if (sercom->isDataRegisterEmptyUART() && txBuffer.available() == 0)
{
sercom->writeDataUART(data);
}
else
{
delayMicroseconds(100); // slow things down if the buffer is not available
// spin lock until a spot opens up in the buffer
while (txBuffer.isFull()) ...
I’ll try and investigate further.
Cheers,
Steve