Serialport Zeros at beginning corruption

Hello, I have the following scenario:

  • android device that sends via BLE string messages to a raspberry PI using node-red
  • node-red serial port (NRSP) is configured to accept binary messages of fixed length
  • everything works well and the commands arrive properly

There is a situation in which something odd happens. This is the workflow:

  • starting from a well working situation (described above) I detach the bluetooth connection from android to the dongle
  • then I physically unplug the dongle from the PI
  • NRSP notices it and the serial port shows as not connected
  • the I attach the dongle back to the PI
  • before NRSP notices it (question of seconds) I connect android to the bluetooth dongle
  • in the meanwhile NRSP notices it and connects back
  • everything looks perfect, but if I send a message now, the message arrives to the debug payload after the NRSP with two zero bytes attached in front of the message. I.e. instead of arriving ABCDEF... as it should, 00ABCD... arrives.

We have narrowed down the problem to NRSP, debugging all the other parts to the last bit. I can add that using a plain nodejs script that prints out the serial port messages, the above doesn't happen.

We tried to check in the NRSP code to see if we could find something, but after a few tests we decided it would be better to ask for advice :slight_smile:

So two questions:

  1. might this be a known behaviour? Maybe in particular siutations? Any idea would be most welcome.
  2. any hint on where in the code we could insert some debug messages to understand what is happening? That would definitely help a lot to narrow the issue.

Thanks a lot,

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