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?
Etcetera.
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.
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.
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.
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