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
- Close COM port (
close com- works correctly) - Open COM port (
open com- works correctly) - Send serial commands using the
serial requestnode (send serial commands- works correctly) - Close COM port (
close com- works correctly) - Open COM port (
open com- works correctly)
Problem with New Configuration
When I used the following configuration:
- Split input into fixed lengths of 30000 chars
and repeated the same steps, I encountered an error at step 5:
- Close COM port (
close com- works correctly) - Open COM port (
open com- works correctly) - Send serial commands using the
serial requestnode (send serial commands- works correctly) - Close COM port (
close com- works correctly) - 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.

