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

TWI init conflicting with BLE initialisation calls

Hello. I've used the design template that initialises everything for Bluetooth communication. These are the initialisation calls made in main():

// Initialize
leds_init();
timers_init();
gpiote_init();
buttons_init();
ble_stack_init();
scheduler_init();
gap_params_init();
advertising_init();
services_init();
conn_params_init();
sec_params_init();
    
// Start execution
timers_start();
advertising_start();

I then add a TWI init call from the "TWI master" example, but that hangs the chip (nRF51822) during the execution of the TWI initialisation routine. If I comment out some of the other initialisation calls, like so

// Initialize
leds_init();
timers_init();
gpiote_init();
buttons_init();
//ble_stack_init();
scheduler_init();
//gap_params_init();
//advertising_init();
services_init();
//conn_params_init();
sec_params_init();
    
// Start execution
timers_start();
//advertising_start();

twi_init() does not hang, and I'm able to talk to my peripheral over the TWI bus. Before I go investigate more closely why this happens, I was wondering if anyone else has experienced this before, and what might be a possible solution. I'm using the pin assignment from the example code if that's relevant:


#define TWI_MASTER_CONFIG_CLOCK_PIN_NUMBER (24U)
#define TWI_MASTER_CONFIG_DATA_PIN_NUMBER (25U)
Related