data stream freezes during long sessions
Hello,
The OpenBCI GUI from https://github.com/OpenBCI/OpenBCI_Processing freezes after running for an hour. I am trying to record EEG signals for an 8 hour period. Should that be possible with the GUI provided? Is this an issue with my personal computer (although I doubt it since there doesn't seem to be anything preventing it from running)? Is there a setting in the code that forces data recording or visualization to stop after a certain period of time?
Thanks.
Comments
Can you provide a few more details on your environment, which OpenBCI board, what OS and version, type of batteries and voltage, etc. Do you have a record of the amount of time passed from start to freeze; you say one hour, how consistent is that?
Have you tried running with another computer or OS, to rule out that element?
When the freeze happens, does the red led on the dongle go out? Normally it flickers gently as the data is coming in over the radio link.
When the freeze happens, does the OpenBCI GUI let you stop and restart using the GUI buttons. Or do you have to power cycle the OpenBCI.
I don't believe the GUI code has any built in time or file size constraints, but I'll let @chipaudette and @conor_obci comment.
Regards, William
Is there anything I can do to troubleshoot the GUI?
That does seem to eliminate the OS or laptop as cause. And the fact that you can sometimes stop/start the GUI for another 20 mins -- seems to eliminate the GUI / Processing as the culprit as well.
We assume you are checking your battery pack voltages periodically. With the 32 bit board you need to be above 3.3v for the regulator to function properly.
I'm wondering if Joel @biomurph might comment here. Regarding:
* is it possible that a component might heat up slightly over such a time period. (Like one of the RFduinos). And then something goes "out of spec", triggering the freeze? Could this be an isolated case of a certain board or dongle that would work ok, if replaced? The failure modes described in TF's previous posts do seem to point to some kind of warmup period as essential. Then once 'hot' the component will re-fail within a shorter interval (20 mins vs. 1.5 hours.)
Also mentioning @chipaudette again, if he has done any extended runs.
TF, why don't you send an email to [email protected] , and see if a board swap is something they would explore or recommend. Or any other suggested tests.
William
I'm mentioning Jeremy @jfrey so he will comment on your Python and OpenViBE observations. Your ability to acquire long sessions with OpenViBE does indeed imply that there is some kind of glitch in the Processing environment. I'm wondering since that is Java based if there might be some sort of automatic garbage collection issues with the Java virtual machine; such that it runs for a couple hours, then some resource becomes exhausted. But perhaps with some kind of adjustment of those GC settings, that would be eliminated. Such as:
https://processing.org/discourse/beta/num_1202914234.html
Here is some info on the GC tuning options. Maybe @chipaudette has some comments on those.
I don't believe the OpenViBE drift adjustment has anything to do with the Processing hang. That adjustment just inserts or removes extra samples if OpenBCI is not generating exactly 250.00 samples per second.
William
When I was using the live mode I can correctly capture the signal; however sometimes the data stream would suddenly stop.
2. Our Experiment is going to record EEG siganal 30min
I merged your post into this existing thread. When you say "goes to zero", do you mean the stream halts, or the stream still runs but produces all zeros?
OpenViBE OpenBCI acquisition driver has a "freeze detection" built in from Jeremy @jfrey . As far as we know this prevents any lockups. Have you tried that? You say you are using OpenViBE to visualize, but are you also acquiring directly from the acquisition server?
William
@TFNANO : do you still have this problem?
I have the same...
you wrote "Yes I have tried to save to SD card, but because the software stops acquiring it also stops saving to the SD card."
Have found some data on the SD card or nothing at all? (the file could be "not closed"...)
The PIC32 seems to write continously on the SD since the "sendchanneldata" function does not report errors... Look at the main loop code there under.
@Biomurph : Do you know what happens if we delete "OBCI.sendChannelData(sampleCounter);" ? SD card updated and no freezing?
(I could try but I am affraid to break every thing...)
Yannick.
void loop() {
if(is_running){
while(!(OBCI.isDataAvailable())){} // wait for DRDY pin...
OBCI.updateChannelData(); // get the fresh ADS results
if(OBCI.useAccel && OBCI.LIS3DH_DataAvailable()){
OBCI.LIS3DH_updateAxisData(); // fresh axis data goes into the X Y Z
addAccel = true; // adds accel data to SD card if you like that kind of thing
}
if(SDfileOpen){
writeDataToSDcard(sampleCounter); //
}
OBCI.sendChannelData(sampleCounter);
sampleCounter++;
}
eventSerial();
}
@biomurph, thank you for the "write to SD only" code.
I dared the upload, everything passed well, the card survived ...
I used the terminal supplied by Arduino in tools, "serial monitor" :
+?+ ; +v+ ; +a+ ; +N+ ; +j+ ; and so on ... It worked...
Just like you I got :
Max write time: 305 uS
Min write time: 299 uS
Overruns: 0
If I stop recording by +j+ , there is no footer in the sd file...
It is a little bit abrupt...
I tried a 4h recording.
Good news : No freezing...
But time to time "SD BLOCKS written: HHHHHH" was not always well written
for example :
?written: 1755
–KS written: 3661
written: 8836
BLOCKS written: 8926
Kitten: 11226
itten: 11801
@ written: 12376
BLOCKS written: 13708
written: 16582
ôOCKS written: 17067
CKS written: 22635
SÑten: 27507
¦S written: 29201
BLOCKS written: 31017
BLOCKS written: 31683
rwritten: 35011
...
...
The number of bad messages is big ,
much more than 50 (the number of overruns) since last line is 520992...
...
SD BLOCKS written: 520932
SD BLOCKS written: 520962
SD BLOCKS written: 520992
The footer signals
50 overruns ,
Max write time: 153518 uS
"Overrun" : what is it in fact ?
- a problem to write on the SD ? (it would be strange)
- a problem with the radio transmit ?
- some A/N conversion missed ?
I try to read the code to anderstand Which part of the code yields these "overruns"...
Have you any idea?
I also removed the verbosity :
// if(SDsampleCounter == 0x00){
// Serial0.print("SD BLOCKS written: ");
// Serial0.println(blockCounter); // verbosity
// }
For a one hour record, the end message on the terminal is :
OpenBCI V3 16 channel
On Board ADS1299 Device ID: 0x3E
LIS3DH Device ID: 0x33
$$$Wiring is correct and a card is present.
Corresponding SD file OBCI_06.TXT
$$$Total Elapsed Time: 4606304mS
Max write time: 84956 uS
Min write time: 299 uS
Overruns: 11
fileBlock,micros
8088,29771
24000,5926
40384,10811
56768,10664
73152,14604
89536,10518
97625,84956
97626,7540
114112,11847
122201,83998
122202,12203
There are still some overruns (but because of what???)
is there any kind of hidden dialog between the card and the PC?
50 overruns for 4 hours and messages, statisticaly it is the same that 11 overruns for 1 hour record without verbosity...
Should we use Interrupts by "/dryd" instead pooling (and a big buffer) for the data acquisition?
I have seen a post like that...
Here under the Footer and +?+ answer for the 4hours record. .
Thank you and sorry for my bad english,
Yannick.
Total Elapsed Time: 17689000mS
Max write time: 153518 uS
Min write time: 299 uS
Overruns: 50
fileBlock,micros
28864,16397
45248,4973
61632,12590
78016,9007
94400,16170
110784,5145
127168,12166
143552,5323
157697,147812
157698,107986
157699,3686
176320,15323
192704,8980
206849,153203
206850,120451
225472,11227
241856,9252
256001,153518
256002,120363
274624,20500
+?+ gives :
Board ADS Registers
ADS_ID, 0x00, 0x3E, 0, 0, 1, 1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 0
0x0E 0
0x0F 33
0x1F 0
0x20 8
0x21 0
0x22 0
0x23 18
0x24 0
0x25 0
0x26 0
0x27 0
0x28 0
0x29 0
0x2A 0
0x2B 0
0x2C 0
0x2D 20
0x2E 0
0x2F 20
0x30 0
0x31 0
0x32 0
0x33 0
0x38 0
0x39 0
0x3A 0
0x3B 0
0x3C 0
0x3D 0
$$$
and yes , I should have used 's' instead 'j'... Sorry...
I bought a 16Gb card from Transcend ( TS16GUSDHC10 ) Class 10 , 30MB/s, 200x.
How fast are the ones shown at http://docs.openbci.com/tutorials/08-SD_Card ?
To format the card I used as you recommend, SDFormatter.exe
Format type : Full Overwrite
Format size adjustment : ON
Do we know why the writing time varies so much ?
Thank you very much,
Yannick.
20mHz would induce mistakes? Would they be reported by the soft? Probably , else they retry...
Compared to the 30MBytes/S of a "slow" card the 20/8 MBytes/S of the bus is very slow .
To send the 512octes or 4096 bits , the bus , even slow, needs around 4096/20uS = 0.21mS, it is short...
If something takes so much time it is probably/certainly not due to the bus speed or the average card speed but to some mysterious process inside the card.
These process are not frequent but can require up to hundreds of milli seconds may be even with the fastest cards.
In the file Sd2Card.h I found that SD_WRITE_TIMEOUT=600mS ! ! ! (At 250samples/S, we have less than 4mS to write a block...)
To get the highest quality card is better of coarse but I am not sure that it can solve this overrun problem which is mainly due to the fact that two time dependent chips, the ADS1299 and the SD Card, share the same resource , the SPI Bus...
Without time sharing on the SPI, the collisions are inevitable.
It is only a personal theory, I am not an expert on the subject ...
What's your feeling?
Yannick.