Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shields: Add support for M5Stack mbus connector and core2 base shield #62315

Merged
merged 4 commits into from
Oct 25, 2023

Conversation

MrMarteng
Copy link
Collaborator

@MrMarteng MrMarteng commented Sep 5, 2023

M5Stack base and core2 modules support an extension connector. This PR adds support for this connector.

It also includes support for the m5stack_core2 base shield, which features a MPU6886 6-axis motion tracker and a SPM1423
microphone.

@MrMarteng
Copy link
Collaborator Author

@kartben I started to prepare support for the m5stack connector. Maybe you find some time to have a look at it. I am happy for feedback.

@MrMarteng MrMarteng force-pushed the m5stack_connector branch 4 times, most recently from da568d1 to ef607c4 Compare September 6, 2023 19:04
@MrMarteng
Copy link
Collaborator Author

@kartben What's your preferred name for the extension header? Currently it's name m5stack_header. I also thought about mbus_header but mbus is also used by other brands.

@MrMarteng MrMarteng changed the title shield: Support for M5Stack-Core2 connector and base shield shields: Add support for M5Stack-Core2 connector and base shield Sep 9, 2023
@MrMarteng
Copy link
Collaborator Author

@kartben What's your preferred name for the extension header? Currently it's name m5stack_header. I also thought about mbus_header but mbus is also used by other brands.

I named the header m5stack,mbus-header. The shield that comes with m5stack is named m5stack_core2_base.

@MrMarteng MrMarteng force-pushed the m5stack_connector branch 2 times, most recently from 7326eb5 to a398134 Compare September 10, 2023 19:23
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 ~/Downloads > optimizt m5stack_core2_ext.jpg
ℹ Optimizing 1 image (lossy)...
✔ m5stack_core2_ext.jpg 
   102.912 KB → 55.072 KB. Ratio: 46%

ℹ Yay! You saved 47.84 KB (46%)

@MrMarteng MrMarteng force-pushed the m5stack_connector branch 4 times, most recently from 2d0ab8c to 944b4de Compare September 14, 2023 20:12
@MrMarteng MrMarteng marked this pull request as ready for review September 15, 2023 05:22
@zephyrbot zephyrbot added area: Shields Shields (add-on boards) area: Devicetree Binding PR modifies or adds a Device Tree binding area: Sensors Sensors labels Sep 15, 2023
Martin Kiepfer added 2 commits October 3, 2023 11:34
This commit adds basic support for the mbus connection port to
m5stack_core2 board.

Signed-off-by: Martin Kiepfer <m.kiepfer@teleschirm.org>
This commit adds support for mpu6886, which has compatible register
layout.

Signed-off-by: Martin Kiepfer <m.kiepfer@teleschirm.org>
Copy link
Collaborator

@kartben kartben left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't seem to be able to run the mpu6050 demo?

*** Booting Zephyr OS build v3.5.0-rc1-49-gc060ec527fa1 ***
Device mbus_mpu6886@68 is not ready

description: |
GPIO pins exposed on M5Stack M-Bus headers.


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra blank line

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

# Copyright (c) 2023 Martin Kiepfer <mrmarteng@teleschirm.org>
# SPDX-License-Identifier: Apache-2.0

config M5STACK_CORE2_EXT
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
config M5STACK_CORE2_EXT
config SHIELD_M5STACK_CORE2_EXT

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

For example:

.. zephyr-app-commands::
:zephyr-app: samples/drivers/mpu6050
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
:zephyr-app: samples/drivers/mpu6050
:zephyr-app: samples/sensor/mpu6050

@kartben
Copy link
Collaborator

kartben commented Oct 3, 2023

I can't seem to be able to run the mpu6050 demo?

*** Booting Zephyr OS build v3.5.0-rc1-49-gc060ec527fa1 ***
Device mbus_mpu6886@68 is not ready

I am suspecting issues with the AXP192, I see different behaviors /errors with cold boot vs. soft reset

@kartben
Copy link
Collaborator

kartben commented Oct 3, 2023

Also, MPU6050 seemed pretty broken? See #63446

@MrMarteng
Copy link
Collaborator Author

I can't seem to be able to run the mpu6050 demo?

*** Booting Zephyr OS build v3.5.0-rc1-49-gc060ec527fa1 ***
Device mbus_mpu6886@68 is not ready

I am suspecting issues with the AXP192, I see different behaviors /errors with cold boot vs. soft reset

I cannot reproduce it yet

