Commit Graph

83 Commits

Author SHA1 Message Date
Lorenz Meier e5834460e2 MPU6K: Add commandline option to set range, fix test command by resetting guard logic properly 2015-08-19 10:28:02 +02:00
Lorenz Meier c34a505576 MPU6K driver: Add delta angles / velocities including coning correction 2015-08-19 10:16:35 +02:00
Andrew Tridgell f77620c3f4 mpu6000: check WHOAMI register
this prevents a mpu9250 being seen as a mpu6000
2015-08-17 09:17:07 +02:00
Mark Charlebois a589d15c52 Refactored debug() and log() in CDev
These functions used vprintf which is not available on all platforms.
They also do not enable line and file debug output.

Changed to macros that preserve the output format.  Uses new macro that
can be used to implement per object, runtime selectable logging

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-08-11 12:07:06 -07:00
Lorenz Meier 7277d390c4 Merge branch 'beta' 2015-07-12 15:52:02 +02:00
Lorenz Meier 614c397762 MPU6K self-test: Be more forgiving on offset values 2015-07-11 22:08:36 +02:00
Mark Charlebois 1ca05aaa64 orb_advert_t changed to void * and checks changed to nullptr
The existing orb_advert_t use thoughout the code sometimes tries
to treat it as a file descriptor and there are checks for < 0
and ::close calls on orb_advert_t types which is an invalid use
of an object pointer, which is what orb_advert_t really is.

Initially I had changed the -1 initializations to 0 but it was
suggested that this should be nullptr. That was a good recommendation
but the definition of orb_advert_t had to change to void * because
you cannot initialize a uintptr_t as nullptr.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-05-27 14:42:49 -07:00
Mark Charlebois a734fc96d1 extensive orb_advert_t fixes
The calls to orb_advertise were being mishandled throughout the code.
There were ::close() calls on memory pointers, there were checks
against < 0 when it is a pointer to a object and values larger than
0x7ffffffff are valid. Some places orb_advert_t variables were
being initialized as 0 other places as -1.

The orb_advert_t type was changed to uintptr_t so the pointer value
would not be wrapped as a negative number. This was causing a failure
on ARM.

Tests for < 0 were changed to == 0 since a null pointer is the valid
representation for error, or uninitialized.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-05-27 14:41:33 -07:00
Ban Siesta 21dfd0243d drivers: use new ringbuffer namespace everywhere 2015-05-24 10:04:38 +01:00
Mark Charlebois 36f5d47ed9 Merge remote-tracking branch 'upstream/master' into linux
Signed-off-by: Mark Charlebois <charlebm@gmail.com>

Conflicts:
	src/modules/commander/gyro_calibration.cpp
	src/modules/mavlink/mavlink_ftp.cpp
