Geomagnetic drive and algorithm process

Source: Internet
Author: User

----------------take the chip self-test data and do Fangdai processing in Factory mode detection-----------

The chip has the self-test procedure, the driver inside should have a node, calls the self-test program, returns the self-test program result. Testing of each device in the factory, self-test of the device is done first
. Then do the other, first determine the chip has no problem. With this fangdai.

---------------the initial commissioning of the board, first determine if there is no hall device-----------

Hall device response to the magnetic field lines, can be re-straight, can be horizontal.
The position of the magnet on the flap should be marked with the mapping point of Hall on the flap, and the precise position should be determined according to the Magnet magnetic field line distribution.
Magnet North-South Pole, vertical distribution, but also the positive and negative distribution.
A tool that has a special magnetic field strength. The display is in Gauss units.
North-South Polar vertical distribution of the magnet, imagine the distribution of magnetic lines, measured, is also the largest value of n s pole measured.
The magnets on the front and back are relatively large at the edges.
From the test, the magnetic field strength on the magnet is uneven distribution, very uneven.
Hall anti-hibernation. Flap folded to the back of the phone, due to the small dislocation, magnetic field lines will also be back Chuan the hall device, resulting in a black screen phone. If you use the positive and negative magnetic
Iron, magnets are too strong, prone to anti-sleep.
If the magnet is vertically distributed in the north and South Pole, then the magnetic field lines traverse the hall device horizontally, and the anti-hibernation problem can be produced. In fact, flip turn 360 degrees, back to the position of 0 degrees, is the original position. Just put it on the back of the phone, farther away from the hall device. The problem of the face, the reverse is likely to appear, but away from
The hall device is a little farther away.


The compass has an impact, only because at the beginning of the commissioning, Hall device debugging, did not put it and geomagnetic sensor device, design distance too close, because there is no flap, start
Without paying attention to this matter. Therefore, in the initial phase of the commissioning of geomagnetic, there is no hall device, if so, must be required hardware ornaments as far as possible.
The cm620 is placed on the small board. So that there will be no subsequent problems, from the source of the elimination of this problem
Now that it has been affected, it depends on how big the impact is. There is said flap fixed in the back, calibrated well, can not be changed, and some said flap to keep parallel with the mobile phone into the
Line calibration, there is said if not allowed, the level of 180 degrees will prevail. The essential reasons behind these phenomena are:
Compass Calibration, the magnetic field environment can not change, if the flap will be 360 degrees, one will be 180 degrees, the equivalent of calibration, in the back of the phone fixed a large magnet, school
After the good, look, take this magnet down, and then put on the phone to the left 3limi position. The compass algorithm is not able to cope with such spatial magnetic field changes.
. This environment has changed beyond the compass algorithm's scope. Inability to deal with such things.

--------------Compass algorithm enters the calibration state at more than 70ut-----------

The magnetic field strength has two kinds of units, one is Gauss, one is Tesla (that is T), one Gauss equals to Miut. The Earth's magnetic field is in positive and negative miut, and the Bosch nine-axis fusion algorithm enters the calibration state by 4 Miut interference.
There are tools that specifically measure the strength of the magnetic field.
The intensity of the magnetic field decays very quickly with distance.
Near an Li meter, attenuation hundreds of Gauss.

--------------------

Usage experience: Simulated navigation using the scene, with a slight

Raw DATA: The three data reported by geomagnetic sensor are the magnetic components in the x, Y, z three axes of the magnetic field. An axis of data, stored by two registers, a register of 8 bits, so the sensor data range 0 to 65535. Magnetic field strength has positive and negative points, the magnetic line along the axis is positive. The positive and negative realization, to 65535 half, namely the 32767来 demarcation. Greater than 32767, is positive.  The geomagnetic algorithm first cuts the sensor data by 32767 and then converts it to a Gaussian unit. SENSOR_LIST.APK saw the Mag field This sensor is this data.

