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

Using Bosch BSEC lib throws stack overflow on Asset Tracker

I tried to use the Bosch BSEC library for the Asset Tracker application for nRF9160.

It seems that the Asset Tracker was build for BSEC 1.4.7.4 which is unfortunately no more available on Bosh website so I upgraded the project to use BSEC 1.4.8.0 but the nRF9160 triggers a stack overflow when I enable CONFIG_USE_BME680_BSEC:

[00:00:02.704,040] <err> os: ***** USAGE FAULT *****
[00:00:02.709,686] <err> os:   Stack overflow (context area not valid)
[00:00:02.716,888] <err> os: r0/a1:  0x0002515d  r1/a2:  0x0002511d  r2/a3:  0x0004513b
[00:00:02.725,585] <err> os: r3/a4:  0x000250c1 r12/ip:  0x00047857 r14/lr:  0x00025581
[00:00:02.734,283] <err> os:  xpsr:  0x61020000
[00:00:02.739,501] <err> os: s[ 0]:  0x00000001  s[ 1]:  0x00000001  s[ 2]:  0x00000001  s[ 3]:  0x00000001
[00:00:02.749,969] <err> os: s[ 4]:  0x00000001  s[ 5]:  0x00000001  s[ 6]:  0x00000001  s[ 7]:  0x00000001
[00:00:02.760,437] <err> os: s[ 8]:  0x00000001  s[ 9]:  0x00000001  s[10]:  0x00000001  s[11]:  0x00000001
[00:00:02.770,874] <err> os: s[12]:  0x00000000  s[13]:  0x00000000  s[14]:  0x00000000  s[15]:  0x00000000
[00:00:02.781,280] <err> os: fpscr:  0x00000000
[00:00:02.786,499] <err> os: Faulting instruction address (r15/pc): 0x0002566e
[00:00:02.794,403] <err> os: >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0
[00:00:02.802,276] <err> os: Current thread: 0x20021ac8 (unknown)
[00:00:02.809,082] <err> asset_tracker: Running main.c error handler

I then tried to double the value of every stack size configuration I could find (CONFIG_APPLICATION_WORKQUEUE_STACK_SIZE, CONFIG_MAIN_STACK_SIZE, CONFIG_IDLE_STACK_SIZE and CONFIG_PRIVILEGED_STACK_SIZE) but the application keeps crashing with a stack overflow.

What stack size should I increase? Does the issue comes from something else? Thanks.

Related