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

driver: Timer / Counter initialization incorrect for timer2 with BLE on nRF52840 #69216

Closed
carlst opened this issue Feb 19, 2024 · 2 comments · Fixed by #68618 or #69966
Closed

driver: Timer / Counter initialization incorrect for timer2 with BLE on nRF52840 #69216

carlst opened this issue Feb 19, 2024 · 2 comments · Fixed by #68618 or #69966
Assignees
Labels
bug The issue is a bug, or the PR is fixing a bug platform: nRF Nordic nRFx priority: low Low impact/importance bug

Comments

@carlst
Copy link

carlst commented Feb 19, 2024

Describe the bug
An initialization value is incorrect if timer2 is enabled (and used in counter mode) with BLE (where timer0 and timer1 are disabled) on nRF52840.

Please also mention any information which could help others to understand
the problem you're facing:

  • drivers/counter/counter_nrfx_timer.c uses a Nordic HAL value to initialize .timer.
    This is out-of-sync with devicetree information as timer0 and timer1 are disabled but
    timer2 is enabled because:
    devicetree
    implies that devicetree starts indexing instances from 0 based on enabled devices, and then indexes disabled devices. So, devicetree index for timer2 (0) and HAL index for timer2 (2) differ.

  • see: commit 9a27906

To Reproduce
Steps to reproduce the behavior:

  1. Use samples/bluetooth/broadcaster
  2. Add following to prj.conf
CONFIG_COUNTER=y
CONFIG_NRFX_TIMER2=y
  1. Create boards/nrf52840dk_nrf52840.overlay with:
&timer2 {
  status = "okay";
};
  1. Build and run on nRF52840DK
  2. Check value of reg in init_timer. It is 0x40008000 and should be 0x4000a000

Expected behavior
timer2 should operate correctly as a counter.

Impact
Very low priority (workaround is to revert commit above).

Environment (please complete the following information):

  • OS: Windows
  • Toolchain: zephyr-sdk-0.16.5
  • Commit SHA or Version used: 5c455aa
@carlst carlst added the bug The issue is a bug, or the PR is fixing a bug label Feb 19, 2024
@henrikbrixandersen henrikbrixandersen added the platform: nRF Nordic nRFx label Feb 20, 2024
@MaureenHelm MaureenHelm added the priority: low Low impact/importance bug label Feb 20, 2024
@cvinayak
Copy link
Contributor

FYI @aescolar

@aescolar
Copy link
Member

(@cvinayak thanks for the ping)
There is a fix for this ready coming in this PR #68618
CC @magp-nordic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug, or the PR is fixing a bug platform: nRF Nordic nRFx priority: low Low impact/importance bug
Projects
None yet
6 participants