Issue with serial port node


Hi everyone!
I’m new with node red, and I need your help, please.

I have connected two devices in serial port mode to node-red, using the serial in node. Both were working perfectly, until 1 day ago one of them (a bar code reader) has stopped writing on the tag (the nodes write in dasboards text inputs).

I have tried reading the device in other reader (RealTerm program) and it displays the port is already open. Then, I reset my PC and tried RealTerm again, and the device writes perfectly in this program, so I have switched again to node-red, but the device still writes anything. In this moment I want to try again in RealTerm and it displays the port is open...

What's happening with the port? Thanks is advance :smiley:



It also close and open the ports all the time..




For the port behaviour that is exactly what you would expect as only one application can open the port at a time.
Have you put a debug node directly on the serial node to see if it is receiving anything at all?
Have you got two serial nodes on two different ports?
What operating system are you using? Also post the startup log from the "Welcome to node red" message, which will show us which versions of node red and node.js you are using, along with any problems on startup.
[Edit] I didn't mean the opening and closing is exactly what you should expect, I meant the fact that you can only open it with node red or the serial monitor, not both at once



Yes, I know only one application can open the port at a time, so I have closed Node-Red before open RealTerm.
I put a debug in the output of the serial and it does not receive anything and, yes, my serial nodes have different serial ports, COM15 and COM16 (see above in the image).

My OS is Windows 7 Professional.

Also, the node shows connected but the debugger doesn't receive.



I meant the whole of the startup log please. Copy it from the terminal and paste it here. Put a line with three backtick characters before it and another after it to stop the forum reformatting it.
Also show us how you have got the two serial node configured.
Why did the baud rate on one of them change from 57600 to 9600?
Also what changed between it working and not working?



I cannot copy the startup log...

This is the serial config of the port that is giving problems:

And this is the other, working perfectly:

I have the device off for a couple of days, and when reconnecting, it never works again, so I tried to change the baud rate in all the options in case the device was deconfigured, but as it doesn't solve the problem, I turned it on 57600 again.



Is it the port that is not working or the device? Swap them over and see what happens.
Also change the Split setting to split after a number of characters and see if it is receiving anything at all.

I found this by googling (I don't use Windows). It might help.

1 Like


Hi Colin!
I solved the problem! I changed the split input (as you said) but not to "after a number of characters", I selected "after a timeout of", so the serial writes the info that it had after the time you set.

Post a picture of the solution for if someone have the same problem :smiley:
So many thanks Colin!



So does that mean the data arriving does not have newlines in it? If not then how did it work previously?



No, the code hasn't new lines, so I think that's the reason why it didn't work.
Sincerely, I don't know how I made it work before...