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

BLE with SPI doesn´t reconnect once bluetooth has been disabled and enabled again.

I'm currently working with nrf52832 implementing bluetooth and spi functionalities. The bluetooth connection to PC is working fine, it connects and after that starts transfering and receiving data from SPI slave. The problem comes once I decide to turn bluetooth off on the PC. It connects and disconnects constantly. It also happens once I turn off/on the power button on the SDK.

Here it is the main code and the spi configuration:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
int main(void)
{
bool erase_bonds;
ret_code_t err_code;
spi_configuration();
APP_ERROR_CHECK(nrf_drv_clock_init());
nrf_drv_clock_lfclk_request(NULL);
log_init();
err_code = app_timer_init();
APP_ERROR_CHECK(err_code);
motion_timer_init();
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

If spi_configuration() and laser_frame() are commented, the problem when reconnecting disappears. Any idea? Thanks!