Adding a data route timed out after 10000ms and non-zero status: 8

Hello,

I am trying to work with multi-sensors with logging. I am able to connect to a boards, configure the sensors(add routes), start scanning, and download the log entries after hitting the stop button. But after the data is downloaded, I want to reset the device, remove routes and re-add the routes. I am getting an error saying "" when I try to re-add the routes. Can you please let me know what am I doing incorrectly that is causing the issue?
My code:

stop button snippet:
logModule.downloadLog(0.f, new Logging.DownloadHandler() {
@Override
public void onProgressUpdate(int nEntriesLeft, int totalEntries) {
if (nEntriesLeft == 0) {
Log.i(streamKeyX, "Log download complete");

resetInitialize(mwBoards.get(position));
reset.start();
}
});

public void resetInitialize( final MetaWearBoard mwBoard1){
reset = new Thread(new Runnable() {
@Override
public void run() {

try {
logModule1 = mwBoard1.getModule(Logging.class);
logModule1.clearEntries();
mwBoard1.removeRoutes();
Debug debug = mwBoard1.getModule(Debug.class);
debug.resetDevice();
mwBoard1.connect();

                              I am putting the code which I am using to add the routes at the top over here to re-add them.
               }
});

So when I click on stop button, I am able to download the entries but when the resetInitialize() method is called, I get an error when the routes are getting added saying :
Error X﹕ Adding a data route timed out after 10000ms
Error Y : Adding a data route timed out after 10000ms
Error Z﹕ Adding a data route timed out after 10000ms

And then the board gets disconnected and I get the following error :
java.lang.RuntimeException: onConnectionStateChanged reported non-zero status: 8

Comments

  • You don't need to be resetting the board every time your download is complete; program the MetaWear once and let it run until you want it to do something different. 

    Issuing the reset command resets the board but Android still needs to be updated with the connection state change; this can take several seconds.  You need to wait until the ConnectionStateHandler is called before attempting to reconnect.
  • Hey Eric,

    Thanks for that information. Can you tell me what is the way I can clear the logged data from the board? Do I just have to call just the logModule.clearEntries() method or is there any other call to any method too that I have to make?

    P.S. I want to be clearing the data every few seconds and continue reading the data from the routes I set up at first.
  • The only thing you have to do is disconnect from the board after the log download is completed.  You'll need to wait a few seconds for the flash memory to be cleared before reconnecting.
  • Hello Eric,

    I have been trying to do this, but the issue I am facing now is when I run the logging for the first time, I am able to get the intended number of logs while downloading, after this, when I disconnect my board, reconnect after a few seconds and then re-run the logging, I am not able to log even one record. When I download the data, the total size is showing up as 0.

    Is there anything I missed in my procedure of :
    1. Write routes
    2. Start logging and start accelerometer
    3. Stop logging and accelerometer
    4. Download the data
    5. Disconnect the board and wait for few seconds
    6. Re-Connect the board and again start logging and accelerometer
    7. Download new data

    P.S. I am using RMS>6 as a trigger and that is working fine even after re-connecting the board. It is this trigger that activates the other axes sampling
  • This sounds like the board is resetting at some point.  Try updating to the latest firmware and program a macro to turn on the LED on boot to see if the board is indeed resetting.
This discussion has been closed.