uart:~$ *** Booting Zephyr OS build zephyr-v3.4.0-4871-g9a969754e08d ***
Hello World! m5stack_core2
device list
devices:
- rtc@3ff48000 (READY)
- gpio@3ff44800 (READY)
- gpio@3ff44000 (READY)
- trng@3ff75144 (READY)
- uart@3ff40000 (READY)
- i2c@3ff53000 (READY)
- axp192@34 (READY)
- LDO3 (READY)
- LDO2 (READY)
- DCDC3 (READY)
- DCDC1 (READY)
- axp192_gpio (READY)
- ft5336@38 (READY)
- mbus_mpu6886@68 (READY)
uart:~$ sensor get mbus_mpu6886@68
channel idx=3 accel_xyz shift=4 value=25589900000ns, (0.148439, -0.272939, 10.606312)
channel idx=7 gyro_xyz shift=4 value=25589900000ns, (-0.120307, -0.263131, 0.298436)
uart:~$ sensor get mbus_mpu6886@68
channel idx=3 accel_xyz shift=4 value=27917600000ns, (0.047883, 8.683768, 3.193864)
channel idx=7 gyro_xyz shift=4 value=27917600000ns, (0.363853, -0.402757, 0.528260)
uart:~$ sensor get mbus_mpu6886@68
channel idx=3 accel_xyz shift=4 value=29257400000ns, (9.732428, -0.773328, 1.125273)
channel idx=7 gyro_xyz shift=4 value=29257400000ns, (-0.208640, -0.151350, 0.263796)

It doesn't make a difference on soft/hard reboot

Can you please check the priorities of CONFIG_REGULATOR_AXP192_INIT_PRIORITY, CONFIG_I2C_INIT_PRIORITY and CONFIG_SENSOR_INIT_PRIORITY. My default configuration is:

#define CONFIG_REGULATOR_AXP192_INIT_PRIORITY 76
#define CONFIG_GPIO_AXP192_INIT_PRIORITY 80
#define CONFIG_GPIO_HOGS_INIT_PRIORITY 81
#define CONFIG_I2C_INIT_PRIORITY 50
#define CONFIG_SENSOR_INIT_PRIORITY 90

Which project did you use for testing?

@kartben
Copy link
Collaborator

kartben commented Oct 3, 2023

Which project did you use for testing?

It might have been my fault, sorry. I was testing against #63375, looks like it requires a slightly larger task than 2KB when running on the Core2. Works now :)

@MrMarteng
Copy link
Collaborator Author

Which project did you use for testing?

It might have been my fault, sorry. I was testing against #63375, looks like it requires a slightly larger task than 2KB when running on the Core2. Works now :)

Yes, I noticed this as well and increased the default stack size for m5stack in #62507 :-/

Copy link
Collaborator

@kartben kartben left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat! See my comments as well as earlier comments from today.

********

M5Stack-Core2 comes with a base shield that is connected to the M5Stack
extension connector. It features a MPU6886 6-axis motion tracker and a SPM1423
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
extension connector. It features a MPU6886 6-axis motion tracker and a SPM1423
extension connector. It features an MPU6886 6-axis motion tracker and a SPM1423

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment on lines 47 to 56
References
**********

.. target-notes::

.. _datasheet:
https://docs.m5stack.com/en/core/core2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drop unless you actually have links/footnotes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

kartben
kartben previously approved these changes Oct 3, 2023
@@ -74,6 +74,7 @@ of the M5Stack Core2 board.
+------------------+--------------------------------------------------------------------------+
|| 3-axis || The `MPU-6886`_ is a 6-axis MotionTracking device that combines a |
|| gyrosopce || 3-axis gyroscope and a 3-axis accelerometer. |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well... now that you mention it ... :D

Suggested change
|| gyrosopce || 3-axis gyroscope and a 3-axis accelerometer. |
|| gyroscope || 3-axis gyroscope and a 3-axis accelerometer. |

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, this is not even the correct description anyway -- should say something like "6 DOF IMU" or something?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not an expert on these sensors.I reworked the used terms in both documents (m5stack_core2 and m5stack_core2_ext).

@MrMarteng MrMarteng force-pushed the m5stack_connector branch 2 times, most recently from 60af507 to 9f6ff57 Compare October 3, 2023 19:18
M5Stack-Core2 comes with a base shield that is connected to the M5Stack
extention connector. It features a MPU6886 6-axis motion tracker
and a SPM1423 microphone.

Signed-off-by: Martin Kiepfer <m.kiepfer@teleschirm.org>
@MrMarteng
Copy link
Collaborator Author

further comments?

@fabiobaltieri fabiobaltieri added this to the v3.6.0 milestone Oct 6, 2023
@carlescufi
Copy link
Member

@erwango ping

@carlescufi carlescufi merged commit 82b1df2 into zephyrproject-rtos:main Oct 25, 2023
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Devicetree Binding PR modifies or adds a Device Tree binding area: Sensors Sensors area: Shields Shields (add-on boards)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants