Hi nordic community
I am trying to send stop command to my device(which is connected to my NRF 52840) from my ble module(NRF 52480) after my android disconnected from the ble module. so i put the stop command function in the BLE_GAP_EVT_DISCONNECTED event occurs. But my ble module doesn't send the data to my device.
I am using ble_app_uart example
SDK: | nRF5_SDK_15.2.0_9412b96 |
Softdevice: | 132_nrf52_6.1.0_softdevice.hex |
case BLE_GAP_EVT_DISCONNECTED: // LED indication will be changed when advertising starts. printf ("report 0\r"); stop_command_init(); m_conn_handle = BLE_CONN_HANDLE_INVALID; isConnected = false; NRF_LOG_INFO("GAP Disconnected"); sd_nvic_SystemReset(); break;
here is the stop command function
static void Data_init(void) { static const uint8_t Stop_com[] = "STOP"; size_t length = sizeof(Stop_com) / sizeof(Stop_com[0]); int i; uint32_t err_code; memset (lastCommand, 0, 256); strncpy (lastCommand, (char *) Stop_com,length-1); for (i = 0; i < length-1; i++) { do { err_code = app_uart_put(Stop_com[i]); // NRF_LOG_INFO("Data ver is set to 0x%X(%d)", Events[i],length-1); if ((err_code != NRF_SUCCESS) && (err_code != NRF_ERROR_BUSY)) { NRF_LOG_ERROR("Failed receiving NUS message. Error 0x%x. ", err_code); APP_ERROR_CHECK(err_code); } } while (err_code == NRF_ERROR_BUSY); } while (app_uart_put('\r') == NRF_ERROR_BUSY); NRF_LOG_INFO("Command sent %s (%d)", Stop_com,length-1); }