Can't using TWIM in BLE event handler

MCU : nrf52833

SDK : Ver 17.1.0

SoftDevice : S140

I try to call RTC value to external RTC Module by TWIM in BLE authentication rw request event.

But MCU stop to call TWIM and looks like waitting TWIM done event.

I think problem is priority but, changing NRFX_TWIM_DEFAULT_CONFIG_IRQ_PRIORITY, APP_BLE_OBSERVER_PRIO, NRF_SDH_BLE_OBSERVER_PRIO_LEVELS values are not working.

Like 

NRFX_TWIM_DEFAULT_CONFIG_IRQ_PRIORITY 2

APP_BLE_OBSERVER_PRIO 3

NRF_SDH_BLE_OBSERVER_PRIO_LEVELS 4

Or

NRFX_TWIM_DEFAULT_CONFIG_IRQ_PRIORITY 3

APP_BLE_OBSERVER_PRIO 6

NRF_SDH_BLE_OBSERVER_PRIO_LEVELS 7

Parents
  • Hi,

    I agree that it sounds like a priority issue.

    Are you using the nrfx_twim API directly in your application, or do you use the legacy nrf_drv_twi API? Note that NRFX_TWIM_DEFAULT_CONFIG_IRQ_PRIORITY will be redefined in apply_old_config.h to the value of TWI_DEFAULT_CONFIG_IRQ_PRIORITY if TWI_ENABLED is defined in your sdk_config.h file, regardless if TWI_ENABLED is set to 1 or 0. If you are using nrfx APIs, you need to completely remove the legacy configs from your sdk_config.h file to get the NRFX configs working correctly.

    Best regards,
    Jørgen

  • Hi Jorgen !

    Thanks a lot for this tips. 

    After fighting days on that, i can conclude you are 100% right:

    !!!!!!!!!    if you use TWIM, JUST ROMOVE ALL THE TWI STUFF FROM YOUR SDK_CONFIG.H !!!!!!!!!!!!

    Otherwise you will get headhack and white hair before the end of the day. I started from twi_example, try to keep the sdk_config.h used etc.... But at the end, ( at least for nrf52833) TWi is depracated according to the documentation and also all the functions like nrf_driver tx or rx are depracated and docuementation advice to use nrfx_twim_xfer function.

Reply
  • Hi Jorgen !

    Thanks a lot for this tips. 

    After fighting days on that, i can conclude you are 100% right:

    !!!!!!!!!    if you use TWIM, JUST ROMOVE ALL THE TWI STUFF FROM YOUR SDK_CONFIG.H !!!!!!!!!!!!

    Otherwise you will get headhack and white hair before the end of the day. I started from twi_example, try to keep the sdk_config.h used etc.... But at the end, ( at least for nrf52833) TWi is depracated according to the documentation and also all the functions like nrf_driver tx or rx are depracated and docuementation advice to use nrfx_twim_xfer function.

Children
No Data
Related