serialport / node-serialport

Access serial ports with JavaScript. Linux, OSX and Windows. Welcome your robotic JavaScript overlords. Better yet, program them!

Home Page:https://serialport.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

High %CPU load reading with 9600 baud

peter9091 opened this issue · comments

SerialPort Version

10.5.0

Node Version

v18.15.0

Electron Version

No response

Platform

Linux raspberrypi 5.15.84-v8+ #1613 SMP PREEMPT Thu Jan 5 12:03:08 GMT 2023 aarch64 GNU/Linux

Architecture

aarch64

Hardware or chipset of serialport

cp210x (CP2102N USB to UART Bridge Controller)

What steps will reproduce the bug?

send ca 600 bytes per second over serial port with 9600 baud, receiving part ist quite minimalistic:

// test.js
const { SerialPort } = require('serialport')
const ser = new SerialPort( { path: '/dev/ttyUSB0', baudRate: 9600 });
ser.on('data', function (data) { } );

start it like that: node test.js

What happens?

CPU load of this node process goes up to 16..18%

for comparison:

cat /dev/ttyUSB0 > /dev/null

causes something about 1-2%

What should have happened?

CPU load should remain as low as with cat command.

Additional information

No response