Split input on character is not working with a serial port

Hi Guys,
I´m working on parsing bytes from the Zigbee radio (NXP JN5168) connected directly on the Rpi3 serial port and I have some problem with split input using the SERIAL NODE configured as /dev/ttyAMA0, at some moments the split node doesn't make the message separation according to ETX character (0x03). Would you can see attached three messages whitout separation bellow:

![messages%20without%20separation|298x500

Notes:
When the same radio is connected through the USB-TTL Module, like CP2102, everything works very well.
I have make several serial node configuration possibilities, like without Optionally wait for a start character and timer values, but nothing worked.

Can someone help me?

BR
Alex

I could never sus out the right thing to put in for ETX. what I did in the end is to send the serial output at string to debug then copy the squiggle character from debug into the separator field.

Can you check which version of serialport you are running ?
I'm trying it here using a GPS receiver set as


Which are the letters R and *
and I get

Sorry Steve I did not understand what you said!

BR,
Alex

It is unlikely that anyone in the forum will have the same hardware configuration available for testing.

Why not use a split node after the serial node to do the job ?

The configuration of the split node would be like below:

split

Hi deeejay,
I´m using this serialport at node-red:

image

Hi Andrei thanks for you suggestion!
I´ll change my flow to include split node as you adivise me!

Best Regards,
Alex

Hi Andrei,
I tried to use split node and I observed that something changed, but I need to send out the original message to other nodes and I observed that split node originally does not do it.
In my example, all those messages come from serial node I can observe one time at IN NATURA Debug message but I can see the message pass through the split node.

I have include msg.playlod at copy key but nothing has to happen!
Please, would you help me?
One time message only:


Came from serial node w/ three grouped messages:

Hi Alex,

Please try this flow and tell me if it works for you.

[{"id":"cffac5fa.b13d18","type":"inject","z":"1908477f.742ac9","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":180,"wires":[["99364d4.93ff8b"]]},{"id":"99364d4.93ff8b","type":"function","z":"1908477f.742ac9","name":"Dataset Buffer","func":"msg.payload =  Buffer.from([0x01, 0x80, 0x02, 0x10, 0x02, 0x10, 0x02, 0x15, 0x95, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x10, 0x02, 0x10, 0x03,0x01, 0x80, 0x02, 0x10, 0x02, 0x10, 0x02, 0x15, 0x95, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x10, 0x02, 0x10, 0x03]);\nreturn msg;","outputs":1,"noerr":0,"x":380,"y":180,"wires":[["f5b3e62f.facde8"]]},{"id":"f5b3e62f.facde8","type":"split","z":"1908477f.742ac9","name":"","splt":"[3]","spltType":"bin","arraySplt":1,"arraySpltType":"len","stream":true,"addname":"","x":560,"y":180,"wires":[["76703a84.83c294"]]},{"id":"76703a84.83c294","type":"debug","z":"1908477f.742ac9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":720,"y":180,"wires":[]}]

The serial node is giving you a buffer inside msg.payload The split node should have no issues to split the buffer on the ETX character. I can see that you tried to configure the split node with the value 3. You shoudl use instead [3] (an array).

Hi Andrei thanks a lot! I got sucess to split after you shared yours w/ me!
I have a last thing, I observed that the 0x03 was taken from the new buffer, is possible to preserve 0x03 byte or I need to regenate it in a new fuction?

image

I am happy it works.
Indeed the split will remove the ETX character. If you need it in the buffer you will need to add it somewhere downstream in the flow.

I'm still not sure why the serialport node isn't working directly - it should do...

1 Like

Thanks a lot Andrei!
Best Regards,
Alex

Hi Dceejay!

I agree with w/ you. I didn't t understanding why the serial node was not working. But I understood after that did some tests and when Andrei helps me to understand that split node working well.
My serial node had 2 serial port definitions, 1st one defined to serial IN and 2st serial OUT.
Although the setting was correct for each direction in some case split function inside the serial node did no work. After I deleted one port configuration and use a unique for both directions the split node started to work.

Best Regards,
Alex