stack overflow

Hello,

I'm just trying to run the LTE_BLE_GATEWAY sample program and I've flash all the nessesary firmware onto the nrf9160dk baord. However, when I turn on the nrf52, it gets connected to the nrf8160 for a split second and it reset itself. Therefore, I'm wondering what is happing here. I've tried increasing the  MAIN_STACK_SIZE and the SYSTEM_WORKQUEUE_STACK_SIZE in the nrf9160dk_nrf52840.conf but none of that works. Is there anything that I did wrong here?

  • Solution:

    Try increasing CONFIG_BT_RX_STACK_SIZE.

    Check the file <sample>/build/zephyr/.config what CONFIG_BT_RX_STACK_SIZE is currently set to and set it to a higher value in the prj.conf file.

    Explanation:

    I can see from your log that the overflow happened in the thread "bt_rx_thread". After searching for bt_rx_thread in the whole NCS, I figured out that this thread was created in zephyr/drivers/bluetooth/hci/h4.c, and if you look at line 38 in this file you see that the stack size is determined by CONFIG_BT_RX_STACK_SIZE

  • Hey Simon,

    Thank you for your input. However, I'm still experiencing the same issue dispite I have increase the CONFIG_BT_RX_STACK_SIZE. Is there any debugging method you would recommend? Or is there anything else I should change here?

    Best,

    Ben Li

  • Hmm.. I'll try to reproduce this myself. Based of the logs, it seems like you're using NCS v2.0.0, correct? Have you made any changes to the lte_ble_gateway sample, or did you run it out of the box?

    Best regards,

    Simon

  • Hi Simon,

    Yes I'm using NCS v2.0.0. I'm just trying to test it out with the LTE sensor gateway sample with the exact nrf9160dk and thingy:52. https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/nrf9160/lte_ble_gateway/README.html  I tried to run it out of the box without making anychanges, but I'm expericing these problems above. Then, I've tried changing the code. The only thing I've changed is the config stack size.

    Best,

    Ben Li 

  • I just tested with a Thingy:52 v1.0.0 and an nRF9160 DK v1.0.0 and was not able to reproduce the issue, I got the following log:

    *** Booting Zephyr OS build v3.0.99-ncs1  ***
    +CEREG: 90
    [00:00:00.493,041] <inf> lte_ble_gw: LTE Sensor Gateway sample started
    [00:00:00.493,255] <inf> lte_ble_gw: Initializing Bluetooth..
    [00:00:00.510,803] <inf> lte_ble_gw: Establishing LTE link (this may take some time) ...
    [00:00:01.204,040] <wrn> bt_hci_core: opcode 0x0000 pool id 3 pool 0x20015304 != &hci_cmd_pool 0x2001536c
    [00:00:01.255,310] <inf> lte_ble_gw: Bluetooth ready
    [00:00:01.262,390] <inf> lte_ble_gw: Scanning...
    [00:00:05.030,029] <inf> lte_ble_gw: Device found: CA:99:4C:95:7E:69 (random)
    [00:00:05.416,290] <inf> lte_ble_gw: Connected: CA:99:4C:95:7E:69 (random)
    [00:00:12.578,857] <inf> lte_ble_gw: Orientation: 0
    [00:00:18.459,045] <inf> lte_ble_gw: Orientation: 1
    [00:00:25.359,252] <inf> lte_ble_gw: Orientation: 2
    [00:00:32.649,444] <inf> lte_ble_gw: Orientation: 0
    [00:00:35.139,526] <inf> lte_ble_gw: Orientation: 3

    I'll upload the exact hex files I used. Try to program them to the appropriate chips and see if you are able to reproduce the issue then:

    Best regards,

    Simon

Related