Understanding serial connection via Dongle w/ Cyton

smannesmanne Stanford, CA

Hello,
I want to stream raw data from the Cyton+daisy board to a bare-metal microcontroller with UART/SPI/I2C support but no USB support. This microcontroller will preprocess and analyze the raw data. I want to better understand how I can do this.
Can I directly connect the TX/RX pins on the USB dongle to my microcontroller, and have the microcontroller read the data over UART? What are the data transfer limitations here?
Or, does the USB dongle require a USB host to speak with (Arduino Due)?
Would I need an Arduino to connect to the USB dongle that converts USB->SPI/I2C so that my bare-metal microcontroller without USB can understand it?

Please point me in the right direction as soon as possible. This is urgent. Thank you so much!

Comments

  • wjcroftwjcroft Mount Shasta, CA

    Hi SManne,

    Have you considered using a Raspberry Pi, such as models 4 or 5, which have USB host ports that the dongle can plug into? The Brainflow library is designed to interface via the dongle.

    https://brainflow.readthedocs.io/en/stable/SupportedBoards.html#cyton-daisy

    https://www.raspberrypi.com/products/raspberry-pi-4-model-b/
    https://www.raspberrypi.com/products/#raspberry-pi-computers-and-microcontrollers

    Regards,

  • smannesmanne Stanford, CA
    edited March 2

    Hi wjcroft,

    Thanks for the response. Does this mean I cannot directly communicate with the Cyton over UART, and instead have to communicate over the Brainflow library?

    At the end of the day, I want to receive raw data to my final microcontroller (that doesn't support USB but supports UART/SPI), and want to find the best way to do this, bare-metal.

    1) If I can directly communicate via UART: can I directly connect dongle TX/RX UART pins to TX/RX UART pins on my microcontroller? Please find out if the dongle supports this, since I see TX/RX pins on the schematic for it.
    2) If I have to communicate via Brainflow library, do I need a USB host device? Can I run Brainflow on a bare-metal Raspberry Pi Pico and stream raw data to my board this way? If so how?

    I know this is a detailed question, but please let me know soon how I can access the raw data on my final microcontroller.

    I see the following possibilities:
    1. Connect MCU UART pins to Cyton D11/D12. This requires cyton firmware changes.
    2. Access dongle TX/RX UART pins (solder pins to them) and connect to MCU. Not sure if this will work.
    3. Get an intermediary MCU (like Arduino with USB host capability) that can read serial stream from dongle and forward over UART to my microcontroller.
    4. Connect my dongle to a USB->UART/SPI adapter that connects to my MCU?

  • wjcroftwjcroft Mount Shasta, CA

    @smanne said:
    ...
    Thanks for the response. Does this mean I cannot directly communicate with the Cyton over UART, and instead have to communicate over the Brainflow library?

    Correct. The UART ports you see on the dongle are NOT available for external usage. They are the communications link between the RFduino and the FTDI FT231X USB to serial chip.

    https://docs.openbci.com/Cyton/CytonSpecs/
    https://docs.openbci.com/assets/images/OBCI_DONGLE-Schematic-f52d787b5741ff98b7844796da854b01.jpg
    https://cdn.sparkfun.com/datasheets/Components/General IC/DS_FT231X.pdf

    There is a similar UART port on the Cyton mainboard for communication between the PIC32 (main microcontroller) and the mainboard RFduino, which handles the wireless (Gazelle / Bluetooth / custom protocol) link with the dongle RFduino. It is not intended for any other usage.

    At the end of the day, I want to receive raw data to my final microcontroller (that doesn't support USB but supports UART/SPI), and want to find the best way to do this, bare-metal.

    1) If I can directly communicate via UART: can I directly connect dongle TX/RX UART pins to TX/RX UART pins on my microcontroller? Please find out if the dongle supports this, since I see TX/RX pins on the schematic for it.

    No. See above comments and links.

    2) If I have to communicate via Brainflow library, do I need a USB host device? Can I run Brainflow on a bare-metal Raspberry Pi Pico and stream raw data to my board this way? If so how?

    I'm not sure the smallest Pi that would work. I do know others have used the 4 in the past. It looks like the Pi Zero 2 W has a usb host port. Don't think Pico has usb host.

    https://www.raspberrypi.com/products/raspberry-pi-zero-2-w/

    I know this is a detailed question, but please let me know soon how I can access the raw data on my final microcontroller.

    The only supported Brainflow interface is via the dongle attached to a usb port.

    Regards, William

  • smannesmanne Stanford, CA
    edited March 2

    Thank you for the detailed advice! I really appreciate it William.
    I require for this project to be bare-metal, and BrainFlow requires an OS to run, so I'm trying to find a way around it. I see these possibilities:
    1. What about connecting directly to Cyton D11/D12 pins and reprogramming them to be UART communicators of data? I'm not sure how complex this would be. I can run those pins via a USB isolator to my final microcontroller.
    I see this repo that could help and am not sure if it is still applicable for updated versions of the firmware: https://github.com/WinslowStrong/OpenBCI_Wired_USB

    1. Get an intermediary MCU (like Arduino with USB host capability) that can read serial stream from dongle and forward over UART to my microcontroller.

    2. Connect my dongle to a USB->UART/SPI adapter that connects to my MCU?

  • wjcroftwjcroft Mount Shasta, CA

    @smanne said:
    Thank you for the detailed advice! I really appreciate it William.
    I require for this project to be bare-metal, and BrainFlow requires an OS to run, so I'm trying to find a way around it. I see these possibilities:

    I'm unclear if the Pi version of Brainflow library 'requires' the full running Debian / Raspian / Raspberry Pi OS. See the AI response and links below. There is a Slack channel for Brainflow questions, sign up via the Brainflow website.

    https://www.google.com/search?q=could+a+raspberry+pi+support+a+'bare+metal'+application+without+the+OS?
    https://brainflow.org/

    1. What about connecting directly to Cyton D11/D12 pins and reprogramming them to be UART communicators of data? I'm not sure how complex this would be. I can run those pins via a USB isolator to my final microcontroller.

    Sounds very complex. Unsupported by Brainflow. Full source of firmware is available however.

    I see this repo that could help and am not sure if it is still applicable for updated versions of the firmware: https://github.com/WinslowStrong/OpenBCI_Wired_USB

    This is ancient, many versions behind current firmware.

    1. Get an intermediary MCU (like Arduino with USB host capability) that can read serial stream from dongle and forward over UART to my microcontroller.

    Arduino's are very very slow, and require a usb host shield. Possible I guess...

    1. Connect my dongle to a USB->UART/SPI adapter that connects to my MCU?

    I suggest if you want to explore further, to email customer support, (contact at openbci.com). It's possible engineering staff could offer further suggestions. But the primary access via Brainflow is always thru the dongle usb port.

  • smannesmanne Stanford, CA

    Update:
    The new firmware supports very easy access to using D11/D12 pins as debugging outputs (they serially output all data). This gives a wired connection to the board for it to stream data.
    All you need to do is plug in the dongle, and send /1 serially to set the board into debug mode.

  • wjcroftwjcroft Mount Shasta, CA

    Correct. But is 'debug mode' what you are looking for? You would still need to make substantial firmware changes.

  • smannesmanne Stanford, CA

    All I want access to is the raw data via a serial communication, and I believe this is what debug mode allows for? Is this not what I am receiving? I have made no firmware changes.

  • wjcroftwjcroft Mount Shasta, CA

    I'm not clear that using that data stream is going to allow you to talk to the board via Brainflow. At a minimum, you would need to change the Brainflow 'device' code. I also believe there may be added bytes that the onboard or dongle RFduino intercept / insert into the stream.

  • smannesmanne Stanford, CA
    edited March 15

    This is what I currently do:

    • Connect the Cyton via USB dongle to my Mac and open a serial communication window on my Mac to talk with the Dongle. I send /1 to enter debug mode and confirm this via the "Success: debug mode" output in the serial.
    • Disconnect USB dongle and plug in UART connection to D11/D12 on Cyton Board on one side and my bare-metal microcontroller on the other.
    • Communicate with board via commands (when I send 'b' it begins streaming, 's' stops streaming).

    Will this work? I know the commands and workflow works. I can successfully send commands to the board with my microcontroller. The only thing I do not know is if this will stream valid raw data - in DEBUG mode. The latest firmware seems to indicate the answer is yes.

  • wjcroftwjcroft Mount Shasta, CA

    The packet format, end codes, etc., that you see in debug mode, may differ from what is documented. Because in the normal case the packets are buffered by the RFduino's and they do some massaging of the packet format.

    But another question that seems relevant: does the complexity of using both the dongle (on the laptop) to start the stream, and then the debug port to stream the data to your microcontroller - make sense in the bigger picture? Why not just use some microcontroller that supports usb?

Sign In or Register to comment.