hi, I'm currently working on a project where i need to send data over the serial port. data are in hexadecimal form so, i did put them in a buffer following this code before sending them.
var data = [0x7E,0xA0,0x07,0x03,0x21,0x93,0x0F,0x01,0x7E];
var buffer= Buffer.from(data)
msg.payload = buffer;
the issue is when i send this value, my device doesn't reply like it didn't get the correct form of the payload, can somebody nudge me in the right path, thanks in advance.
It should work. I did it the same way and it works nicely.
Are you 100% sure the message is correct?
Other things to check: port settings (baud rate, parity, data bits, stop bits)
Write rights? Is your Node-Red user in the user group Dialout?
yes, when i send the payload to the serial port, following all parameters as given, the device doesn't reply as it should.
i had checked the communication with the port by passing in a handshake frame (main characters was in ascii) and the device reply.
this made me think that the data sent aren't in hex type.
Do you need something like an “enter” character at the end ?
what do you mean like " enter"? i have manually configure my serial node to add every time CRLF to each frame out . do you mean that?
What is the protocol? Is it a well known protocol? Is there a manual?
What is the handshake frame data made up of - show us how you did that.
the protocol is IEC 62056-21. the handshake frame is
[0x2f, 0x3f, 0x21, 0x0D, 0x0A]
the aim of this feed to get your guidance on how to know if my device is replying after sending a frame of hex value.
Are you using a Serial Request node? If so then any received data should be passed on in a message.
By enter I do mean adding \n or \r or whatever is necessary. I see it actually needs 0x0d 0x0a which is both so you may need to add them manually rather than letting the node just add one.
actually, i'm working with the serial in and out node to get a better view of the stream
okay got it, at the beginning i was adding them manually but i figure it out they give the same outcome as they were added in the node.
and following some software doing the same stuff that i want to do, they don't add 0D0A after the handshake
Presumably you are not seeing anything on a debug node connected to the serial in node, or you would have said.
Select the serial In and Out nodes, Export them and paste it here so we can see how you have configured them.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.