Good day,
I have a project including BLE, two i2c sensors and several timers to handle led and switches. I want to add the third sensor which is LIS2DH (actually LIS3DH but the driver is the same), using the zephyr sensor driver. I've tested the driver independently and works fine, and my whole project works just fine ,but as soon as I add this code snippet in my devicetree overlay, I get some access violation errors and the cpu resets continuously.
This is the code for i2c section in the overlay file:
&i2c1 { status = "okay"; max86150: max86150@5e { status = "okay"; compatible = "i2c-device"; reg = < 0x5e >; }; max30205: max30205@48 { status = "okay"; compatible = "i2c-device"; reg = < 0x48 >; }; lis3dh: lis3dh@19 { status = "okay"; compatible = "st,lis2dh"; reg = < 0x19 >; }; };
I'm enabling the sensor driver in the .conf file:
CONFIG_SENSOR=y CONFIG_LIS2DH=y CONFIG_LIS2DH_TRIGGER_GLOBAL_THREAD=y CONFIG_LIS2DH_ACCEL_RANGE_2G=y CONFIG_LIS2DH_OPER_MODE_LOW_POWER=y CONFIG_LIS2DH_ODR_1=y
And the console logging:
faulting instruction address continuously changes
*** Booting Zephyr OS build v3.1.99-ncs1 *** [00:00:00.002,044] <inf> lis2dh: fs=2, odr=0x1 lp_en=0x8 scale=9576 [00:00:00.006,561] <err> os: ***** MPU FAULT ***** [00:00:00.006,561] <err> os: Stacking error (context area might be not valid) [00:00:00.006,561] <err> os: Data Access Violation [00:00:00.006,591] <err> os: MMFAR Address: 0x200066b8 [00:00:00.006,622] <err> os: r0/a1: 0xf53fefbf r1/a2: 0x488d30a0 r2/a3: 0xf7d2d4d4 [00:00:00.006,622] <err> os: r3/a4: 0xc502c0e7 r12/ip: 0xf4fffb12 r14/lr: 0xc84b28e0 [00:00:00.006,652] <err> os: xpsr: 0x0a9aac00 [00:00:00.006,652] <err> os: s[ 0]: 0x00000002 s[ 1]: 0x00000000 s[ 2]: 0x00000000 s[ 3]: 0x00000000 [00:00:00.006,683] <err> os: s[ 4]: 0x00000000 s[ 5]: 0x00000000 s[ 6]: 0x00000000 s[ 7]: 0x00000000 [00:00:00.006,683] <err> os: s[ 8]: 0x00000000 s[ 9]: 0x00000000 s[10]: 0x00000000 s[11]: 0x00000000 [00:00:00.006,713] <err> os: s[12]: 0x00000000 s[13]: 0x00000000 s[14]: 0xffffffff s[15]: 0x00000000 [00:00:00.006,713] <err> os: fpscr: 0x00000000 [00:00:00.006,744] <err> os: Faulting instruction address (r15/pc): 0xfbfbdfa6 [00:00:00.006,774] <err> os: >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0 [00:00:00.006,774] <err> os: Current thread: 0x20002418 (unknown) [00:00:01.507,141] <err> fatal_error: Resetting system *** Booting Zephyr OS build v3.1.99-ncs1 *** [00:00:00.002,044] <inf> lis2dh: fs=2, odr=0x1 lp_en=0x8 scale=9576 [00:00:00.006,561] <err> os: ***** MPU FAULT ***** [00:00:00.006,561] <err> os: Stacking error (context area might be not valid) [00:00:00.006,561] <err> os: Data Access Violation [00:00:00.006,591] <err> os: MMFAR Address: 0x200066b8 [00:00:00.006,622] <err> os: r0/a1: 0xf53fefbf r1/a2: 0x488d30a0 r2/a3: 0xf7d2d4d4 [00:00:00.006,622] <err> os: r3/a4: 0xc502c0e7 r12/ip: 0xf4fffb12 r14/lr: 0xc84b28e0 [00:00:00.006,652] <err> os: xpsr: 0x0a9aac00 [00:00:00.006,652] <err> os: s[ 0]: 0x00000002 s[ 1]: 0x00000000 s[ 2]: 0x00000000 s[ 3]: 0x00000000 [00:00:00.006,683] <err> os: s[ 4]: 0x00000000 s[ 5]: 0x00000000 s[ 6]: 0x00000000 s[ 7]: 0x00000000 [00:00:00.006,683] <err> os: s[ 8]: 0x00000000 s[ 9]: 0x00000000 s[10]: 0x00000000 s[11]: 0x00000000 [00:00:00.006,713] <err> os: s[12]: 0x00000000 s[13]: 0x00000000 s[14]: 0xffffffff s[15]: 0x00000000 [00:00:00.006,713] <err> os: fpscr: 0x00000000 [00:00:00.006,744] <err> os: Faulting instruction address (r15/pc): 0xfbfbdfa6 [00:00:00.006,744] <err> os: >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0 [00:00:00.006,774] <err> os: Current thread: 0x20002418 (unknown) [00:00:01.507,781] <err> fatal_error: Resetting system *** Booting Zephyr OS build v3.1.99-ncs1 *** [00:00:00.002,044] <inf> lis2dh: fs=2, odr=0x1 lp_en=0x8 scale=9576 [00:00:00.006,561] <err> os: ***** MPU FAULT ***** [00:00:00.006,561] <err> os: Stacking error (context area might be not valid) [00:00:00.006,591] <err> os: Data Access Violation [00:00:00.006,591] <err> os: MMFAR Address: 0x200066b8 [00:00:00.006,622] <err> os: r0/a1: 0x40004000 r1/a2: 0x20002bcc r2/a3: 0x00000000 [00:00:00.006,622] <err> os: r3/a4: 0x00000001 r12/ip: 0x00000001 r14/lr: 0x0001dd09 [00:00:00.006,652] <err> os: xpsr: 0x81000000 [00:00:00.006,652] <err> os: s[ 0]: 0x00000000 s[ 1]: 0x00000000 s[ 2]: 0x00000000 s[ 3]: 0x00000000 [00:00:00.006,683] <err> os: s[ 4]: 0x0001617d s[ 5]: 0x00000000 s[ 6]: 0x00000000 s[ 7]: 0x00000000 [00:00:00.006,683] <err> os: s[ 8]: 0x00000000 s[ 9]: 0x00000000 s[10]: 0x00000000 s[11]: 0x00046985 [00:00:00.006,713] <err> os: s[12]: 0x00000000 s[13]: 0x00000000 s[14]: 0x00000000 s[15]: 0x00000000 [00:00:00.006,744] <err> os: fpscr: 0xfbfbdfa6 [00:00:00.006,744] <err> os: Faulting instruction address (r15/pc): 0x00024190 [00:00:00.006,774] <err> os: >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0 [00:00:00.006,774] <err> os: Current thread: 0x20002418 (unknown) [00:00:01.507,476] <err> fatal_error: Resetting system
Hardware: nRF52832 DK
Software: NCS 2.1.1
Best Regards,
Hossein