Flash memory stop working

edited March 26 in Android

Hello Eric:
I was doing some data logging right now.
The data downloaded from Logging module is quite normal at first. After about 45minutes, no data can be downloaded. The only thing I can see is how many entries left.
I use the code provided in documentation, and here they are:

    Logging m_logging = metawear.getModule(Logging.class);
        Accelerometer mAcc = metawear.getModule(Accelerometer.class);
        if(1){
                Log.i("downloading","start");
                m_logging.start(false);
                final AccelerometerBmi160 mBmiAcc = metawear.getModule(AccelerometerBmi160.class);
                mBmiAcc.configure()
                        .odr(AccelerometerBmi160.OutputDataRate.ODR_1_5625_HZ)  // set odr to 1.5625Hz
                        .range(AccelerometerBosch.AccRange.AR_4G)          // set range to +/-4g
                        .commit();
                mBmiAcc.stepDetector().configure()
                        .mode(AccelerometerBmi160.StepDetectorMode.NORMAL)
                        .commit();
                mBmiAcc.acceleration().start();
                mBmiAcc.start();
                mBmiAcc.acceleration().addRouteAsync(new RouteBuilder() {
                    @Override
                    public void configure(RouteComponent source) {
                        source.log(new Subscriber() {
                            @Override
                            public void apply(Data data, Object... env) {
                                Log.i("downloading", "Bmiacc" + data.value(Acceleration.class).toString());
                            }
                        });
                    }
                }).continueWith(new Continuation<Route, Void>() {
                    @Override
                    public Void then(Task<Route> task) throws Exception {
                        mBmiAcc.lowHigh().start();
                        mBmiAcc.start();
                        return null;
                    }
                });
            }
            else{
                mAcc.acceleration().stop();
                mAcc.stop();
                m_logging.stop();
            }
        }

Here is the result shown in logcat:

I wonder is the flash memory broken? Or any wrong with my code?
But it do work at the beginning, fail some while later/

Comments

  • Quoting myself from your other thread (https://mbientlab.com/community/discussion/comment/6125/#Comment_6125)

    @Eric said:
    If you aren't at least seeing the sensor data in Logcat, then you probably are not running the code correctly. Use the variant downloadAsync method with the error handler and post any messages being forwarded to the handler.

  • Hi, Eric.
    Soz to bother again, I'm completely new to android.
    Here are some imformation got from error handler, with code. I don't know whether my code is correct or not but I got some information that tells "UNKNOWN LOG ENTRT"

    As shown below

  • Did you remove old routes / resources? It looks like you have old logging routes that were never removed so you are logging the same data multiple times.

  • Good morning, Eric.
    Glad to hear from you. Ummm, I think I haven't done what you have said. BUT, ashamed to say 'I don't understand what need to be done.' Can you please give some hint how to remove the old routes / resources?
    Thank you very much~~~~

    @Eric said:
    Did you remove old routes / resources? It looks like you have old logging routes that were never removed so you are logging the same data multiple times.

  • What I have done is let all sensor to stop. Like acc.stop() and logging.stop(), after that I start download. But I think the problem happens when logging data to onboard flash memory.

  • My steps:
    1.connect board
    2.get module of accelerometer and Logging
    3.start logging
    4.addRouteAsync on the accelerometer
    5.stop logging, stop accelerometer

    And from the error handler I found that logId has a endless loop from 0 to 7.
    Really need some help. Orz, despairing ~~~~right now.

  • edited April 10

    @EvenBerry said:
    Good morning, Eric.
    Glad to hear from you. Ummm, I think I haven't done what you have said. BUT, ashamed to say 'I don't understand what need to be done.' Can you please give some hint how to remove the old routes / resources?
    Thank you very much~~~~

    @Eric said:
    Did you remove old routes / resources? It looks like you have old logging routes that were never removed so you are logging the same data multiple times.

    https://mbientlab.com/androiddocs/3/metawearboard.html#tear-down

    @EvenBerry said:
    My steps:
    1.connect board
    2.get module of accelerometer and Logging
    3.start logging
    4.addRouteAsync on the accelerometer
    5.stop logging, stop accelerometer

    And from the error handler I found that logId has a endless loop from 0 to 7.
    Really need some help. Orz, despairing ~~~~right now.

    Remove the allocated resources after you no longer want to log data.

  • Hi, Eric:
    I add metawear.teardown() after I stop logging. But the same problem still happens.

                mBmiAcc.acceleration().stop();
                        mBmiAcc.stop();
                        m_logging.stop();
                        metawear.tearDown();
    

    It's still "UNKNOWN_LOG_ENTRY"
    I bought another metawearMotionR sensor, facing the same problem.

  • You are not done logging until after you have downloaded the data. Tear down is the last thing you do before disconnecting from the board.

Sign In or Register to comment.