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

TWI with Softdevice S110

Hi

I have a problem using TWI driver with my softdevice enabled.

The TWI is able to communicate successfully to the slave without the softdevice.

But the same code when merged with the softdevice and an character sent for Read/Write returns busy or the BLE chip restarts.

Below is the part of example code used for toggling led ON/OFF by sending an character from phone.

Find full code here = BLE_TWI.txt

Please tell me what changes I should make.

Parents
  • Thank you I sorted out the problem

    the problem was with twi Initialization p_twi_config.interrupt_priority = APP_IRQ_PRIORITY_LOW;

    after I changed it to p_twi_config.interrupt_priority = APP_IRQ_PRIORITY_HIGH;

    its working now both Read/Write.

  • That's exactly the one case I mentioned above that you should not do, use nrf_delays in any interrupt handler which is running in APP HIGH priority - so if you're doing that, you'll eventually mess up your bluetooth connection.

    Not that I know why you were putting delays in all over the place, none of them are necessary and if you're doing that, you're just working around issues in your code.

    write data, get callback, read data, get callback, no delays needed.

Reply
  • That's exactly the one case I mentioned above that you should not do, use nrf_delays in any interrupt handler which is running in APP HIGH priority - so if you're doing that, you'll eventually mess up your bluetooth connection.

    Not that I know why you were putting delays in all over the place, none of them are necessary and if you're doing that, you're just working around issues in your code.

    write data, get callback, read data, get callback, no delays needed.

Children
No Data
Related