Guidance in Upgrading Cyton + Daisy from V1 to V3 Firmware
- Brief problem info: I have a 16-channel Daisy & Cyton board + bluetooth dongle kit from OpenBCI. The Cyton board has V1 firmware on it, and I need to upgrade it to V3 before it can be used with the new GUI. I'm confused with the process and need help.
- Main questions:
- Do I need to upgrade the RFduino on both the dongle and the Cyton board, or can I just upgrade the firmware of the PIC on the Cyton board?
- To upgrade the firmware, do I need to alter my bluetooth dongle and connect it to the suggested electronic circuit which then connects to the Cyton board or can I do everything over bluetooth/some other connection?
- Do I need to go from V1 to V2 and then to V3 or can I go straight to v3 firmware?
- Does the order in which I upgrade each device actually matter?
- Is there a definitive guide or maybe a tutorial video on how to do any of this?
- More detailed problem info: I am working on a senior design project which includes EEG readings. I am in possession of the 16 channel Cyton & Daisy boards, have ordered all my electrodes and other electronics necessary for my project, 3D printed an UC headset, and put everything together. I am ready to start recording some data, but my Cyton board firmware is very out of date; I initially thought it was at V2, but after checking the text that was being sent over the radio, it seems to actually have V1 firmware (which is very incompatible with the new GUI). I've spent over 5 hours today looking at how to upgrade the firmware and trying to move forward with some of the different ways, and I can't seem to find the proper process to flash V3 firmware onto my Cyton board - rather I find lots of different instructions, but many links seem to be broken (the only redirect me to home pages) or some of the instructions seem to conflict with each other. I wanted to clarify the exact process here so I'd know what steps I'd need to follow and what materials I'd need to order and set up in order to upgrade the firmware.
- Some of the useful Links I've read through:
- https://github.com/OpenBCI/OpenBCI_Cyton_Library/blob/master/UPGRADE_GUIDE.md (according to upgrade guide, it seems like I have to upgrade from V1 to V2 then to V3. It also seems like I should upgrade the Cyton's RFduino, then the dongle's RFduino, then finally the PIC on the Cyton itself in that order.)
- https://docs.openbci.com/docs/02Cyton/CytonRadios (gives instructions on how to program the radios [RFduinos] referenced in previoius doc, it seems I'll need to alter the dongle to connect to the cyton board's RFduino and flash on the firmware [is this correct? Are there alternatives?]. As a note, when walking through the steps, I needed to uninstall Arduino IDE v 1.8.x and downgrade to v 1.5.8 beta to be able to select RFduino as the platform - the option wouldn't show up otherwise)
- https://docs.openbci.com/docs/02Cyton/CytonProgram (gives instructions on how to program the Cyton board itself, seems relatively straightforward, briefly mentions the case of flashing firmware directly to v3 from v1. As a note, when walking through the steps, I needed to uninstall Arduino IDE v 1.5.8 beta and upgrade to v 1.8.10)
- https://docs.openbci.com/docs/02Cyton/CytonSDK (the info here is how I found my Cyton board's version number)
Comments
Ana, hi.
Yes, Upgrade Guide is what you want. Yes, you need to use the dongle and a breadboard to update the firmware on the RFduino mainboard. Then update the dongle RFduino. Then update the mainboard PIC32 / chipKIT main processor. The V2 to V3 step is very easy. As it is just a reload of the PIC32 firmware, no RFduino changes.
No, on link #3. you need to start at link #1, updating the RFduinos first.
Regards, WIlliam
Thank you for the clarifications, William! I had to go out of town for a bit, but am back now and am trying to update the firmware again. I successfully updated the two RFduinos with the radio update instructions and moved on to uploading the main board, but I am now getting compile errors.
I am using the instructions on this page "https://docs.openbci.com/docs/02Cyton/CytonProgram" under the heading "Firmware Version 1.x.x (2014 - Fall 2016)". When I compile, I get the following error: "...OBCI32_SD\utility\Sd2Card.cpp:21:18: fatal error: plib.h: No such file or directory". From some Googling, it seems that plib.h is part of the chipkit-core board files installation but it might not be included anymore? I tried installing different versions of chipkit-core (1.3.1 [from the linked URL in the Cyton programming page], 1.4.1 [from the chipKIT core installation instructions page], 2.1.0 [newest version available]), but all of them have the same fatal error. Do you know which version I need to install? Or is the problem something else entirely?
Thank you very much for your help,
Ana
You need to use TWO different Arduino IDE's. An older one for the RFduinos, and a later (or latest version) for the PIC32. It's possible you were compiling the PIC32 with the RFduino IDE.
I used the 1.5.8 IDE for the RFduinos, then uninstalled 1.5.8 and reinstalled 1.8.10 before trying to update the board, so I've been having the compile errors with 1.8.10
https://openbci.com/forum/index.php?p=/discussion/598/openbci-32bit-compile-error-plib-h-no-such-file-or-directory
Thank you for the relevant link and sorry for not checking through the forums properly beforehand. I'm assuming the most important takeaway would be:
"Folks, sorry for the confusion. @Marceloruiz has the correct solution to the compile errors. No source changes are needed to the OpenBCI code (such as the casts mentioned earlier). These compile errors were apparently introduced by the chipKIT core changes. The INCORRECT core is v1.1.0-18. Which is currently labeled as the 'Release' version.
The chipKIT core which compiles OpenBCI_32bit correctly is v1.0.0-27, from 2015-10-18."
I will try updating the headset with the older chip-kit version later today and note here how that goes.
Hello,
I've tried to get the code to compile after manually installing the correct chipkit-core version and got a new error: "pic32-g++: C:\Users...\AppData\Local\Temp\arduino_build_915650/core\core.a: No such file or directory".
After Googling, I thought this could be due to my Arduino IDE version (which was 1.8.10), so I downgraded back to 1.8.0 (which was referenced in the Cyton firmware update instruction documentation) but the same error persists. Do you have any ideas on what core.a is and why it's not present?
Thanks,
Ana
The path name you show has mixed backslash and forward slash separators. Windows only understands backslash. Is is possible you have some odd glitches in your build files that are creating this mixed pathname?
I uninstalled arduino and went to "C:\Users...\AppData\Local\Temp\" - this location does not have any folders labeled arduino_build_XXXXXX. I reinstalled Arduino 1.8.10, went to the same location, and there was again no such folder. Launched the IDE, tried to compile the OpenBCI_32bit sketch, went to the same location, and found an arduino_build_XXXXXX folder.
I looked into the "C:\Users...\AppData\Local\Temp\arduino_build_XXXXXX/" folder and saw a "core.a" file, then went into the "C:\Users...\AppData\Local\Temp\arduino_build_XXXXXX/core" subfolder and found no such file. So it seems the path for the core.a file that is being searched for is "C:\Users...\AppData\Local\Temp\arduino_build_XXXXXX/core.a", but I'm not sure what file/code references that path in the first place, so I can't make the change to test it out. It seems to be happening during the linking step:
Linking everything together...
"C:\Users\...\Documents\Arduino\hardware\chipkit-core/pic32/compiler/pic32-tools/bin/pic32-g++" -Os "-Wl,-M=C:\Users\...\AppData\Local\Temp\arduino_build_389561/sketch.map" --gc-sections -mdebugger -mno-peripheral-libs -nostartfiles -mprocessor=32MX250F128B -o "C:\Users\...\AppData\Local\Temp\arduino_build_389561/OpenBCI_32bit.ino.elf" "C:\Users\...\AppData\Local\Temp\arduino_build_389561\sketch\OpenBCI_32bit.ino.cpp.o" "C:\Users\...\AppData\Local\Temp\arduino_build_389561\libraries\OBCI32_SD\File.cpp.o" "C:\Users\...\AppData\Local\Temp\arduino_build_389561\libraries\OBCI32_SD\OBCI32_SD.cpp.o" "C:\Users\...\AppData\Local\Temp\arduino_build_389561\libraries\OBCI32_SD\utility\Sd2Card.cpp.o" "C:\Users\...\AppData\Local\Temp\arduino_build_389561\libraries\OBCI32_SD\utility\SdFile.cpp.o" "C:\Users\...\AppData\Local\Temp\arduino_build_389561\libraries\OBCI32_SD\utility\SdVolume.cpp.o" "C:\Users\...\AppData\Local\Temp\arduino_build_389561\libraries\DSPI\DSPI.cpp.o" "C:\Users\...\AppData\Local\Temp\arduino_build_389561\libraries\EEPROM\EEPROM.cpp.o" "C:\Users\...\AppData\Local\Temp\arduino_build_389561\libraries\EEPROM\utility\Deeprom.c.o" "C:\Users\...\AppData\Local\Temp\arduino_build_389561\libraries\EEPROM\utility\flash.c.o" "C:\Users\...\AppData\Local\Temp\arduino_build_389561\libraries\OpenBCI_32_Daisy\OpenBCI_32_Daisy.cpp.o" "C:\Users\...\AppData\Local\Temp\arduino_build_389561\core\Board_Data.c.o" "C:\Users\...\AppData\Local\Temp\arduino_build_389561/core\core.a" "-LC:\Users\...\AppData\Local\Temp\arduino_build_389561" -lm -T "C:\Users\...\Documents\Arduino\hardware\chipkit-core\pic32\cores\pic32/chipKIT-application-32MX250F128.ld" -T "C:\Users\...\Documents\Arduino\hardware\chipkit-core\pic32\cores\pic32/chipKIT-application-COMMON.ld"
However, I'm not sure if the "C:\Users\...\AppData\Local\Temp\arduino_build_389561/core\core.a" is actually a mistake, because I see the same output in these posts from 2016, 2018, and 2019 with different versions of the IDE (https://github.com/MrYsLab/pymata-aio/issues/48 , https://forum.arduino.cc/index.php?topic=421285.0 , https://forum.arduino.cc/index.php?topic=567870.0 , https://forum.arduino.cc/index.php?topic=641532.0) - they were having linker problems, but different ones from what I'm having.
Just as a note, those single backslashes in the italics are actually double backslashes. i.e. "C:\Users...\AppData\Local\Temp\arduino_build_389561/core\core.a" is actually "C:\\Users\\MSI\\AppData\\Local\\Temp\\arduino_build_389561/core\\core.a"
It looks to me like you have the wrong chipKIT core installed. These core.a not found errors were also reported on the other thread until the solution was found with the correct chipKIT core.
https://openbci.com/forum/index.php?p=/discussion/598/openbci-32bit-compile-error-plib-h-no-such-file-or-directory
I see that core.a error listed in the other thread with a different path of "C:\Users\Marcelo\AppData\Local\Temp\build314722887501305307.tmp/core.a", but I now realize that they were compiling with IDE v1.6.5 according to the screenshot, and that comment is from 2016, so it could be the same problem but the paths were just different then?
The folder for the chipkit-core which I downloaded was "chipkit-core-windows.16778039.v1.0.0-27-gdfa0309" (downloaded from https://chipkit.s3.amazonaws.com/chipkit-core/builds/win/chipkit-core-windows.16778039.v1.0.0-27-gdfa0309.zip). I then copied the contents (folder called "chipkit-core") to "C:\Users...\Documents\Arduino\hardware". Is this the wrong version or the wrong place to put it?
The previous comments on the other thread indicate there is confusion / conflict over whether the toolchain is installed in Windows local or roaming pathways. Possibly same thing is happening on your system.
My impression is that toolchain should be installed from the Arduino IDE Board Manager menu. NOT placed by hand into some folder. Enter the https path of the zip into the Board Manager prompt.
The Cyton programming doc, points to this page for installing the chipKIT core,
http://chipkit.net/wiki/index.php?title=ChipKIT_core#1.29_Auto_install_via_URL_from_within_Arduino_IDE_.28latest_version_chipKIT-core_v1.3.1.29
And gives two options, Board Manager or download zip. You should try the Board Manager first, if the v1.0.0-27 is not listed there, then use the zip method.
I don't see any roaming pathways listed, so I don't believe that problem applies here.
The Board Manager does not support zips through URL (only structured types like the JSON link included in the chipkit documentation) (https://github.com/arduino/Arduino/issues/2881)
Method 1 (through board manager) is the instructions I tried initially when I was testing chipkit versions 1.31, 1.41, and 2.1.0. Unfortunately, 1.0.0 is not an option, as the earliest listed version is 1.0.1. As for Method 2, the manual installation, it seems to tell me to follow the same steps I already have (extract the zip, get the chipkit-core folder and copy it to ...Documents\Arudino\hardware).
I am uploading the Windows, Mac and Linux zips to our own server. Might be able to setup a json that points to them. Did this previously for our Simblee Board Manager.
Please continue to try alternatives. Not sure when or if the new json will be available. Sorry for this problem you are having. Another alternative for you may be to try building on Mac or Linux.
I don't use Linux often, so I can't navigate it as well, but my primary machine does have Ubuntu 18.04 64-bit dual-booted on it for occasional projects. I installed Arduino 1.8.10, downloaded and extracted the OpenBCI firmware/libraries and the linux 64 bit version of the chipKit-core folder, and placed everything in the relevant Sketchbook directories. In the chipkit core instructions, it mentioned I needed to add 32-bit support, so I did that as well through the command they provided. Upon compilation, I have this error:
Arduino: 1.8.10 (Linux), Board: "OpenBCI 32"
In file included from /home/.../Arduino/hardware/chipkit-core/pic32/cores/pic32/WProgram.h:9:0,
from /home/.../Arduino/hardware/chipkit-core/pic32/cores/pic32/Arduino.h:4,
from sketch/OpenBCI_32bit.ino.cpp:1:
/home/.../Arduino/hardware/chipkit-core/pic32/cores/pic32/pins_arduino.h:263:24: fatal error: Board_Defs.h: No such file or directory
compilation terminated.
exit status 1
Error compiling for board OpenBCI 32.
Invalid library found in /home/.../Arduino/libraries/OpenBCI_32bit: no headers files (.h) found in /home/.../Arduino/libraries/OpenBCI_32bit
I see the same problem listed here: https://openbci.com/forum/index.php?p=/discussion/comment/4188#Comment_4188
In that thread, Don Reed got everything to compile by changing the source codes and stated: "@wjcroft I don't think this issue (Board_Defs.h, etc) was caused by me installing something terribly wrong. Something is clearly broken with the code from chipkit or repos in http://docs.openbci.com/tutorials/02-Upload_Code_to_OpenBCI_Board One has to modify code to make it work, also it expects folders to be named one way, but they are named another way (E.g., OpenBCI_32 vs openbci). I'm not sure whether this is Linux specific or if it's universal. Based on types of errors I suspect it may be the latter. So, perhaps, as a temporary solution we can put some disclaimer in the docs, to threads like this and plib. Because at it is now things from the guide don't seem to work together at all. If this is indeed not me screwing something up, then I can create a pull request on docs repo with a small (linux?) disclaimer like "If you see Board_Defs.h" look this way and a link to this and plib threads."
In response to that comment, you pointed to the previously linked thread (http://openbci.com/forum/index.php?p=/discussion/comment/4239/#Comment_4239) and stated the correct release of chipkit should not have the same problems or require source code changes.
Since we are using the correct chipkit version (chipkit-core-linux64.16778039.v1.0.0-27-gdfa0309), I am stuck at this point.
DId you see the note about 64 bit Linux on the chipKIT page?
http://chipkit.net/wiki/index.php?title=ChipKIT_core#1.29_Auto_install_via_URL_from_within_Arduino_IDE_.28latest_version_chipKIT-core_v1.3.1.29
Yes, I ran the suggested command ($ sudo apt-get install libc6-i386) to add 32-bit support before trying to compile.
Please try compiling Cyton firmware 3.1.2 with latest version for everything (including chipKit 2.1.0) using all 64bit apps and libs on Windows.
Please just use the Built in Board Manager and Library Manager in the Arduino IDE.
Now looking back on her comment stream in this thread, I get the impression she was trying to compile the v1 Cyton chipKIT firmware, instead of the 3.1.2 firmware. Possibly confused by AJ's Upgrade Guide step sequence.
Yup, sorry for the confusion. I was using https://github.com/OpenBCI/OpenBCI_Cyton_Library/blob/master/UPGRADE_GUIDE.md as my main guideline for the order of everything, https://docs.openbci.com/docs/02Cyton/CytonRadios for reprogramming the RFduinos, and the heading "Firmware Version 1.x.x (2014 - Fall 2016)" of the link https://docs.openbci.com/docs/02Cyton/CytonProgram for the Cyton board's PIC reprogramming. I was under the impression that I couldn't upload V3 firmware onto the board without loading V2 on it first, and based on the headings of the upgrade guide, I thought the heading in the Cyton Programming guide which I needed to use was the V1 version (to upgrade to V2). I will try in Windows again with the latest V3 firmware and let you know how that goes.
@Anastasiya Once you get everything working, we can talk about how to make this process clearer and easier for everyone. Your initial post makes it clear there are a handful of complicated resources, and I think we can make improvements in this area with your help.
Quick update. I followed the steps for V3 (the process is so automated and so user-friendly, I love it) and the firmware compiled without any issues. However, when I tried to flash the firmware onto the board's PIC, it didn't work (target not found), but this could easily be due to me overwriting an RFduino or something from a previous step while trying to debug all my issues this past week.
I'm going to start from scratch and reflash the firmware to both RFduinos and then try to update the firmware on the PIC to V3 tomorrow. To make sure I'm not misunderstanding/deviating horribly from what is expected, I'll be using the steps outlined by a couple people at the end of this thread (along with the official documentation): https://openbci.com/forum/index.php?p=/discussion/comment/11268#Comment_11268 as a guideline/checklist for every step I take .
It's possible that your RFduino's upgraded fine, but are somehow not on the same radio channels. Even without the latest chipKIT firmware, you may be able to use the Autoscan feature to align the radios.
https://docs.openbci.com/docs/01GettingStarted/01-Boards/CytonGS#5-optional-settings
Click the right arrow to expand that section.
I definitely messed something up with the RFduinos somewhere along the line. I now have the RFduinos functioning fine, but can't flash the firmware onto the PIC. These are the steps I took:
In Arduino 1.5.8: (updating RFduinos' firmware)
In OpenBCI GUI: (checking whether RFduinos were uploaded correctly and can connect to each other)
In Arduino 1.8.10: (updating PIC's firmware)
"\.\COM5: Cannot open
Copyright: (C) 2011-2015 Serge Vakulenko
2016-2017 Majenko Technologies
No target found.
Programmer for Microchip PIC32 microcontrollers, Version 2.1.46
An error occurred while uploading the sketch"
In OpenBCI GUI: (checking that COM5 is still connected)
In Arduino 1.8.10:
In OpenBCI GUI:
In Arduino 1.8.10:
"Programmer for Microchip PIC32 microcontrollers, Version 2.1.46
Adapter: STK500v2 Bootloader
Program area: 1d000000-1d1fffff
Processor: Bootloader
Flash memory: 2048 kbytes
Boot memory: 80 kbytes
Data: 86208 bytes
Erase: done
Program flash: ...........................................##Program flash failed.
invalid reply length=32770, expecting 2 bytes
An error occurred while uploading the sketch"
"Programmer for Microchip PIC32 microcontrollers, Version 2.1.46
Adapter: STK500v2 Bootloader
Program area: 1d000000-1d1fffff
Processor: Bootloader
Flash memory: 2048 kbytes
Boot memory: 80 kbytes
Data: 86208 bytes
Erase: done
Program flash: ...........................................##Program flash failed.
An error occurred while uploading the sketch"
Are you still getting errors? Here is a relevant comment,
https://openbci.com/forum/index.php?p=/discussion/comment/10571/#Comment_10571
I was still having this problem, and now I'm not sure if I am. I was busy most of last week, so I didn't do anything after my previous post until this morning. Below is a transcript of what i've done:
From that link, it seems like it just doesn't always work on the first try, and I should just try and try again until it succeeds.
I tried uploading the firmware to the board by plugging in the bluetooth dongle, then putting the board in bootloader mode (with the switch set to PC and blue light blinking), and I got the following error:
Program flash: ...........................................###########Program flash failed.
An error occurred while uploading the sketch
I then tried the same thing but this time while getting the board into bootloader mode, I had the switch set to BLE w/blue light blinking once more. I got the following error (seems to be the same):
Program flash: ...........................................############Program flash failed.
An error occurred while uploading the sketch
I found a similar thread with the program flash failed here: https://openbci.com/forum/index.php?p=/discussion/comment/8121#Comment_8121 , but there doesn't seem to be any conclusion other than a note that the board needs to be very close to the bluetooth dongle.
Mine has been about 1.5 feet away so far. I tried a few inches away in bootmode w/switch set to PC and it failed faster:
Program flash: ...........................................##Program flash failed.
An error occurred while uploading the sketch
Tried a few inches away in bootmode w/switch set to BLE and it failed even faster:
Program flash: ...........................................#Program flash failed.
An error occurred while uploading the sketch
Tried a few inches away with PC again and:
Program flash: ...........................................Program flash failed.
An error occurred while uploading the sketch
Tried a few inches away with BLE again and IT SUCCEEDED(?) with the flash BUT FAILED on the checksum (it seems like it couldn't read it). However, this time the blue light stayed on instead of turning off after the failed upload.
Program flash: ...........................................############################################ done
Verify flash: ...........................................Read page failed.
invalid reply checksum
An error occurred while uploading the sketch
I then launched the OpenBCI GUI and tried connecting to the board w/switch set to PC - the GUI allowed me to start the session (unlike with the outdated firmware) and the data seemed to be accurate (I have the boards disconnected from the headset and stimulated individual wires connected to each channel, and there were responses). The board seems to be functioning as intended even if the checksum couldn't be read. Would you say it's safe to use then? Is there a way to check the checksum myself (without messing with the firmware on the board and potentially not being able to reupload it) to see if everything was installed correctly?
That's great, looks like you are set. The BLE vs PC switch positions are the same thing. Not sure why your checksum is failing.