I'm using the node-red-node-serialport to send / receive using a CC2530 and CC2531 TI serial device. The device sends bytes with the following frame format:
Byte 1 - SOF (0xFE)
Byte 2 - Length of message
Byte 3 - Command 0 (What type of message it is)
Byte 4 - Command 1 (message type)
Bytes 5->n - Data (n = number of Data bytes)
End Byte - XOR
I have set the serial node to "Optionally wait for a start character" of 0xFE and split after a silence of 0.5ms. This generally works OK but sometimes the serial receives more bytes than the message length because bytes can be received at different speeds.
I have had best success with using an end marker. The only issue with using a byte as the end marker is there is always a chance the message could contain the end marker byte.
Ideally I would like to use the second byte which contains the length of the message. Basically the second byte + 3 = the total length of the message.
I see in the node notes that if I use split input into fixed lengths I get the Tip: "In count mode msg.count can override the configured count as long as it smaller than the configured value."
I'm not sure if I can somehow use the second receive byte (length byte + 3) to tell the serial node to split the message using the message length. It would be a good feature to improve the quality of serial node using a length byte.