sandeepmistry / arduino-BLEPeripheral

An Arduino library for creating custom BLE peripherals with Nordic Semiconductor's nRF8001 or nR51822.
MIT License
463 stars 180 forks source link

Freeze on blePeripheral.begin(); #291

Closed jLynx closed 3 years ago

jLynx commented 3 years ago

Hi

I have just designed a NRF51822 board and all my test code seems to be working apart from getting bluetooth to work.

My code always seems to freeze on the line blePeripheral.begin();

Looking at the LED sketch, it freezes on line 38 https://github.com/sandeepmistry/arduino-BLEPeripheral/blob/161a4163f565be3cd5b62bbc59f0c2b522d82b02/examples/led/led.ino#L38

Here is my config: image

(Note: Right now there is no antenna on the board as I am waiting for it to show up, but I doubt that will have anything to do with the code not executing)

If you need any more information please let me know.

Here is the function it freezes on https://github.com/sandeepmistry/arduino-BLEPeripheral/blob/161a4163f565be3cd5b62bbc59f0c2b522d82b02/src/BLEPeripheral.cpp#L71

jLynx commented 3 years ago

Seems like there are a few other people with the same issue, but lacking detail.

jLynx commented 3 years ago

Seems like it could be an issue with the BLE_REQ, BLE_RDY, BLE_RST pins. Will update if I find any more information

jLynx commented 3 years ago

Here is my basic schematic image

jLynx commented 3 years ago

If I understand correctly, they should all be -1? I have tried this but still no success

jLynx commented 3 years ago

Fixed my issue! The fix was to select RC Oscillator instead of Crystal Oscillator image

https://github.com/sandeepmistry/arduino-BLEPeripheral/blob/161a4163f565be3cd5b62bbc59f0c2b522d82b02/src/nRF51822.cpp#L106

jLynx commented 3 years ago

As much as this has fixed the initial issue to get me going, I have found that the RC Oscillator is using the internal RC oscillator and not the External 32.768 kHz crystal (Crystal Oscillator). Will be doing more research into why its not able to start with this selected. I am assuming it something to do with this line image maybe with the accuracy being off with my crystal

LiveRock commented 2 years ago

can we reconfig BLE_REQ, BLE_RDY, BLE_RST pins?