# Serial port loopback test RPI

**URL:** <https://discourse.nodered.org/t/serial-port-loopback-test-rpi/72284>\
**Category:** General\
**Created:** [15 December 2022 20:13 UTC](https://discourse.nodered.org/t/serial-port-loopback-test-rpi/72284 "2022-12-15T20:13:29Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [18 December 2022 11:21 UTC](https://discourse.nodered.org/t/serial-port-loopback-test-rpi/72284/21 "2022-12-18T11:21:12Z")

</div>

Working fine for me with a USB serial port - connected pins 2 back to 3

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/b/abfda17d0ad372b8ed161c436d79b9cb3e2ff4c7.png)

```auto
[{"id":"48a1c28c5fef5eb9","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"22e6235412064bfa","type":"inject","z":"48a1c28c5fef5eb9","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"\"Hello\\n\"","payloadType":"json","x":700,"y":100,"wires":[["9b63980c3b7f3035"]]},{"id":"5ec65b405d70b76a","type":"debug","z":"48a1c28c5fef5eb9","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":880,"y":180,"wires":[]},{"id":"9b63980c3b7f3035","type":"serial out","z":"48a1c28c5fef5eb9","name":"","serial":"3f6ec4e6b79b4e9a","x":920,"y":100,"wires":[]},{"id":"a13daad047a079fd","type":"serial in","z":"48a1c28c5fef5eb9","name":"","serial":"3f6ec4e6b79b4e9a","x":690,"y":180,"wires":[["5ec65b405d70b76a"]]},{"id":"3f6ec4e6b79b4e9a","type":"serial-port","serialport":"/dev/ttyUSB0","serialbaud":"57600","databits":"8","parity":"none","stopbits":"1","waitfor":"","dtr":"none","rts":"none","cts":"none","dsr":"none","newline":"\\n","bin":"false","out":"char","addchar":"","responsetimeout":"10000"}]

```

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [18 December 2022 11:59 UTC](https://discourse.nodered.org/t/serial-port-loopback-test-rpi/72284/22 "2022-12-18T11:59:17Z")

</div>

Just as a check, could you set it to split on a Timeout of 100ms and remove the \n from the inject node? You are then doing exactly the same as the OP I think.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [18 December 2022 12:36 UTC](https://discourse.nodered.org/t/serial-port-loopback-test-rpi/72284/23 "2022-12-18T12:36:25Z")

</div>

yes - all good.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [18 December 2022 13:59 UTC](https://discourse.nodered.org/t/serial-port-loopback-test-rpi/72284/24 "2022-12-18T13:59:28Z")

</div>

Ok, thanks. I wonder why it didn't work for @devifast. The world is full of unsolved mysteries.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [18 December 2022 14:58 UTC](https://discourse.nodered.org/t/serial-port-loopback-test-rpi/72284/25 "2022-12-18T14:58:06Z")

</div>

Pi AMA port can sometimes need enabling, but yeah. No real idea why.

---

<div class="post-metadata">

**Author:** ![devifast](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@devifast](https://discourse.nodered.org/u/devifast)\
**Post date:** [19 December 2022 07:01 UTC](https://discourse.nodered.org/t/serial-port-loopback-test-rpi/72284/26 "2022-12-19T07:01:39Z")

</div>

@dceejay it uses a usb port while i use the board pins directly.

---

<div class="post-metadata">

**Author:** ![devifast](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@devifast](https://discourse.nodered.org/u/devifast)\
**Post date:** [19 December 2022 07:10 UTC](https://discourse.nodered.org/t/serial-port-loopback-test-rpi/72284/27 "2022-12-19T07:10:45Z")

</div>

In Raspbian, bluetooth must be disabled because it is connected to ttyAMA0 in order to use the pins.[https://di-marco.net/blog/it/2020-06-06-raspberry\_pi\_3\_4\_and\_0\_w\_serial\_port\_usage/](https://di-marco.net/blog/it/2020-06-06-raspberry_pi_3_4_and_0_w_serial_port_usage/)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 December 2022 09:17 UTC](https://discourse.nodered.org/t/serial-port-loopback-test-rpi/72284/28 "2022-12-19T09:17:48Z")

</div>

It can't be anything like that because it started working as soon as you replaced the In and Out nodes with a Request node, without making any other changes.

---

<div class="post-metadata">

**Author:** ![devifast](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@devifast](https://discourse.nodered.org/u/devifast)\
**Post date:** [19 December 2022 10:50 UTC](https://discourse.nodered.org/t/serial-port-loopback-test-rpi/72284/29 "2022-12-19T10:50:07Z")

</div>

What exactly can't be similar? For bluetooth or for ttyUSB0?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 December 2022 11:34 UTC](https://discourse.nodered.org/t/serial-port-loopback-test-rpi/72284/30 "2022-12-19T11:34:28Z")

</div>

I meant that your problem was not caused by bluetooth setup or whether the serial port is properly enabled, or anything like that, as it worked as soon as you changed to using a Request node.

---

<div class="post-metadata">

**Author:** ![devifast](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@devifast](https://discourse.nodered.org/u/devifast)\
**Post date:** [19 December 2022 13:47 UTC](https://discourse.nodered.org/t/serial-port-loopback-test-rpi/72284/31 "2022-12-19T13:47:42Z")

</div>

![2_rpi_serial](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/e/3e4cba3e998b9a5b88aed4263a1b3c6b33f04869.jpeg)  
I tried the serial communication between two devices as mentioned above in the post. The conclusion is the following. Bluetooth should be disabled in the /boot/config.txt file like this.

```auto
# Disable Bluetooth
dtoverlay=disable-bt

```

I added this to the end of the file otherwise it gives the following result.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/4/84c5c5c07cb09cceb3e5a61c29325e4955c59d68.png)  
When Bluetooth is disabled and when the port settings are as shown.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/8/b886fe11691a912aee358838e3971cc2abd23990.png)  
The result is the following.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/a/6a2a4da4c9efa189653390110298d953ed750da5.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 December 2022 13:52 UTC](https://discourse.nodered.org/t/serial-port-loopback-test-rpi/72284/32 "2022-12-19T13:52:26Z")

</div>

Can you explain what the screenshot indicates please? It is not clear exactly what it shows.

---

<div class="post-metadata">

**Author:** ![devifast](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@devifast](https://discourse.nodered.org/u/devifast)\
**Post date:** [19 December 2022 13:58 UTC](https://discourse.nodered.org/t/serial-port-loopback-test-rpi/72284/33 "2022-12-19T13:58:13Z")

</div>

These are the two RPIs connected to RX, TX, and GND. The pictures show the two different IP addresses of the boards. one transmits temperature values ​​to the other. This is clearly visible in the debug column.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 December 2022 14:19 UTC](https://discourse.nodered.org/t/serial-port-loopback-test-rpi/72284/34 "2022-12-19T14:19:45Z")

</div>

So separate In and Out nodes work ok. Can you re-confirm that if you loopback on those devices, instead of coupling across between them, that it does not work?

---

<div class="post-metadata">

**Author:** ![devifast](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@devifast](https://discourse.nodered.org/u/devifast)\
**Post date:** [19 December 2022 14:22 UTC](https://discourse.nodered.org/t/serial-port-loopback-test-rpi/72284/35 "2022-12-19T14:22:20Z")

</div>

I don't understand the question correctly, could you elaborate a bit more please?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [19 December 2022 14:30 UTC](https://discourse.nodered.org/t/serial-port-loopback-test-rpi/72284/36 "2022-12-19T14:30:53Z")

</div>

The problem you had at the start of this thread was that if you tested the serial port, using a Serial In node and a Serial Out node, and connecting Rx to Tx on the Pi (loopback mode) then it did not work. Later you found that it did work if you used a Serial Request node instead of In and Out nodes.

You have now tested with two Pi computers, with Serial In and Out on each Pi and the wires connected between them.

My suggestion was that you try again by connecting Rx to Tx on each device separately to confirm that it still does not work.

---

<div class="post-metadata">

**Author:** ![devifast](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@devifast](https://discourse.nodered.org/u/devifast)\
**Post date:** [20 December 2022 08:24 UTC](https://discourse.nodered.org/t/serial-port-loopback-test-rpi/72284/37 "2022-12-20T08:24:01Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/3/53ca0a968b6e34ec341bf93b3cfa2b3d38451d01.png)

 ![serial_short](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/5/755fb0b31a0434371e1137f2015374a6d25a6d71.jpeg)

I can confirm that it works as I originally expected. Thanks a lot for the support.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [20 December 2022 08:35 UTC](https://discourse.nodered.org/t/serial-port-loopback-test-rpi/72284/38 "2022-12-20T08:35:37Z")

</div>

I don't understand what has changed so that now it works.

---

<div class="post-metadata">

**Author:** ![devifast](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@devifast](https://discourse.nodered.org/u/devifast)\
**Post date:** [20 December 2022 08:37 UTC](https://discourse.nodered.org/t/serial-port-loopback-test-rpi/72284/39 "2022-12-20T08:37:10Z")

</div>

I'm puzzled too. I often do installations so we will know where the problem is.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [3 January 2023 08:37 UTC](https://discourse.nodered.org/t/serial-port-loopback-test-rpi/72284/40 "2023-01-03T08:37:22Z")

</div>

Closed on 3 January 2023 08:37 UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

[Previous page](https://discourse.nodered.org/t/serial-port-loopback-test-rpi/72284.md?page=1)
