Systematized information about the accelerometer to add to the header. Here's what happened:
The tablets Elf II, Aurora II installed accelerometer Bosch BMA250. Full information on this sensor can be found here:
Bosch BMA250 datasheet
The same sensor is installed in some other devices, in particular, Samsun Galaxy Nexus.
Information about the state of the sensor can be obtained through the registers using the I2C protocol. These registers can be used to control the operation of the sensor, in particular, it can be calibrated.
In order to get information from the registers, I wrote an application. This application allows you to read or change the value of registers, calibrate the sensor, try to solve some problems. Also, to analyze the state of the sensor, you can use the Accelerometer Log program, free from Google Play: Accelerometer Log
Some users have problems with the sensor. Below I will describe the possible states of the sensor and methods for solving some problems. For the demonstration, I will provide screenshots and register values. The screenshots did this: I hold the tablet vertically, in portrait mode, I run Accelerometer Log with the default settings. I hold the tablet for 5 seconds, turn it 90 degrees clockwise. I hold another 5 seconds, turn it clockwise 90 degrees again. So I do until the tablet returns to its original position. I make a screenshot (at the same time I press the buttons vol- + power). So we can analyze the X and Y axes, in most cases this is enough. To analyze the Z axis - put the tablet on the table, wait 5 seconds, set it vertically, wait, put it on the table with the screen down, wait, put it upright, with the screen away, wait, put the table on the table to take a screenshot.
The sensor has a register 0x00 in which the Chip ID value is stored, according to the datasheet its value for our sensor should be 0x03, but as it turned out, not always. I will bind the states of the sensor to the value of this register.
Spoiler (+/-) (1. Register value 0x03)
The value as in datasheet is 0x03. Unfortunately, in my Aurora there is a sensor with a problem, so I will show a screenshot and registers with the Samsung Galaxy Nexus.
--- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
00: 03 32 c0 3b 00 03 80 f7 07 00 00 00 00 00 00 03
10: 08 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00
20: 05 00 09 30 81 0f c0 00 14 00 04 0a 18 08 08 10
30: 00 00 70 04 00 00 10 00 00 00 00 00 00 00 00 00
Reduced by 69%
720 x 1280 (39.85 KB)
In the register 0x00, the value is 0x03 and there are no problems with the sensor.
Spoiler (+/-) (2. Register value 0xf9)
I have a tablet Aurora II. When the tablet came, it worked fine, there were no problems, but after a while the auto-rotate of the screen stopped working. Moreover, in the Camera application - the icons are rotated as needed. I read the forum slatedroid (
http://www.slatedroid.com/topic/37448-solved-accelerometer-works-fine-but-screen-doesnt-rotate/LexaR user there it is me) and found users with the same problem.
--- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
00: f9 10 00 f8 c0 8c 80 07 1d 00 00 00 00 ff 81 00
10: 0c 80 00 00 00 ff 00 00 00 00 00 00 ff ff 00 ff
20: 05 00 09 30 81 0f c0 00 14 14 04 0a 18 48 08 11
30:00 ff 00 f4 00 00 00 00 00 00 00 00 00 ff 00 00
It is visible that in the register 0x00 value 0xf9, and there has to be 0x03
In Accelerometer log it looks like this:
Reduced by 61%
600 x 1024 (27.84 KB)
And here it is striking that if in a normal sensor the value along the axes changes + -g (when the tablet is at rest), then in the case of the “problem” tablet - + -2g. After some experiments, I found a solution. The sensor has a register 0x0f - through it the measurement range is set. By default, there is a value of 0x03, which corresponds to + -2g. The value 0x00 also corresponds to the range + -2g. If we add the value 0x05 to this register (which corresponds to the + -4g range), then everything returns to “normal” tablets and the auto rotate begins to work. Here is a screenshot when register 0x0f has value 0x05:
Reduced by 61%
600 x 1024 (25.71 KB)
Well, there is another version of the problem - when the axis “sticks”. Those. on one of the axis there is no change in value at all. If you look at the registers, the values ​​along the axes are shown in the registers 0x02-0x07. In the case of “sticking” the axis, we, when the tablet rotates in one of the registers, all the time we see the value 0x00 or 0xff. You can try several times to soft reset the tablet, recalibrate, reset the calibration. If this does not help, then only the replacement of the sensor will probably help. You can read here: Ainol NOVO 7 Aurora II / Elf II - Discussion, Ainol NOVO 7 Aurora II / Elf II - Discussion
Spoiler (+/-) (3. Register value 0xfa)
Treatment 0xfa here: Ainol NOVO 7 Aurora II / Elf II - Firmware (OS 4.0) (Post # 16866615)
There is another option in which the tablet does not see the sensor at all, but it exists and works. Here is an example of the register value:
--- 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
00: fa 10 31 69 21 88 01 80 00 00 00 00 00 ff 81 05
10: 0f 00 00 00 00 ff 00 00 00 00 00 00 ff ff 00 ff
20: 05 00 09 30 81 0f c0 00 14 14 04 0a 18 48 08 11
30:00 ff 00 c4 00 00 10 00 00 00 00 00 ff 00 b5
In this case, in register 0x00, the value is 0xfa. Why the system does not see the sensor? Let's look at the source. There is such a file: /common/customer/drivers/misc/bma250.c
Here is a piece of it:
Code
// line 48
#define BMA250_CHIP_ID 3
#define BMA250E_CHIP_ID 249
//...
// line 3524
if (tempvalue == BMA250_CHIP_ID || tempvalue == BMA250E_CHIP_ID) {
249 in decimal notation is 0xf9 in hexadecimal. It can be seen that for the option when ChipID == 0xf9 added a condition, if you add a condition to this line that ChipID == 250, the tablet will see the sensor. Unfortunately, I do not know how to compile the driver, so I can not fix it myself.
Spoiler (+/-) (4. About sensor calibration)
Now about the problem of calibration. Some users complain that in games “the car leads to the side” and in order to drive smoothly, you need to keep the tablet a little rotated. Well, similar situations. This is due to the fact that the sensor is not calibrated. Look, for example, on my second screenshot in p.2. It shows that when the tablet is standing vertically, the X and Y axes are offset from 0, and Z too. Our sensor has the ability to calibrate it. The registers 0x36, 0x37, 0x38-0x3d are responsible for this. Who cares - in the datasheet there are many and detailed. Who is not interested - I made in the program the ability to calibrate the sensor. This is how the Accelerometer Log looks after calibration:
Reduced by 61%
600 x 1024 (27.55 KB)
Here you can see that the X and Y axes are equal to 0 when the tablet is vertical.
To solve some problems, I wrote a program (I need root to function): BMA + Calibration.apk (199.05 KB) Downloads: 127
For solutions:
Spoiler (+/-) (1. If you have a problem with auto-rotate)
then click “Fix Auto Rotate”. Mark the item: “Correct at boot”. If, after some time, the auto-rotate stops working again (after a long sleep, the sensor values ​​are reset and the auto-rotate stops working), then also mark the item “Correct with each turn on the screen”. On slatedroid there were 2 cases when after a while the auto-rotate is “fixed” and starts working on its own, without the program. Why this happens - I do not know. But apparently somehow the sensor goes out of its emergency mode.
Spoiler (+/-) (2. Calibration)
Click the “Sensor Calibration” button. Place the tablet on a flat, horizontal surface, such as a floor or a window sill, and click the “Calibrate X and Y Axis” button. After that, put the tablet vertically, at 90 degrees. You can use a square, a book, a magazine, in order to put it vertically exactly, you can “by eye”. After that, click “Calibrate Z axis”. Everything. The sensor is calibrated. Try it in Accelerometer Log to see its graphs. If you want to reset the calibration to the original one, then for this there is a button on the main screen: ”Reset calibration”. The program calibrates the sensor to 0, you can calibrate the sensor to + -g on each of the axis, you can generally set the calibration parameters manually, but it's all in manual mode and on the datasheet. If it is very interesting - write to me, I will tell.
Spoiler (+/-) (3. Soft Reset)
reset the sensor to its original state. Calibration parameters are not reset, they must be reset separately.
4. To view the change of registers, there is an item in the “Values ​​of registers” MENU.
5. If it still doesn’t work or if you want more details - write to me in a personal or email (available in the program), and at the same time attach screenshots from Accelerometer Log using the method I described, the value of registers and a detailed description of the problem. I will try to help.
6. How to check the sensor without installing programs. Only performance when auto-rotate: working or not, you can still run the “Camera” - when you rotate the tablet 90 degrees - the icons should turn. But then how lucky, because Almost everyone, initially the tablet worked fine, the problem arose after a while.
7. Well and disclaimer: you use the program at your own peril and risk, I do not bear any responsibility for the results of its work.
The variable ro.sf.gsensorposition from build.prop is responsible for comparing the sensor readings with reference to the axes. Those. the sensor has readings on the x, y and z axes. But the sensor in different tablets can be soldered as you like: the axis corresponds, rotated by 180 degrees, 90, soldered on the back side of the board - and to bind the sensor axes to the axes of the tablet this variable serves. Variable values ​​can vary from 0 to 7. In our tablets, the default value is 2. Here is a description of the possible values:
0: xn = xd, yn = yd, zn = zd
1: yn = xd, xn = -yd, zn = zd
2: xn = -xd, yn = -yd, zn = zd
3: yn = -xd, xn = yd, zn = zd
4: xn = -xd, yn = yd, zn = -zd
5: yn = -xd, xn = -yd, zn = -zd
6: xn = xd, yn = -yd, zn = -zd
7: yn = xd, xn = yd, zn = -zd
Where:
xp - tablet acceleration relative to the x axis;
xd is the sensor acceleration relative to the x axis;