Hello,
sd_ble_gap_adv_stop()
returns NRF_ERROR_INVALID_STATE
sd_ble_gap_disconnect(m_connx_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
Disconnects the device, but it reconnects in the following seconds.
Any idea?
Hello,
sd_ble_gap_adv_stop()
returns NRF_ERROR_INVALID_STATE
sd_ble_gap_disconnect(m_connx_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
Disconnects the device, but it reconnects in the following seconds.
Any idea?
If sd_ble_gap_adv_stop() returns NRF_ERROR_INVALID_STATE then you are not advertising when you call it.
and if the device reconnects after disconnecting it it's because the device is set to reconnect after it's been disconnected, what's the device?
If sd_ble_gap_adv_stop() returns NRF_ERROR_INVALID_STATE then you are not advertising when you call it.
and if the device reconnects after disconnecting it it's because the device is set to reconnect after it's been disconnected, what's the device?
THe device is NRF52, i'm using softdevice S132. Ok, if I understand well what you've written, once connected, the device doesn't advertise anymore. I have a wrapper which indicates the end of connection. If I do a
sd_ble_gap_adv_stop()
then, the microcontroler resets (due do hard fault I guess).
You guess? Don't guess, use the debugger to find out, and I'm fairly sure it's not a hardfault, unless you're calling it from an interrupt handler of high priority which is unlikely.
And what does this have to do with your first statement that it returns INVALID STATE? First you say you get a return of invalid state, then you tell me the chip resets, which is it?
Either way, if you get invalid state, you're not advertising. If you're in connection, you're not advertising, if you are no-longer in connection because it's closed, you are still not advertising unless you have restarted advertising.
ok the hard fault was due to an other statement. So, finally, the main question that remains is how to to turn off the radio, using nrf 52 and S132. since radio registers are unavailable due to the use of softdevice.
btw, my ref is this post devzone.nordicsemi.com/.../ the device will reconnect automatically after disconnect, so I guess I have to switch off the automatic reconnection
I need that the device automatically reconnects on timeout disconnect, and it shall not reconnect on user intiated disconnection.