Hi We have an application where we what to read i2c sensor data over the air to an iPhone. We've taken ble_app_uart_S130 project and grafted in some twi_hardware code. There is a command response code where the users sends a single char and the device sends a short value (sensor reading) (e.g. "x=123").
The problem is the unit does not receive any commands into nus_data_handler() when the sensor is being scanned. It connects but no commands are received from the iPhone. With the GPIO interrupt disabled commands from the iPhone are received and responded to.
The sensor is read on a GPIOTE interrupt (about 100Hz) and the read/calc time seems to take up about 20% of processor time.
I must stress the code does not send data unless requested by the iPhone and even then the data is only a few chars long.
I have put it in DEBUG mode and put a trap in app_error_handler() but I get nothing.
Below is the initialise code which is does execute. Does anyone have any idea what could be going wrong? Thanks
leds_init();
ble_stack_init();
sd_clock_hfclk_request(); // Switch ON XTAL oscillator
while(! p_is_running) { // Wait for the hfclk to be available
sd_clock_hfclk_is_running((&p_is_running));
}
init_mag();
gap_params_init();
services_init();
advertising_init();
conn_params_init();
err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
APP_ERROR_CHECK(err_code);
// Enter main loop.
for (;;)
{
power_manage();
}
}