Issue with node-red-node-serialport and serial control Node: "TypeError: newline.substr is not a function" when Using Fixed Length Split Configuration

Hello,

I encountered an error with the node-red-node-serialport module while using the serial control node to open and close communication with a product. Here is my configuration and the steps I followed:

Initial Configuration

I configured the COM port as shown in the image above with the following settings:

  • Split input after a timeout of 200ms

Sequence

  1. Close COM port (close com - works correctly)
  2. Open COM port (open com - works correctly)
  3. Send serial commands using the serial request node (send serial commands - works correctly)
  4. Close COM port (close com - works correctly)
  5. Open COM port (open com - works correctly)

Problem with New Configuration

When I used the following configuration:

and repeated the same steps, I encountered an error at step 5:

  1. Close COM port (close com - works correctly)
  2. Open COM port (open com - works correctly)
  3. Send serial commands using the serial request node (send serial commands - works correctly)
  4. Close COM port (close com - works correctly)
  5. Open COM port (open com - error: "TypeError: newline.substr is not a function")

Notes

  • Return type from the product: The messages returned by the product are of the form \n\rxxxxx ok xxxx \r\n.

It seems that the "TypeError: newline.substr is not a function" error occurs when opening the COM port with the configuration set to split input into fixed lengths of 5000 characters. This likely indicates a problem with the handling of the newline variable in this configuration.

Please raise an issue against this node in the node-red-nodes project and link to here. Thanks

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.