Browse Source

Check if we use LFXO and guard with 2 second timeout for broken crystals

pull/1939/head
Wessel Nieboer 3 months ago
parent
commit
fc75cff712
No known key found for this signature in database GPG Key ID: 929C8E45E33B5FD2
  1. 13
      src/helpers/nrf52/SerialBLEInterface.cpp

13
src/helpers/nrf52/SerialBLEInterface.cpp

@ -134,9 +134,18 @@ void SerialBLEInterface::begin(const char* prefix, char* name, uint32_t pin_code
// On fast boots (filesystem already formatted), Bluefruit.begin() can
// be called before the crystal is stable, hanging sd_softdevice_enable().
// See: https://github.com/meshcore-dev/MeshCore/issues/1780
while (!NRF_CLOCK->EVENTS_LFCLKSTARTED) {
delay(1);
#ifdef USE_LFXO
{
uint32_t lfclk_start = millis();
while (!NRF_CLOCK->EVENTS_LFCLKSTARTED) {
if (millis() - lfclk_start >= 2000) {
Serial.println("WARNING: LFXO crystal did not start within 2s — check 32.768kHz crystal");
break;
}
delay(1);
}
}
#endif
// If we want to control BLE LED ourselves, uncomment this:
// Bluefruit.autoConnLed(false);

Loading…
Cancel
Save