node-red / node-red/node-red-nodes
Serial-in not syncing the buffer
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.1k
- Forks
- 612
- Avg merge
- 13h 57m
- Merged PRs (30d)
- 3
Description
I am having a problem with a serial-in node. I have a 43 byte fixed-length packet that I need to receive into NR. The port is the uart on the Pi 3, ttyAMA0 (BT is disabled), at 19.2 baud. I do not have any character to use inside of the packet as the delimiter and I have no control over the machine that generates the packet, so I tried fixed-length and timeout, but both have issues. I set it up with timeout and set it to 100ms and about 5% of the packets are split in some random spot. All the data are there, just not split correctly. If I then change the node to a fixed-length config, at 43 bytes, it runs for days without fail, no missplit packets, no lost data, nothing. Perfect! Until I restart NR. After I restart NR the 43 bytes come in, but it's splitting them at the wrong byte. If I restart NR a few more times it will get to the correct byte and remain there until the next restart. Also, if I change the serial-in node back to a timeout of something like 100ms, deploy, then change it back to 43 bytes and deploy it will work perfectly every time I've tried.
So that's a long way of saying the splitting isn't working right for the fixed-length option.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the serial-in node's fixed-length configuration and reproduce the 43-byte packet behavior on the Pi 3 UART after restarting Node-RED. Compare it with the timeout-then-fixed-length deployment sequence described in the issue; done means fixed-length packets consistently split at the correct byte after restart without lost data.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, raspberry-pi
- Domain
- embedded-iot
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100