node-serialport icon indicating copy to clipboard operation
node-serialport copied to clipboard

binding.read reads only 32 bytes

Open germancmartinez opened this issue 3 years ago • 5 comments

Summary of Problem

When I try to read a large number of bytes (514 in this case) the function ends and returns only 32 bytes.

Code

...
var bytesRead;
var InBuf = Buffer.allocUnsafe(600); 
var portOptions = { baudRate: 9600, dataBits: 8, parity: "even", stopBits: 1, autoOpen: true };  
const binding = new Binding(portOptions);
await binding.open("COM3",portOptions);
...
await binding.write(Buffer.from('1006','hex'));   //OK
bytesRead = await binding.read(InBuf,0,514);  //NOT OK-->I get only 32 bytes

I'm using a Serial Port Monitor where I can see: image

Versions, Operating System and Hardware

  • SerialPort v9.1.0
  • Node.js v14.17.0
  • Operating system and version: Windows Server 2012 R2
  • Architecture: x64

germancmartinez avatar Jun 18 '21 05:06 germancmartinez