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

things allow/not allowed to call from callbacks NRF52/S132

Hi!

I was developing my custom service, and had a question around what kind of functionality is allowed or not allowed within a callback from the soft device or other peripheral drivers.

Examples:

example #1: softdevice handler for BLE events: err_code = softdevice_ble_evt_handler_set(ble_evt_dispatch);

Now I wanted to use std::make_shared within that event handler, and it seems that it will just hang the device or trigger some kind of fault (sometimes debugging isn't that clear).

example #2: TWI peripheral driver completion handler: err_code = nrf_drv_twi_init(&m_twi, &twi_drv_config, twi_handler, config);

In this case I wanted to call sd_ble_gatts_value_set, but this will also result in a hang or some kind of fault (again not that easy to debug).

Is there a clear list of what's allowed at what point?

Thanks, Peter

Parents
  • Hi! that was APP_IRQ_PRIORITY_HIGH, is there a good overview what kind of things need which priorty?

    Also something that might be related: if I turn on logging (compile flag NRF_LOG_ENABLED=1), then there will be exactly one advertisement, and nothing else. Also e.g. the app_timer does not work while advertising, but as soon as somebody connects, it will start working. Any ideas what all if this could be?

Reply
  • Hi! that was APP_IRQ_PRIORITY_HIGH, is there a good overview what kind of things need which priorty?

    Also something that might be related: if I turn on logging (compile flag NRF_LOG_ENABLED=1), then there will be exactly one advertisement, and nothing else. Also e.g. the app_timer does not work while advertising, but as soon as somebody connects, it will start working. Any ideas what all if this could be?

Children
No Data
Related