Skip to content

Two timers are expiring at one time and crashing for platform nrf52_pca10040 #13051

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

Closed
kiranpachava opened this issue Feb 5, 2019 · 9 comments
Assignees
Labels
bug The issue is a bug, or the PR is fixing a bug platform: nRF Nordic nRFx priority: medium Medium impact/importance bug

Comments

@kiranpachava
Copy link

kiranpachava commented Feb 5, 2019

Describe the bug
Two timers are expiring at one time and crashing for platform nrf52_pca10040
We have changed the expiry time to prime number or odd number.

To Reproduce
Steps to reproduce the behavior:

  1. cd samples/hello_world
    edit the file src/main.c and add the patch shared below.
--- a/samples/hello_world/src/main.c
+++ b/samples/hello_world/src/main.c
@@ -7,7 +7,27 @@
 #include <zephyr.h>
 #include <misc/printk.h>
 
-void main(void)
+void expiry_fn(struct k_timer *timer) {
+
+        printk("expired \n");
+}
+
+void stop_fn(struct k_timer *timer) {
+        printk("stoped \n");
+}
+
+K_TIMER_DEFINE(t1, expiry_fn, stop_fn);
+K_TIMER_DEFINE(t2, expiry_fn, stop_fn);
+
+ void main(void)
 {
-       printk("Hello World! %s\n", CONFIG_ARCH);
+       printk("Hello World! %s\n", CONFIG_ARCH);
+        printk("Hello World! %s\n", CONFIG_ARCH);
+
+        k_timer_start(&t1, 500, 200);
+        k_timer_start(&t2, 500, 400);
+
+        while (1) {
+                k_sleep(20000);
+        }
  1. mkdir build; cd build
  2. cmake -G Ninja -DBOARD=nrf52_pca10040
  3. ninja
  4. ninja flash
  5. Launch the minicom (sudo minicom -D /dev/ttyACM0

Expected behavior

**Welcome to minicom 2.7.1

OPTIONS: I18n
Compiled on May 3 2018, 15:20:11.
Port /dev/ttyACM0, 14:47:30

Press CTRL-A Z for help on special keys

***** Booting Zephyr OS zephyr-v1.13.0-25-g1630b5d3ac *****
Hello World! arm
Hello World! arm
expired
***** HARD FAULT *****
Fault escalation (see below)
***** MPU FAULT *****
Instruction Access Violation
***** Hardware exception *****
Current thread ID = 0x20000cb8
Faulting instruction address = 0x20000ea0
Fatal fault in ISR! Spinning...**

Impact
when two timers are expired at same time app crashes.

Environment (please complete the following information):

  • OS: (Linux)
  • Toolchain (Zephyr SDK 0.9.5, Branch code v1.13.0)
@kiranpachava kiranpachava added the bug The issue is a bug, or the PR is fixing a bug label Feb 5, 2019
@kiranpachava
Copy link
Author

Hi,

Any update on the issue reported ? Please help to check it.

Regards,
Kiran

@kiranpachava
Copy link
Author

Hi,

Can someone help on this blocking issue ?
Probably this will lead app crash to anyone who set the two timers in their programming.

Regards,
Kiran

@nashif nashif added priority: medium Medium impact/importance bug platform: nRF Nordic nRFx labels Feb 19, 2019
@andyross
Copy link
Collaborator

Taking a look. I'm not able to reproduce this on my current tree which has a few unmerged fixes, so I suspect this is addressed. Will check against master.

@kiranpachava
Copy link
Author

Please do check it on master branch code (v1.13.0 release tag).

@andyross
Copy link
Collaborator

andyross commented Feb 26, 2019

Oh, was this reported against the 1.13 release code? Can you please check against current master? If it's fixed it's fixed, and we can close this.

@kiranpachava
Copy link
Author

yep, reported on v1.13 release code. Sure we will check this after merging v1.14.0-rc1 to our code base.
Thanks Andy, I will get back to you on this if we find any issue on latest code base.

@andyross
Copy link
Collaborator

To be clearer: basically the entire timer subsystem was rewritten for 1.14. And nRF in particular was subject to a bunch of timer bugs with the old code. The new code has 100% new and improved bugs.

@kiranpachava
Copy link
Author

Thanks Andy, I checked it and the issue is not reproduced in v1.14.0-rc1 code base

@andyross
Copy link
Collaborator

Fantastic, thanks.

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: medium Medium impact/importance bug
Projects
None yet
Development

No branches or pull requests

4 participants