ttyTHS2 occasionally freezes system

Hi,

I have a motor control board connected to ttyTHS2 on my TX2 and occasionally when sending data the entire TX2 freeze and I have to cut the power. The data is sent as the motor reacts and I only send 16bytes.
It appears that it works ‘forever’ until next boot if it doesn’t freeze the first time.

How do I even begin finding the cause of this? What Linux tools can help. I have not worked with serial ports for a decade or more and it is the first time I use one in a program on Linux.

I set the port to 9600 baud, 8 bits 1 stopbit and parity check.

Yes I have removed the camera module.

Many thanks

I would suspect inductive noise (EMI/spikes) from the motor, rather than the serial port.

Remove or isolate one part of the equation, and see if the problem still happens. Repeat.

I assume you’re using a motor controller, as well as a motor?
What if you disconnect the motor but still keep the controller connected, does it lock up?
What if you disconnect the receiver of the UART, but keep writing to the UART, does it lock up? (Could be ground loops/currents.)
What if you have everything connected, but don’t write to the serial port?
… and so forth.

Hi Snarky,

It seems that you are correct about EMI, I have now never been able to reproduce this with the motor disconnected from the motor controller. I will accept your answer later when I’m 100% sure it is correct.

I can confirm that snarky was correct, this was EMI/spikes problem