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

feat(motion): initial validation of icm40627 motion sensor #152

Draft
wants to merge 34 commits into
base: fouge/zephyr-4.0.0
Choose a base branch
from

Conversation

fouge
Copy link
Collaborator

@fouge fouge commented Jan 16, 2025

initialize icm40627 sensor by resetting it and checking the WHO_AM_I register.

the driver is based on the icm42670 present in the zephyr repository with a few changes: SPI -> I2C, changed WHO_AM_I response, added 1 int-gpios (still unused).
this driver is kept locally for now (no attempt to bring it upstream) as it is still experimental and hasn't been tested.

Accelerometer values can be read and values are responding to motion, but resolution might be wrong though (in m/s2):

<inf> motion: Accel data for X: 1.606509 Y: 0.836773 Z: -3.-578134

fixes ORBP-600

fouge added 30 commits January 15, 2025 11:30
update revision in west

Signed-off-by: Cyril Fougeray <[email protected]>
make CMake successfully load

Signed-off-by: Cyril Fougeray <[email protected]>
app is building
still many changes to be made

Signed-off-by: Cyril Fougeray <[email protected]>
with deferred initialization, we can now initialize
devices at runtime.
I2C1 is one that should be postponed until after
the power supplies are initialized and turned on.

Signed-off-by: Cyril Fougeray <[email protected]>
support will be provided when needed

Signed-off-by: Cyril Fougeray <[email protected]>
signature changed, now passing pointer, instead of pointer of pointer.

Signed-off-by: Cyril Fougeray <[email protected]>
for main battery

Signed-off-by: Cyril Fougeray <[email protected]>
global CSTD property is deprecated with zephyr 3.7.0.

Signed-off-by: Cyril Fougeray <[email protected]>
ZTEST_NEW_API not a config anymore
test config not tested though

Signed-off-by: Cyril Fougeray <[email protected]>
taken from mcuboot example
to be extensively tested

Signed-off-by: Cyril Fougeray <[email protected]>
instead of relying on hardcoded values

Signed-off-by: Cyril Fougeray <[email protected]>
redefine M_PI
BUILD_ASSERT must be used instead of static_assert

Signed-off-by: Cyril Fougeray <[email protected]>
before trying to use it
in our case, the GPIO port is a GPIO expander so it must
be ready.

Signed-off-by: Cyril Fougeray <[email protected]>
the GPIO API to configure and read a pin returns error codes that
weren't checked.
Ensure all operations are successful to obtain the pcba version for
main, front and power boards.

Signed-off-by: Cyril Fougeray <[email protected]>
was enabled as long as `watchdog0` was an existing label.
now, kconfig has to be enabled

Signed-off-by: Cyril Fougeray <[email protected]>
use sys_init to initialize watchdog
callback cannot be set dynamically anymore, but weakly defined instead
so that it can be overridden by user at compile time.

Signed-off-by: Cyril Fougeray <[email protected]>
to build orb-messages as library, added/linked into target from library
itself

use target defined in zephyr as dependency.

Signed-off-by: Cyril Fougeray <[email protected]>
fix test compilation

Signed-off-by: Cyril Fougeray <[email protected]>
which fixes the generation of proto files

Signed-off-by: Cyril Fougeray <[email protected]>
don't use `orb/public`

was not causing issues so far but zephyr_module.py changed and isn't
able to find the project repo for zephyr.meta generation

it's important to note that this is only when the repo is used alone,
without it's `private` counterpart.

Signed-off-by: Cyril Fougeray <[email protected]>
when found, the cmake package `McuPrivate` is used to load custom
configs.
Allow a single point of entry for private configs, which is simpler to
maintain and understand.

Signed-off-by: Cyril Fougeray <[email protected]>
internal routing is now set in specific drivers that we don't use, as we
use the adc drivers to get vbat, vref and die temperature.
so we need so hardcode the configuration.

Signed-off-by: Cyril Fougeray <[email protected]>
dedicated to logging

Signed-off-by: Cyril Fougeray <[email protected]>
`inline` not needed (global static)
`else` branch not needed as previous branch returns, so make it clearer.

Signed-off-by: Cyril Fougeray <[email protected]>
add more delay between dfu messages (erasure takes time)

Signed-off-by: Cyril Fougeray <[email protected]>
because no signing keys are used when generating the test binary, define
 CONFIG_MCUBOOT_GENERATE_UNSIGNED_IMAGE

Signed-off-by: Cyril Fougeray <[email protected]>
fix compilation warnings
config MCUBOOT_BOOTLOADER_MODE_SINGLE_APP (one-slot)

Signed-off-by: Cyril Fougeray <[email protected]>
and use const when possible in calculate_die_temperature

Signed-off-by: Cyril Fougeray <[email protected]>
disable formatter for CMakeLists.txt
rename dts.overlay to app.overlay
copy-pasted all files from original project
encryption enabled in release builds only

Signed-off-by: Cyril Fougeray <[email protected]>
to quickly grasp which version is being built
visually appealing

Signed-off-by: Cyril Fougeray <[email protected]>
fouge added 4 commits January 15, 2025 11:30
we use the driver from Zephyr

Signed-off-by: Cyril Fougeray <[email protected]>
with fixes
watchdog can be initialized only once, by our libray
adc node property: <SYNC> became "SYNC"

Signed-off-by: Cyril Fougeray <[email protected]>
apa102 driver with led_strip api doesn't allow to set the brightness
byte, only the three RGB values. Use `update_channels` instead to set
LED raw values.
apa102 receives color in that order: ABGR, B and R have to be swapped in
 the struct before updating the channels.

Signed-off-by: Cyril Fougeray <[email protected]>
initialize icm40627 sensor by resetting it and checking
the WHO_AM_I register.

the driver is based on the icm42670 present in the zephyr repository
with a few changes: SPI -> I2C, changed WHO_AM_I response, added 1
int-gpios (still unused).
this driver is kept locally for now (no attempt to bring it upstream)
as it is still experimental and hasn't been tested.

Accelerometer values can be read and values are responding to motion,
but resolution might be wrong though (in m/s2):

`<inf> motion: Accel data for X: 1.606509 Y: 0.836773 Z: -3.-578134`

Signed-off-by: Cyril Fougeray <[email protected]>
@fouge fouge requested a review from sri9311 January 16, 2025 17:40
@fouge fouge marked this pull request as draft January 17, 2025 06:58
@fouge
Copy link
Collaborator Author

fouge commented Jan 17, 2025

converting to draft to make sure fouge/zephyr-4.0.0 is merged before that one

@fouge fouge force-pushed the fouge/zephyr-4.0.0 branch from 3cc89eb to 9d282d2 Compare January 17, 2025 10:03
@fouge fouge changed the title feat(motion): validate that icm40627 motion sensor is responding feat(motion): initial validation of icm40627 motion sensor Jan 17, 2025
@fouge fouge force-pushed the fouge/zephyr-4.0.0 branch 4 times, most recently from 99386b2 to 5ac56e1 Compare January 21, 2025 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant