how to record rTMS sync information with EEG on Cyton

JLGJLG
edited August 2023 in Cyton

Dear community and WJCROFT,
After looking at different posts (https://openbci.com/forum/index.php?p=/discussion/3546/read-data-to-esp32#latest) or (https://openbci.com/forum/index.php?p=/discussion/comment/19075#Comment_19075) I understand that no I2C or SPI serial connection is possible between an Arduino/Raspberry/ESP 32 board and a Cython.

However the digital port D11, D12, D13, D17, D18 could be used by a Raspberry Pi to externally trigger the Cyton from what I got from the documentation. Do you confirm? Can those ports also be used for data transfer?
The scope of our project involves precise EEG monitoring of rTMS-stimulated brains. Which means that we want to look at the brain waves some time (yet to be determined) after our stimuli.

Comments

  • wjcroftwjcroft Mount Shasta, CA

    You want to setup an opto isolated connection from the trigger source (Pi?) to Cyton. This trigger info is recorded simultaneously with the samples, in three 'Aux' values, 16 bits each.

    https://docs.openbci.com/Cyton/CytonDataFormat/#binary-format

    https://docs.openbci.com/Cyton/CytonExternal/#optoisolation

    If you are using the GUI, there are 'widgets' to turn on the 'board mode' (for the Aux info), either analog or digital.

    https://docs.openbci.com/Cyton/CytonSDK/#board-mode
    https://docs.openbci.com/Software/OpenBCISoftware/GUIWidgets/

    If you are using Brainflow library to stream directly, then you issue the SDK commands above at the start of your session.

    William

  • Thank you for the quick reply and the useful links.
    Do you know if it is also possible to use the UART protocol to stream directly the data to a Raspberry without having to use the dongle? I imagine it would be using the digital output pins that I mentionned.

  • wjcroftwjcroft Mount Shasta, CA

    Both the radio link and optoisolation I mentioned (previous comment) is for client safety to avoid any hardwired connection to other devices. The Cyton firmware does not currently have the capability to operate over serial UART. Your dongle can plug directly into the larger Pi boards with usb ports. To get the tight synchronization with Aux data next to EEG samples, you need to use the appropriate 'board mode' already implemented.

    Regards, William

  • wjcroftwjcroft Mount Shasta, CA

    I assume you know your rTMS pulses will likely induce significant voltages in the EEG electrode leads. Not sure how much voltage amplitude. Probably wise to test first with a normal oscilloscope. Because voltages over the Cyton ADC chip (ADS1299) power bus rails supply voltage could damage the ADC.

  • wjcroftwjcroft Mount Shasta, CA
    edited August 2023

    Found your cool company / project. Keep us posted. It's possible your prototype using OpenBCI could be good publicity. Add OpenBCI to your partners list(!) Mentioning @joeartuso @retiutut @Shirley.

    [website link deleted on request of JLG, I'll forward privately]

  • JLGJLG
    edited August 2023

    Thank you for the reminder and you are 100% right. We are still in development phase of the project and are still determining what can be achieved using the OpenBCI hardware in our specific application and how/if we can manage to do it.
    Will definitely come back here to keep you posted about this topic !

  • Hi again, I now think that I have less vague questions:

    1. Usually PIC32 has reprogrammable digital pins that can be used for UART serial communication. From the PIC32 datasheets, it appears that a lot of the pins can be reconfigured to be used for UART. Comparing the PIC32 datasheet and the OpenBCI schematics, it appears that D17 could be configured as U1TX and D18/D13 could be configured as U1RX. Am I missing something? Assuming we modify the firmware assigning the correct bit adresses to those pins, we should be able to make it run (Also adding optocouplers in between), right? I see a "BOOT

    2. From what I see on the schematics, do you confirm that the data is sent between the PIC and the RFduino via the RFduino pins 16 and 17 ? I struggle to see which pins from the PIC32 are used to send data to the RFduino.

    3. For some confidentiality reasons I can not explain in details why we want to use some digital pins as UART data transfer pins but assuming we use D17 and D18 for example, we could still use D11/D12 or D13 as trigger input following the tutorial you showed, right?

    Thank you very much

  • wjcroftwjcroft Mount Shasta, CA
    edited August 2023

    @JLG said:
    ...
    ... From the PIC32 datasheets, it appears that a lot of the pins can be reconfigured to be used for UART. Comparing the PIC32 datasheet and the OpenBCI schematics, it appears that D17 could be configured as U1TX and D18/D13 could be configured as U1RX. Am I missing something? Assuming we modify the firmware assigning the correct bit adresses to those pins, we should be able to make it run (Also adding optocouplers in between), right?

    It is not recommended that you do this, but you certainly can try if you want and if the PIC supports it. If you look at the source code you will see function names / variables including the strings: Serial0 and Serial1.

    https://github.com/search?q=repo:OpenBCI/OpenBCI_Cyton_Library Serial1&type=code

    Serial0 is the serial port talking to the RFduino. Serial1 is a serial port intended for debug use by developers. But possibly could aid your goals.

    1. From what I see on the schematics, do you confirm that the data is sent between the PIC and the RFduino via the RFduino pins 16 and 17 ? I struggle to see which pins from the PIC32 are used to send data to the RFduino.

    Are you saying schematic is wrong / unclear? You may want to email (contact at openbci.com) customer support.

    1. For some confidentiality reasons I can not explain in details why we want to use some digital pins as UART data transfer pins but assuming we use D17 and D18 for example, we could still use D11/D12 or D13 as trigger input following the tutorial you showed, right?

    I think the Serial1 UART is already setup, so probably not required to use other pins.

  • Dear WjCroft, thank you very much for your input. This solved the issue. I proceeded as discussed and found in the firmware the debugging mode that you described. I then used the example BoardNoAccelSDWifiDebug to play a bit around and the proceeded to my first UART communication successfully. However after a few firmware uploads (back and forth with the DefaultBoard) I was no longer able to flash any firmware to the board. I got a "No target found" message using Arduino IDE 2.1.1. I degraded the Arduino IDE version to 1.8.9 and it worked again for a few uploads before having the same issue.

    Do you have any idea of what could have caused that?
    Kind regards

  • wjcroftwjcroft Mount Shasta, CA

    Please email (contact at openbci.com) which is customer support. They may know why your Cyton is no longer uploading.

    Have you tried with another computer or setup? There are programming instructions for several OSes. You may be having an issue with your usb serial port name or related. Such that the IDE is no longer seeing it. Do you know how to use the utilities on your OS to scan for COM port /dev names?

  • I thought about the same as the full error message was:
    \.\ COM 4 Cannot Open
    No target found
    So I thought about the port already being used or renamed so I rebooted the computer and nothing changed. I don't know yet how to OS scan my COM port but I can find it easily online.

  • wjcroftwjcroft Mount Shasta, CA

    Enter "Device Manager" in your Windows search box. Open the app / control panel, then expand the COM section.

  • JLGJLG
    edited August 2023

    No I checked this part, the port COM 4 was still there unchanged. The baud rate was 9600 which is the correct baud rate for the upload of the firmware, right?

  • wjcroftwjcroft Mount Shasta, CA

    No 9600 is not what is used during the upload. It might be the default rate, the programming instructions should cover COM port info. The IDE may set it once opened. Please try the procedure on another laptop.

  • Ok thank you, will try it on another setup.
    Kind regards

  • Hi again, I contacted the support last friday and I am waiting for their answer but in the meantime, I wanted to know if you had any idea why this uploading issue happened.
    I tried with a new computer, it worked 3 times then same issue with the correct COM port not being open and a target not found for the Arduino upload. However this time I restarted this new computer and it worked once. This looks weird, do you have an idea?
    Regards

Sign In or Register to comment.