-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
drivers/imu: new Murata SCH16T IMU driver (#22914)
--------- Co-authored-by: alexklimaj <[email protected]>
- Loading branch information
1 parent
70304fe
commit e72ecdb
Showing
12 changed files
with
976 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
menu "Murata" | ||
rsource "*/Kconfig" | ||
endmenu #Murata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
############################################################################ | ||
# | ||
# Copyright (c) 2022 PX4 Development Team. All rights reserved. | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions | ||
# are met: | ||
# | ||
# 1. Redistributions of source code must retain the above copyright | ||
# notice, this list of conditions and the following disclaimer. | ||
# 2. Redistributions in binary form must reproduce the above copyright | ||
# notice, this list of conditions and the following disclaimer in | ||
# the documentation and/or other materials provided with the | ||
# distribution. | ||
# 3. Neither the name PX4 nor the names of its contributors may be | ||
# used to endorse or promote products derived from this software | ||
# without specific prior written permission. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | ||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | ||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
# POSSIBILITY OF SUCH DAMAGE. | ||
# | ||
############################################################################ | ||
|
||
px4_add_module( | ||
MODULE drivers__imu__murata__sch16t | ||
MAIN sch16t | ||
COMPILE_FLAGS | ||
SRCS | ||
SCH16T.cpp | ||
SCH16T.hpp | ||
sch16t_main.cpp | ||
Murata_SCH16T_registers.hpp | ||
DEPENDS | ||
drivers_accelerometer | ||
drivers_gyroscope | ||
px4_work_queue | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
menuconfig DRIVERS_IMU_MURATA_SCH16T | ||
bool "SCH16T" | ||
default n | ||
---help--- | ||
Enable support for murata SCH16T |
115 changes: 115 additions & 0 deletions
115
src/drivers/imu/murata/sch16t/Murata_SCH16T_registers.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
/**************************************************************************** | ||
* | ||
* Copyright (c) 2024 PX4 Development Team. All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in | ||
* the documentation and/or other materials provided with the | ||
* distribution. | ||
* 3. Neither the name PX4 nor the names of its contributors may be | ||
* used to endorse or promote products derived from this software | ||
* without specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | ||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | ||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | ||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
* | ||
****************************************************************************/ | ||
|
||
#pragma once | ||
|
||
#include <cstdint> | ||
|
||
namespace Murata_SCH16T | ||
{ | ||
static constexpr uint32_t SPI_SPEED = 5 * 1000 * 1000; // 5 MHz SPI serial interface | ||
static constexpr uint32_t SAMPLE_INTERVAL_US = 678; // 1500 Hz -- decimation factor 8, F_PRIM/16, 1.475 kHz | ||
static constexpr uint16_t EOI = (1 << 1); // End of Initialization | ||
static constexpr uint16_t EN_SENSOR = (1 << 0); // Enable RATE and ACC measurement | ||
static constexpr uint16_t DRY_DRV_EN = (1 << 5); // Enables Data ready function | ||
static constexpr uint16_t FILTER_BYPASS = (0b111); // Bypass filter | ||
static constexpr uint16_t RATE_300DPS_1475HZ = 0b0'001'001'011'011'011; // Gyro XYZ range 300 deg/s @ 1475Hz | ||
static constexpr uint16_t ACC12_8G_1475HZ = 0b0'001'001'011'011'011; // Acc XYZ range 8 G and 1475 update rate | ||
static constexpr uint16_t ACC3_26G = (0b000 << 0); | ||
static constexpr uint16_t SPI_SOFT_RESET = (0b1010); | ||
|
||
// Data registers | ||
#define RATE_X1 0x01 // 20 bit | ||
#define RATE_Y1 0x02 // 20 bit | ||
#define RATE_Z1 0x03 // 20 bit | ||
#define ACC_X1 0x04 // 20 bit | ||
#define ACC_Y1 0x05 // 20 bit | ||
#define ACC_Z1 0x06 // 20 bit | ||
#define ACC_X3 0x07 // 20 bit | ||
#define ACC_Y3 0x08 // 20 bit | ||
#define ACC_Z3 0x09 // 20 bit | ||
#define RATE_X2 0x0A // 20 bit | ||
#define RATE_Y2 0x0B // 20 bit | ||
#define RATE_Z2 0x0C // 20 bit | ||
#define ACC_X2 0x0D // 20 bit | ||
#define ACC_Y2 0x0E // 20 bit | ||
#define ACC_Z2 0x0F // 20 bit | ||
#define TEMP 0x10 // 16 bit | ||
// Status registers | ||
#define STAT_SUM 0x14 // 16 bit | ||
#define STAT_SUM_SAT 0x15 // 16 bit | ||
#define STAT_COM 0x16 // 16 bit | ||
#define STAT_RATE_COM 0x17 // 16 bit | ||
#define STAT_RATE_X 0x18 // 16 bit | ||
#define STAT_RATE_Y 0x19 // 16 bit | ||
#define STAT_RATE_Z 0x1A // 16 bit | ||
#define STAT_ACC_X 0x1B // 16 bit | ||
#define STAT_ACC_Y 0x1C // 16 bit | ||
#define STAT_ACC_Z 0x1D // 16 bit | ||
// Control registers | ||
#define CTRL_FILT_RATE 0x25 // 9 bit | ||
#define CTRL_FILT_ACC12 0x26 // 9 bit | ||
#define CTRL_FILT_ACC3 0x27 // 9 bit | ||
#define CTRL_RATE 0x28 // 15 bit | ||
#define CTRL_ACC12 0x29 // 15 bit | ||
#define CTRL_ACC3 0x2A // 3 bit | ||
#define CTRL_USER_IF 0x33 // 16 bit | ||
#define CTRL_ST 0x34 // 13 bit | ||
#define CTRL_MODE 0x35 // 4 bit | ||
#define CTRL_RESET 0x36 // 4 bit | ||
// Misc registers | ||
#define ASIC_ID 0x3B // 12 bit | ||
#define COMP_ID 0x3C // 16 bit | ||
#define SN_ID1 0x3D // 16 bit | ||
#define SN_ID2 0x3E // 16 bit | ||
#define SN_ID3 0x3F // 16 bit | ||
|
||
// STAT_SUM_SAT bits | ||
#define STAT_SUM_SAT_RSVD (1 << 15) | ||
#define STAT_SUM_SAT_RATE_X1 (1 << 14) | ||
#define STAT_SUM_SAT_RATE_Y1 (1 << 13) | ||
#define STAT_SUM_SAT_RATE_Z1 (1 << 12) | ||
#define STAT_SUM_SAT_ACC_X1 (1 << 11) | ||
#define STAT_SUM_SAT_ACC_Y1 (1 << 10) | ||
#define STAT_SUM_SAT_ACC_Z1 (1 << 9) | ||
#define STAT_SUM_SAT_ACC_X3 (1 << 8) | ||
#define STAT_SUM_SAT_ACC_Y3 (1 << 7) | ||
#define STAT_SUM_SAT_ACC_Z3 (1 << 6) | ||
#define STAT_SUM_SAT_RATE_X2 (1 << 5) | ||
#define STAT_SUM_SAT_RATE_Y2 (1 << 4) | ||
#define STAT_SUM_SAT_RATE_Z2 (1 << 3) | ||
#define STAT_SUM_SAT_ACC_X2 (1 << 2) | ||
#define STAT_SUM_SAT_ACC_Y2 (1 << 1) | ||
#define STAT_SUM_SAT_ACC_Z2 (1 << 0) | ||
|
||
} // namespace Murata_SCH16T |
Oops, something went wrong.