Wrong end bytes warning and strange signals

edited July 3 in Software

I have the following code for getting data from OpenBCI Cyton board.

params = BrainFlowInputParams()
params.serial_port = '/dev/rfcomm0'
BOARD = BoardShim(BOARD_ID, params)
data = BOARD.get_board_data() 
if data.shape[1] > 0:
    for channel in range(0, MAX_NB_CHANNELS):
        # filtering
        freq = 50.0
        DataFilter.perform_bandstop(data[channel + 1], BoardShim.get_sampling_rate(BOARD_ID), freq, 4.0, 2,
        FilterTypes.BUTTERWORTH.value, 0.0)
        start_freq = 5.0
        stop_freq = 50.0
        center_freq = (start_freq + stop_freq) / 2.0
        band_width = stop_freq - start_freq
        DataFilter.perform_bandpass(data[channel + 1], BoardShim.get_sampling_rate(BOARD_ID), center_freq, band_width, 2, FilterTypes.BUTTERWORTH.value, 0.0)

But i have 2 problems:
1) In console I see warnings about wrong bytes:

[2021-07-04 01:03:56.309] [brainflow_logger] [info] incomming json: {
"ip_address": "",
"ip_port": 0,
"ip_protocol": 0,
"mac_address": "",
"other_info": "",
"serial_number": "",
"serial_port": "/dev/rfcomm0",
"timeout": 0
[2021-07-04 01:03:56.309] [brainflow_logger] [info] openning port /dev/rfcomm0
[2021-07-04 01:04:06.522] [brainflow_logger] [warning] Wrong end byte 128
[2021-07-04 01:04:08.940] [brainflow_logger] [warning] Wrong end byte 0
[2021-07-04 01:04:11.370] [brainflow_logger] [warning] Wrong end byte 0
[2021-07-04 01:04:14.677] [brainflow_logger] [warning] Wrong end byte 1
[2021-07-04 01:04:17.105] [brainflow_logger] [warning] Wrong end byte 0
[2021-07-04 01:04:22.000] [brainflow_logger] [warning] Wrong end byte 136
[2021-07-04 01:04:24.429] [brainflow_logger] [warning] Wrong end byte 0
[2021-07-04 01:04:41.382] [brainflow_logger] [warning] Wrong end byte 0
[2021-07-04 01:04:42.580] [brainflow_logger] [warning] Wrong end byte 2
[2021-07-04 01:04:43.791] [brainflow_logger] [warning] Wrong end byte 3

2) My signals before and after filtration look like the same. But I've copy/pasted code form OpenBCI GUI and expected another result :) In OpenBCI GUI signal is perfect.

So the questions:
What does mean wrong byte? How to solve it?
What may be wrong with filtration?


  • wjcroftwjcroft Mount Shasta, CA

    Hello Stan,

    Look at this related Raspberry thread:


    Is there some reason you are using /dev/rfcomm0 instead of the more typical /dev/ttyUSB0 or 1 ? It's possible that the rfcomm version of the driver, is not fully compliant with tty port emulation.

    Let us know if changing the port name solves your issue.

    Regards, William

  • wjcroftwjcroft Mount Shasta, CA

    Also mention what OS and version you are using.

  • edited July 4

    Hello @wjcroft!
    Thank you for your answer and support. I'm using Debian GNU/Linux 11 (bullseye).
    Changing ports was not solved problem.
    As I've mentioned in first post, in the Official OpenBCI GUI all is okay with signals, even with /dev/rfcomm0. But in Python when I'm using brainflow library (the same library and settings as in OpenBCI GUI in Java/Processing) I'm bumping into problems with wrong byte warnings. Maybe it lead to incorrect signals and therefore filtering have no sense. Because after filtering I see bad signals too.

    I guess I'm not correctly using brainflow library and it leads to problems.
    @wjcroft, could I ask you or anyone else to take a look on my Python code from first post? Maybe I made some rude mistakes.

  • wjcroftwjcroft Mount Shasta, CA

    Suggest you post your question on the Brainflow Slack, see signup link here,


Sign In or Register to comment.