# How to deal with Serial In Node which shows two buffers simultaneously

**URL:** https://discourse.nodered.org/t/how-to-deal-with-serial-in-node-which-shows-two-buffers-simultaneously/28127
**Category:** General
**Created:** [10 June 2020 15:50 UTC](https://discourse.nodered.org/t/how-to-deal-with-serial-in-node-which-shows-two-buffers-simultaneously/28127 "2020-06-10T15:50:01Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![Waled22](https://avatars.discourse-cdn.com/v4/letter/w/13edae/32.png) [@Waled22](https://discourse.nodered.org/u/Waled22)
#### Post date: [10 June 2020 15:50 UTC](https://discourse.nodered.org/t/how-to-deal-with-serial-in-node-which-shows-two-buffers-simultaneously/28127/1 "2020-06-10T15:50:01Z")

</div>

Hi,  
Is there any way to combine these two buffers which are coming out of a serial in node simultaneously. The device which is sending this serial data sometimes sends the whole buffer (which is desirable ) but sometimes it sends in the form of two buffers as shown in the figure. Is there any way or idea to deal with this issue and why is this happening? I appreciate your help. Thanks in advance

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

---

<div class="post-metadata">

### Author: ![ristomatti](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ristomatti/32/5857_2.png) [@ristomatti](https://discourse.nodered.org/u/ristomatti)
#### Post date: [10 June 2020 16:03 UTC](https://discourse.nodered.org/t/how-to-deal-with-serial-in-node-which-shows-two-buffers-simultaneously/28127/2 "2020-06-10T16:03:57Z")

</div>

If you happen to be in control of the sending device's code, I believe flushing the serial buffer before sending would help. Otherwise you'll need to sort it out in the receiving end (no tips to give at this time).

---

<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: [10 June 2020 16:05 UTC](https://discourse.nodered.org/t/how-to-deal-with-serial-in-node-which-shows-two-buffers-simultaneously/28127/3 "2020-06-10T16:05:12Z")

</div>

> [@Waled22](#):
>
> coming out of a serial out node

Do you mean a Serial In node? Show us how you have configured it.

---

<div class="post-metadata">

### Author: ![Waled22](https://avatars.discourse-cdn.com/v4/letter/w/13edae/32.png) [@Waled22](https://discourse.nodered.org/u/Waled22)
#### Post date: [10 June 2020 16:39 UTC](https://discourse.nodered.org/t/how-to-deal-with-serial-in-node-which-shows-two-buffers-simultaneously/28127/4 "2020-06-10T16:39:22Z")

</div>

Thanks for the correction, actually the flow comprises of only two-nodes just to check what I am getting at the receiving side.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/0/a083c2450dbc11ec88bd1e17f8ee49d1c5959975.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: [10 June 2020 16:56 UTC](https://discourse.nodered.org/t/how-to-deal-with-serial-in-node-which-shows-two-buffers-simultaneously/28127/5 "2020-06-10T16:56:21Z")

</div>

Show us how you have configured the serial node.

---

<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: [10 June 2020 17:05 UTC](https://discourse.nodered.org/t/how-to-deal-with-serial-in-node-which-shows-two-buffers-simultaneously/28127/6 "2020-06-10T17:05:53Z")

</div>

I think the default is to split (lines) on the \n (0x0A) character - so if that is meant to be part of the data and not the line end then you will need a different to decide when the line end is... - maybe a number of characters or maybe a small timeout ?

---

<div class="post-metadata">

### Author: ![Waled22](https://avatars.discourse-cdn.com/v4/letter/w/13edae/32.png) [@Waled22](https://discourse.nodered.org/u/Waled22)
#### Post date: [10 June 2020 17:15 UTC](https://discourse.nodered.org/t/how-to-deal-with-serial-in-node-which-shows-two-buffers-simultaneously/28127/7 "2020-06-10T17:15:38Z")

</div>

Please have a look at the Settings

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/7/971bd2d22d08917fc28220d2a4ff99e1ae60cdc5.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: [10 June 2020 17:48 UTC](https://discourse.nodered.org/t/how-to-deal-with-serial-in-node-which-shows-two-buffers-simultaneously/28127/8 "2020-06-10T17:48:06Z")

</div>

Did you see @dceejay's post?

---

<div class="post-metadata">

### Author: ![Waled22](https://avatars.discourse-cdn.com/v4/letter/w/13edae/32.png) [@Waled22](https://discourse.nodered.org/u/Waled22)
#### Post date: [10 June 2020 19:49 UTC](https://discourse.nodered.org/t/how-to-deal-with-serial-in-node-which-shows-two-buffers-simultaneously/28127/9 "2020-06-10T19:49:25Z")

</div>

Thank you for the reply @dceejay . Actually the buffer size is not fixed all the time, I think end of line based on number of characters would not work, what do you say?

---

<div class="post-metadata">

### Author: ![Waled22](https://avatars.discourse-cdn.com/v4/letter/w/13edae/32.png) [@Waled22](https://discourse.nodered.org/u/Waled22)
#### Post date: [10 June 2020 19:51 UTC](https://discourse.nodered.org/t/how-to-deal-with-serial-in-node-which-shows-two-buffers-simultaneously/28127/10 "2020-06-10T19:51:15Z")

</div>

Thank you @Colin for drawing my attention to @dceejay 's reply.

---

<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: [10 June 2020 20:12 UTC](https://discourse.nodered.org/t/how-to-deal-with-serial-in-node-which-shows-two-buffers-simultaneously/28127/11 "2020-06-10T20:12:09Z")

</div>

The alternative of using a timeout was also suggested. That is available in the node config. Then when data has been received and then stops it will be supplied by the node.

---

<div class="post-metadata">

### Author: ![Waled22](https://avatars.discourse-cdn.com/v4/letter/w/13edae/32.png) [@Waled22](https://discourse.nodered.org/u/Waled22)
#### Post date: [11 June 2020 00:20 UTC](https://discourse.nodered.org/t/how-to-deal-with-serial-in-node-which-shows-two-buffers-simultaneously/28127/12 "2020-06-11T00:20:24Z")

</div>

I got it, thank you @Colin. I appreciate your support 🙂.

---

<div class="post-metadata">

### Author: ![Waled22](https://avatars.discourse-cdn.com/v4/letter/w/13edae/32.png) [@Waled22](https://discourse.nodered.org/u/Waled22)
#### Post date: [11 June 2020 00:21 UTC](https://discourse.nodered.org/t/how-to-deal-with-serial-in-node-which-shows-two-buffers-simultaneously/28127/13 "2020-06-11T00:21:17Z")

</div>

Thank you @dceejay for identifying the issue and helping me out.

---

<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: [25 June 2020 00:21 UTC](https://discourse.nodered.org/t/how-to-deal-with-serial-in-node-which-shows-two-buffers-simultaneously/28127/14 "2020-06-25T00:21:18Z")

</div>

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