boards/esp32s3/lckfb-szpi: Add QMI8658 6-axis IMU sensor support
Build Documentation / build-html (push) Has been cancelled

Add support for the QMI8658 6-axis IMU sensor (accelerometer + gyroscope)
on the lckfb-szpi-esp32s3 board.

Changes:
- New esp32s3_qmi8658.c driver initializes sensor on I2C0 at address 0x6A
- Registers uORB devices: /dev/uorb/sensor_accel0 and /dev/uorb/sensor_gyro0
- Adds esp32s3_qmi8658_initialize() function declaration to header
- Integrates with board bringup when CONFIG_SENSORS_QMI8658=y

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This commit is contained in:
Huang Qi
2025-12-20 09:09:20 +08:00
committed by Xiang Xiao
parent 92f26a98dd
commit beb0a47568
6 changed files with 199 additions and 0 deletions
@@ -454,3 +454,35 @@ Then run the lvgldemo command::
[LVGL] [User] (6.560, +0) lv_nuttx_lcd_create: lcd /dev/lcd0 open success lv_nuttx_lcd.c:84
[LVGL] [Warn] (6.570, +10) lv_demo_widgets: LV_FONT_MONTSERRAT_18 is not enabled for the widgets demo. Using LV_FONT_DEFAULT instead. lv_demo_widgets.c:156
[LVGL] [Warn] (6.580, +10) lv_demo_widgets: LV_FONT_MONTSERRAT_12 is not enabled for the widgets demo. Using LV_FONT_DEFAULT instead. lv_demo_widgets.c:161
qmi8658
-------
Basic NuttShell configuration console and QMI8658 6-axis IMU sensor enabled.
The QMI8658 is a 6-axis IMU sensor that combines a 3-axis accelerometer and 3-axis gyroscope.
This configuration enables the sensor on I2C0 at address 0x6A and registers uORB devices:
- ``/dev/uorb/sensor_accel0`` for accelerometer data
- ``/dev/uorb/sensor_gyro0`` for gyroscope data
You can run the configuration and compilation procedure::
$ ./tools/configure.sh lckfb-szpi-esp32s3:qmi8658
$ make flash -j$(nproc) ESPTOOL_PORT=/dev/ttyUSB0
Then test the IMU sensor::
# Check available sensor devices
nsh> ls /dev/uorb/
/dev/uorb:
sensor_accel0
sensor_gyro0
nsh> uorb_listener
Monitor objects num:2
object_name:sensor_gyro, object_instance:0
object_name:sensor_accel, object_instance:0
sensor_gyro(now:113510000):timestamp:113510000,x:1.468750,y:1.562500,z:-0.093750,temperature:22.855469
sensor_accel(now:113510000):timestamp:113510000,x:-0.810913,y:0.027343,z:0.571167,temperature:22.855469
@@ -0,0 +1,58 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_ARCH_LEDS is not set
# CONFIG_NSH_ARGCAT is not set
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
CONFIG_ARCH="xtensa"
CONFIG_ARCH_BOARD="lckfb-szpi-esp32s3"
CONFIG_ARCH_BOARD_COMMON=y
CONFIG_ARCH_BOARD_ESP32S3_LCKFB_SZPI=y
CONFIG_ARCH_CHIP="esp32s3"
CONFIG_ARCH_CHIP_ESP32S3=y
CONFIG_ARCH_CHIP_ESP32S3WROOM1N16R8=y
CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARCH_XTENSA=y
CONFIG_BOARD_LOOPSPERMSEC=16717
CONFIG_BUILTIN=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DEBUG_UORB=y
CONFIG_ESP32S3_I2C0=y
CONFIG_ESP32S3_UART0=y
CONFIG_FS_PROCFS=y
CONFIG_HAVE_CXX=y
CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_IDLETHREAD_STACKSIZE=3072
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=3072
CONFIG_INTELHEX_BINARY=y
CONFIG_LINE_MAX=64
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=114688
CONFIG_RAM_START=0x20000000
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_HPWORK=y
CONFIG_SCHED_WAITPID=y
CONFIG_SENSORS=y
CONFIG_SENSORS_QMI8658=y
CONFIG_SENSORS_QMI8658_POLL=y
CONFIG_START_DAY=6
CONFIG_START_MONTH=12
CONFIG_START_YEAR=2011
CONFIG_SYSLOG_BUFFER=y
CONFIG_SYSTEM_NSH=y
CONFIG_UART0_SERIAL_CONSOLE=y
CONFIG_UORB=y
CONFIG_UORB_LISTENER=y
CONFIG_UORB_STACKSIZE=4096
CONFIG_USENSOR=y
@@ -52,3 +52,7 @@ endif
ifeq ($(CONFIG_INPUT_FT5X06),y)
CSRCS += esp32s3_ft5x06.c
endif
ifeq ($(CONFIG_SENSORS_QMI8658),y)
CSRCS += esp32s3_qmi8658.c
endif
@@ -46,6 +46,9 @@
#define FT5X06_I2C_ADDRESS (0x38)
#define FT5X06_FREQUENCY (400000)
#define QMI8658_I2C_PORT (0)
#define QMI8658_I2C_ADDR (0x6A)
/****************************************************************************
* Public Types
****************************************************************************/
@@ -156,5 +159,9 @@ int esp32s3_pca9557_initialize(void);
int esp32s3_ft5x06_initialize(void);
#endif
#ifdef CONFIG_SENSORS_QMI8658
int esp32s3_qmi8658_initialize(void);
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_XTENSA_ESP32S3_LCKFB_SZPI_ESP32S3_SRC_ESP32S3_DEVKIT_H */
@@ -113,6 +113,10 @@
# include "esp32s3_aes.h"
#endif
#ifdef CONFIG_SENSORS_QMI8658
# include <nuttx/sensors/qmi8658.h>
#endif
#ifdef CONFIG_ESP32S3_ADC
#include "esp32s3_board_adc.h"
#endif
@@ -306,6 +310,16 @@ int esp32s3_bringup(void)
}
#endif
#ifdef CONFIG_SENSORS_QMI8658
/* Register QMI8658 IMU sensor */
ret = esp32s3_qmi8658_initialize();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: Failed to register QMI8658 IMU: %d\n", ret);
}
#endif
#ifdef CONFIG_IOEXPANDER_PCA9557
ret = esp32s3_pca9557_initialize();
if (ret < 0)
@@ -0,0 +1,84 @@
/****************************************************************************
* boards/xtensa/esp32s3/lckfb-szpi-esp32s3/src/esp32s3_qmi8658.c
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <unistd.h>
#include <stdlib.h>
#include <debug.h>
#include <assert.h>
#include <nuttx/arch.h>
#include <nuttx/board.h>
#include <nuttx/sensors/qmi8658.h>
#include "esp32s3_i2c.h"
#include "esp32s3-szpi.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: esp32s3_qmi8658_initialize
*
* Description:
* Initialize and register the QMI8658 6-axis IMU sensor driver.
*
* This function registers the uORB interface which creates:
* - "/dev/uorb/sensor_accel0" for accelerometer data
* - "/dev/uorb/sensor_gyro0" for gyroscope data
*
* Input Parameters:
* None
*
* Returned Value:
* Zero (OK) on success; a negated errno value on failure.
*
****************************************************************************/
int esp32s3_qmi8658_initialize(void)
{
struct i2c_master_s *i2c;
int ret;
i2c = esp32s3_i2cbus_initialize(QMI8658_I2C_PORT);
if (!i2c)
{
i2cerr("Initialize I2C bus failed!\n");
return -EINVAL;
}
/* Register QMI8658 uORB sensor device */
ret = qmi8658_uorb_register(0, i2c, QMI8658_I2C_ADDR);
if (ret < 0)
{
syslog(LOG_ERR, "Failed to register QMI8658 uORB driver: %d\n",
ret);
}
return ret;
}