Hard magnetic Soft Magnetic calibration: There are soft magnetic interference and hard magnetic interference on the mobile phone. Hard magnetic interference causes the magnetic field lines to shift in the whole, and the disturbance itself carries the magnetism material, such as magnets. The motor on the board, the horn all belong to the hard magnetic. Soft magnetic interference causes the magnetic field lines to deform, and the magnetic lines will go around, and the interfering material itself is not magnetic, such as iron. If the screws on the board belong to the soft magnetic. In order to put the hard magnetic on the phone, soft magnetic school off. It is necessary to collect geomagnetic data. Collection of methods, each one not quite the same. The new approach is to first find an environment without magnetic interference, and use the mechanical compass to determine the north direction. Then put the phone on the horizontal plane in eight directions, each direction on the opposite side of the place. Data for a total of 16 locations. These data collection is good, passed to the specific software tool processing. Get a set of parameters.  This parameter is placed in the geomagnetic algorithm library. The geomagnetic algorithm library creates a ball model that, without these calibration data, may be an ellipsoid, and the geomagnetic algorithm library will squeeze the ellipsoid into a ball based on the calibration data.

The geomagnetic algorithm process maps the cell phone to a face in the ball, and when the phone rotates, the ball is constant, changing the face of the map. In this way, you can get the direction angle of the phone (the corner centered on the z-axis), Roll the corner (the corner centered on the y-axis), and the pitch angle (the corner centered on the x-axis). Aircraft navigation requires these three angles.

Interference: In the mobile phone in a disturbed environment, if there is hard magnetic interference, the spherical sphere will deviate from the origin, 8-word calibration is to pull the globe to the origin of the point. In the case of soft magnetic interference, the shape of the ball changes, 8-word calibration is to the non-ball part of the ball.

Acceleration to the geomagnetic algorithm compensation: If the acceleration changes, the compass jitter, if the acceleration value is not correct, geomagnetic deviation becomes larger, acceleration if more than 10 points, it must be calibrated, so the geomagnetic before calibration, must first calibrate the acceleration.

Coordinate system mapping: the geomagnetic chip is placed on the front of the motherboard in four directions, east, south, west, and north. On the opposite side of the team there are four directions, altogether 8. Map the chip coordinate system to the cell phone coordinate system (the origin of the cell phone coordinate system is in the lower left corner). U.S. New left-handed coordinate system, Android phone default with the right-hand coordinate system, the United States new algorithm process to the left hand to the right hand, with Bosch. The direction of the CUST_MAG.C represents the mapping of the coordinate system. If this mapping is wrong, the x-axis of the chip may be mapped to the y-axis or other axes of the Android phone, and the compass will have an error in the direction angle. Encountered the W3 machine is 90 degrees worse than the situation. The rotation vector test game was biased in every direction. Orientaion, who tried to change to Bosch, found that the deviation was more than 90 degrees. After the FAE hint, changed the mapping method, the solution.

Although the sensor chip is beautiful, the compass direction angle orientaion can also be given to Bosch to calculate. One of the benefits of the Bosch calculation is that if there is a magnetic field disturbance when the phone is stationary, the compass can be fixed, that is, anti-jamming capability.

-------------------


The code is some log in the official version does not need to appear, it is best to use the log package up.


Sensor_list data is abnormal, the algorithm process writes the calculated data to the driver, the upper application reads the data from the driver.
This data is then extracted from the drive O function. The drive is equivalent to a relay. But from the algorithm process log, the number passed in

It's all right. But from the drive log, the data to the upper layer is abnormal. When debugging the driver, the debug log macro will be opened

, can add to judge this macro to open the log, with the switch macro wrapped log can provide important clues. Some are not themselves.

Can think of, be sure to put the debug macro open. In solving the compass data is very big problem, is the macro-wrapped log

See the clue. From log, the driver's log can show the upper process that triggered the action. The log that appears to be an exception is

Gyro algorithm process, the hardware does not have a gyroscope, this process is not supposed to have the process to end, the problem is solved

The

-----------------------------suspend, resume power is not init------------

The client parameter passed from Bmg_resume (client), or I2c_resume, is not available. To use the global I²c client.
Only a properly available client can use the I²C communication.

For sensor, the suspend usually has a power-down action. There is a power-up action in the resume.

Bosch has a init action on the chip in the resume. Yamahs geomagnetic, AKM geomagnetic has no init action in the resume.

Later, Bosch confirmed that once the chip was INIT, it would not have to be init again after it was power-up again. The resume can be used without the init action.

--------------

AKM geomagnetic, user version, the first I²C communication, read chip, check chip error, because the user version of a lot of log no, the lack of delay, AKM is not ready to read the chip ID. The result is an error. Before reading the chip ID, Mdelay (5) adds a 5hao second delay.  That is, after the Reset action, add 5 millisecond delay before reading the chip. The problem is solved.

Geomagnetic drive and algorithm process

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.