Lattepanda Alpha UART freezes sometimes

Hello,
I have a Lattepanda Alpha 864s with Ubuntu 22.04 installed.
I programmed the Arduino Leonardo on the board to pass the bytes through between the two UART interfaces (Serial and Serial1). I can see the data from the physical TX and RX pins when I send data over /dev/ttyACM0.
However, when I run a driver software (sends data at 25 Hz) the port freezes after about 30 seconds. The write routine blocks the software and after a while it continues the send/receive operation.
I suspect that the problem is the bootloader of the Leonardo. Also, I tried to change the buffer sizes on the Arduino side, it didn't work.
What can be the solution?
Thank you.
Best regards,
Mert