This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 74815e91cacc912900aaa601e00b750a81494bb0 Author: ViezeVingertjes <[email protected]> AuthorDate: Wed Nov 25 17:47:13 2026 +0100 boards/esp32s3-touch-amoled-216: Add QMI8658 IMU support. Register the on-board QMI8658 6-axis IMU (I2C0, address 0x6B) through the common ESP32-S3 QMI8658 board helper, which exposes it as the uORB topics sensor_accel0 and sensor_gyro0. Add a qmi8658 configuration with uorb_listener and document it. Tested on hardware with uorb_listener: accelerometer reads ~1 g on Z with the board flat, gyroscope and temperature report sane values. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: ViezeVingertjes <[email protected]> --- .../boards/esp32s3-touch-amoled-216/index.rst | 19 +++++++ .../configs/qmi8658/defconfig | 65 ++++++++++++++++++++++ .../esp32s3-touch-amoled-216/include/board.h | 7 +++ .../src/esp32s3-touch-amoled-216.h | 15 +++++ .../esp32s3-touch-amoled-216/src/esp32s3_bringup.c | 10 ++++ 5 files changed, 116 insertions(+) diff --git a/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-touch-amoled-216/index.rst b/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-touch-amoled-216/index.rst index 1da86f69b59..83948b1a71f 100644 --- a/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-touch-amoled-216/index.rst +++ b/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-touch-amoled-216/index.rst @@ -171,6 +171,25 @@ nsh Basic NuttShell configuration (console enabled on the USB Serial/JTAG controller). +qmi8658 +------- + +This configuration registers the QMI8658 6-axis IMU through the uORB +sensor framework, as ``/dev/uorb/sensor_accel0`` and +``/dev/uorb/sensor_gyro0``. The ``uorb_listener`` application can be used +to read it. With the board lying flat, the Z axis of the accelerometer +reads about 1 g:: + + nsh> uorb_listener -n 3 sensor_accel0 + + Monitor objects num:1 + object_name:sensor_accel, object_instance:0 + sensor_accel(now:6650000):timestamp:6650000,x:0.024414,y:0.012695,z:0.995728,temperature:35.105469 + sensor_accel(now:7660000):timestamp:7660000,x:0.021851,y:0.016724,z:0.998169,temperature:35.089844 + sensor_accel(now:8670000):timestamp:8670000,x:0.022583,y:0.017944,z:0.998291,temperature:35.062500 + Object name:sensor_accel0, received:3 + Total number of received Message:3/3 + psram ----- diff --git a/boards/xtensa/esp32s3/esp32s3-touch-amoled-216/configs/qmi8658/defconfig b/boards/xtensa/esp32s3/esp32s3-touch-amoled-216/configs/qmi8658/defconfig new file mode 100644 index 00000000000..6be7234288f --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-touch-amoled-216/configs/qmi8658/defconfig @@ -0,0 +1,65 @@ +# +# 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="xtensa" +CONFIG_ARCH_BOARD="esp32s3-touch-amoled-216" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ESP32S3_TOUCH_AMOLED_216=y +CONFIG_ARCH_CHIP="esp32s3" +CONFIG_ARCH_CHIP_ESP32S3=y +CONFIG_ARCH_CHIP_ESP32S3WROOM1N16R8=y +CONFIG_ARCH_INTERRUPTSTACK=2048 +CONFIG_ARCH_IRQ_TO_NDX=y +CONFIG_ARCH_MINIMAL_VECTORTABLE_DYNAMIC=y +CONFIG_ARCH_NUSER_INTERRUPTS=2 +CONFIG_ARCH_STACKDUMP=y +CONFIG_ARCH_XTENSA=y +CONFIG_BOARD_LOOPSPERMSEC=16717 +CONFIG_BUILTIN=y +CONFIG_DEBUG_FULLOPT=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_ESP32S3_I2C0=y +CONFIG_ESP32S3_I2C0_SCLPIN=14 +CONFIG_ESP32S3_I2C0_SDAPIN=15 +CONFIG_ESP32S3_USBSERIAL=y +CONFIG_ETC_ROMFS=y +CONFIG_EXPERIMENTAL=y +CONFIG_FS_PROCFS=y +CONFIG_FS_ROMFS=y +CONFIG_HAVE_CXX=y +CONFIG_HAVE_CXXINITIALIZE=y +CONFIG_I2C_DRIVER=y +CONFIG_IDLETHREAD_STACKSIZE=3072 +CONFIG_INIT_ENTRYPOINT="init_main" +CONFIG_INIT_STACKSIZE=8192 +CONFIG_INTELHEX_BINARY=y +CONFIG_LIBC_EXECFUNCS=y +CONFIG_LINE_MAX=64 +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_CHILD_STATUS=y +CONFIG_SCHED_HAVE_PARENT=y +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_SYSTEM_NSH_STACKSIZE=8192 +CONFIG_SYSTEM_NXINIT=y +CONFIG_UORB=y +CONFIG_UORB_LISTENER=y +CONFIG_USENSOR=y diff --git a/boards/xtensa/esp32s3/esp32s3-touch-amoled-216/include/board.h b/boards/xtensa/esp32s3/esp32s3-touch-amoled-216/include/board.h index 4e052cce6c5..2e32ec5d3c0 100644 --- a/boards/xtensa/esp32s3/esp32s3-touch-amoled-216/include/board.h +++ b/boards/xtensa/esp32s3/esp32s3-touch-amoled-216/include/board.h @@ -66,4 +66,11 @@ #define BUTTON_IO18_BIT (1 << BUTTON_IO18) #define BUTTON_PWR_BIT (1 << BUTTON_PWR) +/* QMI8658 IMU **************************************************************/ + +/* The QMI8658 sits on the shared I2C0 bus with SA0 tied low (0x6B) */ + +#define QMI8658_I2C_PORT 0 +#define QMI8658_I2C_ADDR 0x6b + #endif /* __BOARDS_XTENSA_ESP32S3_ESP32S3_TOUCH_AMOLED_216_INCLUDE_BOARD_H */ diff --git a/boards/xtensa/esp32s3/esp32s3-touch-amoled-216/src/esp32s3-touch-amoled-216.h b/boards/xtensa/esp32s3/esp32s3-touch-amoled-216/src/esp32s3-touch-amoled-216.h index 5b96a8e69d6..cfeed3555ed 100644 --- a/boards/xtensa/esp32s3/esp32s3-touch-amoled-216/src/esp32s3-touch-amoled-216.h +++ b/boards/xtensa/esp32s3/esp32s3-touch-amoled-216/src/esp32s3-touch-amoled-216.h @@ -143,5 +143,20 @@ int board_i2c_init(void); int board_spiflash_init(void); #endif +/**************************************************************************** + * Name: esp32s3_qmi8658_initialize + * + * Description: + * Initialize and register the QMI8658 6-axis IMU uORB driver. + * + * Returned Value: + * Zero (OK) on success; a negated errno value on failure. + * + ****************************************************************************/ + +#ifdef CONFIG_SENSORS_QMI8658 +int esp32s3_qmi8658_initialize(void); +#endif + #endif /* __ASSEMBLY__ */ #endif /* __BOARDS_XTENSA_ESP32S3_ESP32S3_TOUCH_AMOLED_216_SRC_ESP32S3_TOUCH_AMOLED_216_H */ diff --git a/boards/xtensa/esp32s3/esp32s3-touch-amoled-216/src/esp32s3_bringup.c b/boards/xtensa/esp32s3/esp32s3-touch-amoled-216/src/esp32s3_bringup.c index 4f36ce7ddf4..77027807c71 100644 --- a/boards/xtensa/esp32s3/esp32s3-touch-amoled-216/src/esp32s3_bringup.c +++ b/boards/xtensa/esp32s3/esp32s3-touch-amoled-216/src/esp32s3_bringup.c @@ -188,6 +188,16 @@ int esp32s3_bringup(void) } #endif +#ifdef CONFIG_SENSORS_QMI8658 + /* Register the QMI8658 IMU as uORB accelerometer and gyroscope */ + + ret = esp32s3_qmi8658_initialize(); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: Failed to initialize QMI8658: %d\n", ret); + } +#endif + #ifdef CONFIG_INPUT_BUTTONS /* Register the BOOT, IO18 and PWR keys as /dev/buttons */
