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

Application crash after disconnection

Hi,

I have an application with an accelerometer. This one communicate in I2C (TWI ). The accelerometer send a "data ready" signal every 20ms. I'm using the GPIOTE module to detect this signal and read the acceleration (I2C).

Each time I disconnect the Bluetooth, my application crash. I don't have any information to help me to debug on my app_error_handler. When this error happens, the execution stop at "Unknown funtion 0x000006B0".

  1. I tried to disable data ready interuption on the accelerometer and the error disappear (seems to be related to a priority issue with GPIOTE / TWI and SoftDevice).
  2. I thought that this issue was realated to a timing issue due to the GPIOTE interuption and TWI read during advertising start so I tried to disable GPIOTE on the data ready input when I have a disconnection event but that doesn't solve the problem.

I already saw another topic about that but the fix is not clear and I don't understand the root cause (devzone.nordicsemi.com/.../).

What I have understood from this topic is that I should use the ble_debug_assert_handler but I don't understand how to link this one with the app_error_handler. Do you have any example?

Any idea to help me to solve this issue? I'm on it since a while ...

Thanks

Parents
    1. Nothing directly related to the disconnection event but an interruption on the GPIOTE can occur (accelerometer data ready signal) every 20ms. The gpiote interruption handler is really short (just changing a "data_ready" flag to true). Then I'm checking data_ready in the main loop and read the accelerometer value if a new data is available (I2C). Due to the unsynchronized interruption, I tried to disable this when I have the BLE_GAP_EVT_DISCONNECTED event but that doesn't solve the problem.

    2. This is what I thought but in fact the TWI is already configured to low level as follow in the sdk_config.c

      TWI_DEFAULT_CONFIG_IRQ_PRIORITY 3

    I don't call any SD function from my TWI module neither from a GPIOTE interruption handler or something like that.

    1. DEBUG is defined and I'm actually in debugging level 2 and optimization level 1. I tried before other without success. Will try again.
Reply
    1. Nothing directly related to the disconnection event but an interruption on the GPIOTE can occur (accelerometer data ready signal) every 20ms. The gpiote interruption handler is really short (just changing a "data_ready" flag to true). Then I'm checking data_ready in the main loop and read the accelerometer value if a new data is available (I2C). Due to the unsynchronized interruption, I tried to disable this when I have the BLE_GAP_EVT_DISCONNECTED event but that doesn't solve the problem.

    2. This is what I thought but in fact the TWI is already configured to low level as follow in the sdk_config.c

      TWI_DEFAULT_CONFIG_IRQ_PRIORITY 3

    I don't call any SD function from my TWI module neither from a GPIOTE interruption handler or something like that.

    1. DEBUG is defined and I'm actually in debugging level 2 and optimization level 1. I tried before other without success. Will try again.
Children
No Data
Related