This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

LIS2DH Trigger Giving z_arm_mpu_fault()LIS2

Running the Zephyr LIS2DH sample program on a custom board works fine until I configure it to use the trigger and then it throws the z_arm_mpu_fault() error. It doesn't matter if I have it use it's own thread or the global thread. 

Any idea what could be causing this?

Parents
  • Could you try set CONFIG_LOG=y, and CONFIG_RESET_ON_FATAL_ERROR=n. Then check the log to see the line that caused the issue (use addr2line).

    The issue may be due to a stack overflow, check out the ticket Stack Overflow for more information how to resolve the issue then.

    Best regards,

    Simon

  • Turning on those settings I get the following:

    [00:00:00.203,613] [0m<inf> lis2dh: int1 on GPIO_0.06[0m
    [00:00:00.204,071] [1;31m<err> os: Exception occurred in Secure State[0m
    [00:00:00.204,528] [1;31m<err> os: ***** HARD FAULT *****[0m
    [00:00:00.204,925] [1;31m<err> os: Fault escalation (see below)[0m
    [00:00:00.205,383] [1;31m<err> os: ***** BUS FAULT *****[0m
    [00:00:00.205,780] [1;31m<err> os: Precise data bus error[0m
    [00:00:00.206,207] [1;31m<err> os: BFAR Address: 0x50008158[0m
    [00:00:00.206,665] [1;31m<err> os: r0/a1: 0x00000000 r1/a2: 0x000485ac r2/a3: 0x00000000[0m
    [00:00:00.207,275] [1;31m<err> os: r3/a4: 0x00000001 r12/ip: 0x0000a000 r14/lr: 0x0003620d[0m
    [00:00:00.207,916] [1;31m<err> os: xpsr: 0x21000000[0m
    [00:00:00.208,343] [1;31m<err> os: s[ 0]: 0x00000000 s[ 1]: 0x00000000 s[ 2]: 0x00000000 s[ 3]: 0x00000000[0m
    [00:00:00.209,106] [1;31m<err> os: s[ 4]: 0x00000000 s[ 5]: 0x00000000 s[ 6]: 0x00000000 s[ 7]: 0x00000000[0m
    [00:00:00.209,838] [1;31m<err> os: s[ 8]: 0x00000000[00:00:00.203,338] [0m<inf> lis2dh: int1 on GPIO_0.06[0m

  • Is that all the log you got? Did you not get "Faulting instruction address (r15/pc): <faulting address>"? That should tell you exactly what line of code that is failing, by using addr2line -e zephyr.elf <faulting address>.

  • I made the following change:

    CONFIG_MAIN_STACK_SIZE=8192

    I have the debugger stopping on the first line of main.c but it dies before then.

    I was able to get more data this time:

    [00:02:53.252,136] [1;31m<err> os: Exception occurred in Secure State[0m
    [00:02:53.259,063] [1;31m<err> os: ***** HARD FAULT *****[0m
    [00:02:53.264,862] [1;31m<err> os: Fault escalation (see below)[0m
    [00:02:53.271,423] [1;31m<err> os: ***** BUS FAULT *****[0m
    [00:02:53.277,160] [1;31m<err> os: Precise data bus error[0m
    [00:02:53.283,172] [1;31m<err> os: BFAR Address: 0x50008158[0m
    [00:02:53.289,367] [1;31m<err> os: r0/a1: 0x00000000 r1/a2: 0x00013ff2 r2/a3: 0x00000000[0m
    [00:02:53.298,492] [1;31m<err> os: r3/a4: 0xffffffff r12/ip: 0x0000000a r14/lr: 0x000112b3[0m
    [00:02:53.307,617] [1;31m<err> os: xpsr: 0x21000000[0m
    [00:02:53.313,079] [1;31m<err> os: Faulting instruction address (r15/pc): 0x00013052[0m
    [00:02:53.321,380] [1;31m<err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0[0m
    [00:02:53.329,559] [1;31m<err> os: Current thread: 0x20010178 (unknown)[0m
    [00:02:53.356,689] [1;31m<err> os: Halting system[0m
    [00:00:00.001,953] [0m<inf> lis2dh: int1 on GPIO_0.06

    Debugger shows it stopping here:

    SECTION_SUBSEC_FUNC(TEXT,__fault,z_arm_exc_spurious)

    mrs r0, MSP

Reply
  • I made the following change:

    CONFIG_MAIN_STACK_SIZE=8192

    I have the debugger stopping on the first line of main.c but it dies before then.

    I was able to get more data this time:

    [00:02:53.252,136] [1;31m<err> os: Exception occurred in Secure State[0m
    [00:02:53.259,063] [1;31m<err> os: ***** HARD FAULT *****[0m
    [00:02:53.264,862] [1;31m<err> os: Fault escalation (see below)[0m
    [00:02:53.271,423] [1;31m<err> os: ***** BUS FAULT *****[0m
    [00:02:53.277,160] [1;31m<err> os: Precise data bus error[0m
    [00:02:53.283,172] [1;31m<err> os: BFAR Address: 0x50008158[0m
    [00:02:53.289,367] [1;31m<err> os: r0/a1: 0x00000000 r1/a2: 0x00013ff2 r2/a3: 0x00000000[0m
    [00:02:53.298,492] [1;31m<err> os: r3/a4: 0xffffffff r12/ip: 0x0000000a r14/lr: 0x000112b3[0m
    [00:02:53.307,617] [1;31m<err> os: xpsr: 0x21000000[0m
    [00:02:53.313,079] [1;31m<err> os: Faulting instruction address (r15/pc): 0x00013052[0m
    [00:02:53.321,380] [1;31m<err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0[0m
    [00:02:53.329,559] [1;31m<err> os: Current thread: 0x20010178 (unknown)[0m
    [00:02:53.356,689] [1;31m<err> os: Halting system[0m
    [00:00:00.001,953] [0m<inf> lis2dh: int1 on GPIO_0.06

    Debugger shows it stopping here:

    SECTION_SUBSEC_FUNC(TEXT,__fault,z_arm_exc_spurious)

    mrs r0, MSP

Children
Related