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

tests: benchmarks: power_consumption: i2c: Fix increased power consumpion #19861

Merged
merged 3 commits into from
Jan 13, 2025

Conversation

nordic-krch
Copy link
Contributor

Test was suspending test thread from the timer interrupt at random (but periodic) point. I2c driver handles power management in the thread context. Randomly suspending the test thread could lead to a case where driver did not finish requested operation and system goes to s2ram in the middle of the driver operation.

PR extends framework to allow optional requesting of the test thread suspension (instead of forcing) and test thread suspends itself when requested. It is done after driver operation is finished.

Additionally, added enabling of the runtime power management to the i2c instance used by the shield used in the test.

@nordic-krch nordic-krch requested review from a team as code owners January 13, 2025 09:30
@github-actions github-actions bot added the changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. label Jan 13, 2025
@NordicBuilder
Copy link
Contributor

NordicBuilder commented Jan 13, 2025

CI Information

To view the history of this post, clich the 'edited' button above
Build number: 3

Inputs:

Sources:

sdk-nrf: PR head: 7ab054fd8cc3914d7c060c992b06249cc5d4edd2

more details

sdk-nrf:

PR head: 7ab054fd8cc3914d7c060c992b06249cc5d4edd2
merge base: 118ee397072150c3504f41febe438c047fb76c11
target head (main): aec6383d2d31332319493bab8b5364d62f0fad8a
Diff

Github labels

Enabled Name Description
ci-disabled Disable the ci execution
ci-all-test Run all of ci, no test spec filtering will be done
ci-force-downstream Force execution of downstream even if twister fails
ci-run-twister Force run twister
ci-run-zephyr-twister Force run zephyr twister
List of changed files detected by CI (3)
boards
│  ├── shields
│  │  ├── pca63566
│  │  │  ├── boards
│  │  │  │  │ nrf54h20dk_nrf54h20_common.dtsi
tests
│  ├── benchmarks
│  │  ├── power_consumption
│  │  │  ├── common
│  │  │  │  │ main.c
│  │  │  ├── i2c
│  │  │  │  ├── src
│  │  │  │  │  │ driver_test.c

Outputs:

Toolchain

Version: 11349092be
Build docker image: docker-dtr.nordicsemi.no/sw-production/ncs-build:11349092be_912848a074

Test Spec & Results: ✅ Success; ❌ Failure; 🟠 Queued; 🟡 Progress; ◻️ Skipped; ⚠️ Quarantine

  • ◻️ Toolchain - Skipped: existing toolchain is used
  • ✅ Build twister
    • sdk-nrf test count: 151
  • ✅ Integration tests
    • ✅ test-fw-nrfconnect-fem
Disabled integration tests
    • desktop52_verification
    • doc-internal
    • test_ble_nrf_config
    • test-fw-nrfconnect-apps
    • test-fw-nrfconnect-ble_mesh
    • test-fw-nrfconnect-ble_samples
    • test-fw-nrfconnect-boot
    • test-fw-nrfconnect-chip
    • test-fw-nrfconnect-nfc
    • test-fw-nrfconnect-nrf-iot_libmodem-nrf
    • test-fw-nrfconnect-nrf-iot_mosh
    • test-fw-nrfconnect-nrf-iot_nrf_provisioning
    • test-fw-nrfconnect-nrf-iot_positioning
    • test-fw-nrfconnect-nrf-iot_samples
    • test-fw-nrfconnect-nrf-iot_serial_lte_modem
    • test-fw-nrfconnect-nrf-iot_thingy91
    • test-fw-nrfconnect-nrf-iot_zephyr_lwm2m
    • test-fw-nrfconnect-nrf_crypto
    • test-fw-nrfconnect-ps
    • test-fw-nrfconnect-rpc
    • test-fw-nrfconnect-rs
    • test-fw-nrfconnect-tfm
    • test-fw-nrfconnect-thread
    • test-fw-nrfconnect-zigbee
    • test-low-level
    • test-sdk-audio
    • test-sdk-dfu
    • test-sdk-find-my
    • test-sdk-mcuboot
    • test-sdk-pmic-samples
    • test-sdk-sidewalk
    • test-sdk-wifi
    • test-secdom-samples-public

Note: This message is automatically posted and updated by the CI

@@ -12,6 +12,16 @@ const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(DT_ALIAS(led2), gpios);
static bool state = true;
extern void thread_definition(void);

/* Some tests requires that test thread controls when the moment when it is
Copy link
Contributor

Choose a reason for hiding this comment

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

Some tests require that test thread controls when it is suspended.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@nordic-krch nordic-krch force-pushed the i2c_power_consumption branch 2 times, most recently from 75d72ad to 7ab054f Compare January 13, 2025 12:50
Test was suspending test thread from the timer interrupt at random
(but periodic) point. Some drivers which are tested in that framework
handles power management in the thread context. Randomly suspending
the test thread could lead to a case where driver did not finish
requested operation and system goes to s2ram in the middle of the
driver operation. Extending the test framework to allow more
controlled thread suspension. Timer can indicate to the thread that
is shall be suspended and thread calls self suspension when ready.

Signed-off-by: Krzysztof Chruściński <[email protected]>
Test thread cannot be suspended at any time because driver power
management happens in the thread context so if thread is suspended
at the random moment and system goes to s2ram it can lead to
increased power consumption because thread got suspended before
i2c device got properly suspended.

Signed-off-by: Krzysztof Chruściński <[email protected]>
Add property to enable runtime PM for i2c and spi used for controlling
the sensor.

Signed-off-by: Krzysztof Chruściński <[email protected]>
@nordic-piks nordic-piks merged commit 6dd7041 into nrfconnect:main Jan 13, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport v2.9-nRF54H20-branch changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants