3

I have some trouble with my USART interface. I short-circuited the RX and TX pins and tried to test sending stuff via the cli using these commands:

sudo stty 200 -F /dev/ttyAMA0
cat /dev/ttyAMA0    

In another terminal I tried this:

echo shibby >> /dev/ttyAMA0

But what I received is somewhat awkward. I looks like this:

shibby

shibby



shibby







shibby

The spaces keep getting bigger and it goes on forever... My first guess was that the direct connection was somehow unreliable but I get the very same result for all baudrates (I went down to 75) which looks like a software problem to me.

I disabled the cli for the serial interface in cmdline.txt and inittab. Maybe this could be related?

1 Answer 1

0

You created a loop by connecting the RX and TX pins. Like you said this will continue for ever. If you disable the 'echo' on the port (that data send will not be echoed at the receiving end). This loop effect should not happen.

According to the man page of stty, you can disable the echo-ing of data by using the -echo parameter. The second parameter also disables the CR -> CRLF conversion. (That is why the newlines keep on growing)

stty -F /dev/ttyAMA0 -echo -onlcr

The Linux Serial HOWTO, Paragraph 11.8 has this to say about this:

Another test is to jumper the transmit and receive pins (pins 2 and 3 of either the 25-pin or 9-pin connector) of a test serial port. Then send something to each port (from the PCs keyboard) and see if it gets sent back. If it does it's likely the port with the jumper on it. Then remove the jumper and verify that nothing gets sent back. Note that if "echo" is set (per stty) then a jumper creates an infinite loop. Bytes that pass thru the jumper go into the port and come right back out of the other pin back to the jumper. Then they go back in and out again and again. Whatever you send to the port repeats itself forever (until you interrupt it by removing the jumper, etc.). This may be a good way to test it as the repeating test messages halt when the jumper is removed.

The pin numbers in the text do not correspond with the ones on the RPi, obviously, but the working in general is the same. The jumper they talk about in the text does the same as you did, connect the RX to the TX.

So this is not a problem, just a side effect of using echo while connecting input to output. If you would like a step-by-step explanation why this happens read the answer on this page from our sister site Unix & Linux.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.