Board stops sending data after few sequential connect-disconnect cycles (possibly a firmware bug)
Hello!
I'm developing Android application which connects to as many MetaWear boards as possible on a device it is launched. After a connection is established this program listens to 3 sensors on every board (Accelerometer, Gyroscope and Magnetometer) and saves data as CSV. Nothing new there. There's a switch which can be used to start and stop data capturing. After this switch is set to OFF the program unsubscribes from streams but leaves all boards connected. Every time this switch is set to ON the program starts those streams again. What is bothering me is that after a some number of those start-stop cycles some boards stop sending any data until the board is reset. Then it starts to send the data again. The number of ON-OFF cycles to cause such behaviour can sometimes be 3, and sometimes it can be 10.
Screenshot:
The program creates a folder '/sdcard/MetaWearDemo' where a file for each device data is stored. Empty file contains only a header and has a size of 63 bytes.
In short the program's flow can be described like this:
1. Connect to a board. This is done when a user checks a checkbox in a list:
2. Connect to sensors. This is done when a user turns switch to ON:
3. Start listen to data:
4. Stop listening to data. This is done when a user set a switch to OFF
After a few repetition of steps from 2 through 4 some devices stop sending data until manually reset. This can be indicated by their respective csv file being empty (63 bytes, contains only a header)
What i've tried so far to solve this issue:
1. Tried to call board.disconnect() every time a switch gets set to OFF. This does not help.
2. Tried to call board.tearDown() before call to module.routeData(). This does not help either.
3. Tried to call board.tearDown() every time a switch gets set to OFF. No help.
Only thing which helps is to reset a device before every connect, but this is not a solution:
Debug debugModule = board.getModule(Debug.class);
debugModule.resetDevice();
-------------------------------------------
Android version i'm testing with is '5.0.2'.
Phone is 'HTC One M9'.
Devices affected by described behaviour has next parameters:
Model number: 2
Firmware revision: 1.2.3
Hardware revision: 0.2
Maybe there are others too, but i don't know that.
-------------------------------------------
I've prepared a demo application for you to check this behaviour. Link: git clone https://mykolaj@bitbucket.org/mykolaj/metawear-firmware-bug-demo.git
Please try to test with it, and help me to identify is there a problem on firmware's side, or it's on my app's side.
PS: I was trying to include more code in this post but validator does not allow that much text.
This discussion has been closed.
Comments
Firmware: 1.2.4
C++ SDK: 5.22
Host: Linux 3.10
BlueZ: 5.39
After several minutes running our program which subscribes to a CPRO accelerometer, gyro and magnetometer sensors, apparently it stop receiving sensor data, in this case all signal handlers were stopped being called. We have had this issue since the previous firmware and SDK. With device reset, the stream shall run again then unfortunately stop after some times.
We tested using latest 1.2.4 firmware since as the release notes say it may have addressed this issue.