jrowberg / bglib

BGLib implementation for Bluegiga BLE Bluetooth Smart modules
Other
239 stars 170 forks source link

ble_cmd_gap_end_procedure fails to stop when in scanning mode #13

Open cookieman459 opened 10 years ago

cookieman459 commented 10 years ago

Great lib btw. I ran into one major issue so far though. I can get everything working except terminating a scan in BGLib_scanner.ino (your included demo). It scans fine, etc. but pressing 2 a second time just seems to die (the call seems to go out, but no return) The scan keeps going, but there seems to be no way to stop it.

The only mod I made was changing the BLE_WAKEUP_PIN to match my wiring, and setting Serial to 38400 (I'm running on a 8mhz chip)

I was able to get the peripheral setup 100% working, paired to another BLE device, etc.

jamesfowkes commented 9 years ago

I've found the same behaviour using the Python API.

It appears that the end procedure is sent to the BLE module, but it doesn't get round to processing it until several seconds later. I presume this is due to scan response packets continuing to come in, and that they're processed with a higher priority than API commands.

I've had to change the API such that it waits for the ble_rsp_gap_end_procedure response after sending the command. It means the timeout doesn't work though (so the scan period is variable).

sridharrajagopal commented 9 years ago

I think I've run into a similar issue. I terminate the scan automatically if there is no response for a while. The terminate seems to be fine ( I get an end_procedure response), but cannot reinitiate a scan (set_scan_parameters & gap_discover) - I don't get back responses from those calls.