2015-05-16 15:04:38 -07:00
Andrew Tridgell a710159263 mpu6000: sample at 200usec faster rate to avoid aliasing
this runs the mpu6000 200usec faster than requested then detects and
disccards duplicates by comparing accel values. This avoids a nasty
aliasing issue due to clock drift between the stm32 and mpu6000
2015-05-07 15:16:32 +10:00
Mark Charlebois 9758112e31 Use px4_config.h instead of nuttx/config.h
Modified code to use OS independent header file for config settings.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 10:55:41 -07:00
Lorenz Meier cb8e32f833 MPU6K: Temp support 2015-03-25 22:57:18 -07:00
Jonathan Challinger 89d5ae69d3 mpu6000: add set_accel_range 2015-03-25 22:02:05 -07:00
Andrew Tridgell 9442fc13e4 mpu6000: show temperature in "mpu6000 info" 2015-03-17 13:44:53 +11:00
Lorenz Meier 92a52ea195 MPU6000 driver: Rotate before applying offsets. 2015-03-15 17:26:11 +01:00
Lorenz Meier 2cf0aec332 MPU6K: Allow stop 2015-02-28 14:31:39 +01:00
Lorenz Meier 1eb4ec6ec9 MPU6K: Move to 0 based indices 2015-02-09 22:56:24 +01:00
Thomas Gubler 3e7faa6018 mpu6000: fix if style 2015-02-03 18:21:04 +01:00
Thomas Gubler a4961092af mpu6000: check for default sample rate
Also check if input variable is 0 and fix indentation
2015-02-03 18:13:01 +01:00
hauptmech 0b784c20c8 Save and check device id for acc and gyro calibration parameters.
Fix config utility to work with all devices of each type.
Accel, gyro and mag devices correctly set their device_id devtype.
Combo devices (mpu6000 lsm303d) now correctly return their devtype.
config util shows device id for all sensor types.
Add, save during calibration and check during preflight ID parameters for accelerometer and gyro
2015-01-31 15:53:34 +01:00
Lorenz Meier d851a630d8 Move all drivers to multi pub/sub API 2015-01-29 16:33:53 +01:00
Lorenz Meier 52f3fe1d9a Added more docs to offset as suggested by @velocoderaptor, thanks! 2015-01-26 20:23:42 +01:00
Lorenz Meier b8fade7dcf MPU6K: Improve gyro self test to allow more realistic deviations from nominal state 2015-01-26 20:04:56 +01:00
Johan Jansen 9c627255cc MPU6000: Increase gyro offset tolerance to 7 dps 2015-01-26 19:59:16 +01:00
Lorenz Meier 2bff39d562 MPU6K driver: Start performance counters for system latency, as its commonly the main sensor 2015-01-11 11:03:55 +01:00
Andrew Tridgell 82b9e08e4c mpu6000: removed unsafe printf in interrupt context
instead delay 3ms between register writes. This seems to give a quite
high probability of correctly resetting the sensor, and does still
reliably detect the sensor going bad, which is the most important
thing in this code
2015-01-01 08:51:57 +11:00
Andrew Tridgell 4a81384b2d mpu6000: make register fixup much closer to a reset()
this may help automatic reset on the faulty boards
2014-12-30 20:55:57 +01:00
Andrew Tridgell e537de20e3 mpu6000: wait for 10ms after a full reset
this prevents the mpu6000 getting in a really weird state!
2014-12-30 20:55:57 +01:00
Andrew Tridgell 333039d3db mpu6000: added "mpu6000 testerror" command
used to generate a error case for reset testing
2014-12-30 20:55:57 +01:00
Andrew Tridgell b157466608 mpu6000: monitor some more registers 2014-12-30 20:55:57 +01:00
Andrew Tridgell e5d3c80686 mpu6000: added factory self-test function
this follows the factory calibration self-test method in the datasheet
to see if the sensor still has the same calibration it had in the factory
2014-12-30 20:55:57 +01:00
Andrew Tridgell ae3a92569d mpu6000: try resetting the mpu6000 up to 5 times
this mirrors the ardupilot driver. We have seen situations where the
mpu6000 on the Pixhawk comes up in SLEEP mode, despite a reset
2014-12-30 20:55:57 +01:00
Andrew Tridgell 3e06a65516 mpu6000: monitor some key registers for correct values
this will catch both bad SPI bus comms and a sensor that has been
reset causing incorrect configuration.
2014-12-30 20:55:57 +01:00
Grant Morphett 1910b7e88b MPU6000: Add regdump command
Add mpu6000 regdump command for debugging mpu6000.
2014-12-21 14:59:47 +01:00
Andrew Tridgell c396a67746 mpu6000: added logging of good transfers
this helps tracking down a startup issue
2014-10-30 08:47:03 +11:00
Lorenz Meier 8ced6bb49b Set filter frequency for hardware and software in parallel, always do so in the same order 2014-09-30 10:05:39 +02:00
Randy Mackay 3e1eec5906 mpu6k: set hardware filter during ACCELIOCLOWPASS
also set from GYROIOCLOWPASS

Conflicts:
	mavlink/include/mavlink/v1.0
2014-09-30 10:03:15 +02:00
Lorenz Meier c5e4f33bb3 Merge sensor_startup_cleanup 2014-07-16 15:26:22 +02:00
Lorenz Meier 164b4ef4ce MPU6K: Cleaner init 2014-07-16 08:58:18 +02:00
Lorenz Meier 5b38b5e371 MPU6K: Start handler startup and stack review and adjustments 2014-07-16 07:55:53 +02:00
Lorenz Meier 32ed1eae80 mpu6000: Support for up to three accels / gyros 2014-07-15 23:14:50 +02:00
Lorenz Meier e696ed5509 Merged master 2014-07-15 22:07:03 +02:00
Andrew Tridgell 8a3a87331d mpu6000: fixed internal/external mixup in pointers
Thanks to Emile for spotting this!

Conflicts:
	mavlink/include/mavlink/v1.0
2014-07-12 16:27:39 +02:00
Lorenz Meier 875be65242 MPU6000: Fix usage function call to fit existing structure. 2014-07-08 13:52:28 +02:00
Andrew Tridgell c681d6621d mpu6000: added -R rotation option 2014-07-08 11:46:47 +02:00
Andrew Tridgell 19dbbf17e8 mpu6000: allow for two mpu6000 instances, one internal, one external
split g_dev into g_dev_int and g_dev_ext
2014-07-08 11:44:58 +02:00
Andrew Tridgell 541dc1825c mpu6000: added -X option for external bus 2014-07-08 11:44:22 +02:00
Andrew Tridgell ef79d03276 mpu6000: allow disabling of on-sensor low pass filter
used for vibration testing
2014-07-08 11:40:54 +02:00
Lorenz Meier 73d4d6faec MPU6K: Use usleep where usleep should be used instead of up_udelay() 2014-06-22 16:49:52 +02:00