openbci-archive / OpenBCI_NodeJS

Node.js SDK for the all OpenBCI Biosensor Boards
https://www.npmjs.com/package/openbci
138 stars 50 forks source link

Time sync feature not working with firmware version 2 #87

Closed rlqmal closed 8 years ago

rlqmal commented 8 years ago

I've tried to use time sync feature by running timeSync.js in examples/timeSync.

I already updated my OpenBCI HW to firmware version 2. However, syncClocksFull() function is not working.

bash-3.2$  ls
node_modules package.json timeSync.js
bash-3.2$ node timeSync.js
connected
(node:89295) Warning: Possible EventEmitter memory leak detected. 11 synced listeners added. Use emitter.setMaxListeners() to increase limit
^C

Have any idea? Additionally, Is there any method that I can debug my OpenBCI firmware?

andrewjaykeller commented 8 years ago

i just saw this same issue when using similar code in the example file this weekend!! this is a bug and i will try to get tot eh bottom of it. Without looking at anything, I have to imagine this is from an on event being added and not removed.

I'm gonna eat my breakfast and then get to the bottom of it.

rlqmal commented 8 years ago

Thank you for the super fast answer @aj-ptw !

Software reset command (ourBoard.usingVersionTwoFirmware();) returns true, so I think this bug may come from firmware side. I'll report, if I found something.

andrewjaykeller commented 8 years ago

This is most likely not from the firmware (i wrote this into the firmware). This is from the parser in this module not finding the time sync sent confirmation , sent back from the Dongle. If the time sync set is not picked up, then the syncClocksFull function will reject after one second. But I imagine if we are syncing multiple times a second and some of the syncs do not complete successfully, then we will install to many event emitters.

In other words, let's solve this problem!!

andrewjaykeller commented 8 years ago

Which version of the firmware are you using (aka when did you update)? Can you port your output like I did below? timeSyncExampleOutput.txt

You can do it with: node timeSync.js > timeSyncExampleOutput.txt

rlqmal commented 8 years ago

Code that I wrote is raw output.

bash-3.2$  ls
node_modules package.json timeSync.js
bash-3.2$ node timeSync.js
connected
(node:89295) Warning: Possible EventEmitter memory leak detected. 11 synced listeners added. Use emitter.setMaxListeners() to increase limit
^C

It doesn't print lines like timeOffset 1475505398028. And I updated OpenBCI board with v2.0.0-rc.6 from your repository OpenBCI_32bit_Library.

andrewjaykeller commented 8 years ago

Please use the radio code found here: https://github.com/OpenBCI/OpenBCI_Radios/tree/2.0.0

And the library code found here: https://github.com/OpenBCI/OpenBCI_32bit_Library/tree/2.0.0

andrewjaykeller commented 8 years ago

Let's at least get you working and seeing those timeOffset prints and go from there. @rlqmal I am still seeing the possible event emitter code with working time sync so I know we should at least be able to get you going!

AJ

rlqmal commented 8 years ago

Sorry for late response. I tried to upload radio code you suggested. Host radio code works fine. However, uploading radio device code is not working.

Arduino reports while uploading RadioDevice32bit.ino

get
fail.......fail.......fail.......

I followed basic pin connection from UPLOAD CODE TO OPENBCI RADIOS.

Question: Do I have to update radio device also?

andrewjaykeller commented 8 years ago

Question: Do I have to update radio device also?

Yes for sure!

uploading radio device code is not working.

You need to make sure you are holding the wires on firmly and the board is powered on. I find it helps to put the board top down, run the four wires through a header, and push firmly!

rlqmal commented 8 years ago

I think my first OpenBCI (I have two boards.) is broken. Uploading radio firmware to the second OpenBCI was successful.

However, I found an another error. While uploading the library code, it shows error in verify flash step. Have any idea?

Programmer for Microchip PIC32 microcontrollers, Version 2.0.180
    Copyright: (C) 2011-2015 Serge Vakulenko
      Adapter: STK500v2 Bootloader
 Program area: 1d000000-1d1fffff
    Processor: Bootloader
 Flash memory: 2048 kbytes
  Boot memory: 80 kbytes
         Data: 74360 bytes
        Erase: done
Program flash: .....................................###################################### done
 Verify flash: .....................................
error at address 1D0000FC: file=9D001250, mem=9D00125C

Thanks!

andrewjaykeller commented 8 years ago

Hi @rlqmal how is it going? How can I help?

rlqmal commented 8 years ago

All my board is broken. Is there any way that I can reset my OpenBCI board?

Every time I try to load the firmware, it fails.

andrewjaykeller commented 8 years ago

Can you at least stream data from the Board? Can you still not upload radio firmware code to the Board? You can always reset your Board at any time thanks to arduino compatible micro processors!