Remove 32 kHz oscillator self-test

Reliable oscillator start-up requires several hundred milliseconds which
is longer than we are willing to wait at every boot. We could add an
on-demand test in the future instead of an automatic self-test.
This commit is contained in:
Michael Ossmann
2025-11-25 20:31:44 -05:00
parent 95e7e2a009
commit cde5d754d3
3 changed files with 0 additions and 34 deletions

View File

@@ -39,12 +39,10 @@
#include "ice40_spi.h"
#include "platform_detect.h"
#include "clkin.h"
#include "selftest.h"
#include <libopencm3/lpc43xx/cgu.h>
#include <libopencm3/lpc43xx/ccu.h>
#include <libopencm3/lpc43xx/scu.h>
#include <libopencm3/lpc43xx/ssp.h>
#include <libopencm3/lpc43xx/creg.h>
#if (defined HACKRF_ONE || defined PRALINE)
#include "portapack.h"
@@ -898,29 +896,6 @@ void cpu_clock_init(void)
CGU_BASE_SSP1_CLK =
CGU_BASE_SSP1_CLK_AUTOBLOCK(1) | CGU_BASE_SSP1_CLK_CLK_SEL(CGU_SRC_PLL1);
#ifndef RAD1O
/* Enable 32kHz oscillator */
CREG_CREG0 &= ~(CREG_CREG0_PD32KHZ | CREG_CREG0_RESET32KHZ);
CREG_CREG0 |= CREG_CREG0_EN32KHZ;
/* Allow 1ms to start up. */
delay_us_at_mhz(1000, 204);
/* Use frequency monitor to check 32kHz oscillator is running. */
CGU_FREQ_MON = CGU_FREQ_MON_RCNT(511) | CGU_FREQ_MON_CLK_SEL(CGU_SRC_32K);
CGU_FREQ_MON |= CGU_FREQ_MON_MEAS_MASK;
while (CGU_FREQ_MON & CGU_FREQ_MON_MEAS_MASK)
;
uint32_t count =
(CGU_FREQ_MON & CGU_FREQ_MON_FCNT_MASK) >> CGU_FREQ_MON_FCNT_SHIFT;
// We should see a single count, because 511 cycles of the 12MHz internal
// RC oscillator corresponds to 1.39 cycles of the 32768Hz clock.
selftest.rtc_osc_ok = (count == 1);
if (!selftest.rtc_osc_ok) {
selftest.report.pass = false;
}
#endif
#if (defined JAWBREAKER || defined HACKRF_ONE || defined PRALINE)
/* Disable unused clocks */
/* Start with PLLs */

View File

@@ -40,9 +40,6 @@ typedef struct {
#endif
uint8_t si5351_rev_id;
bool si5351_readback_ok;
#ifndef RAD1O
bool rtc_osc_ok;
#endif
#ifdef PRALINE
bool sgpio_rx_ok;
bool xcvr_loopback_ok;

View File

@@ -22,7 +22,6 @@
#include <stdio.h>
#include <stddef.h>
#include <usb_queue.h>
#include <libopencm3/lpc43xx/cgu.h>
#include "usb_api_selftest.h"
#include "selftest.h"
#include "platform_detect.h"
@@ -95,11 +94,6 @@ void generate_selftest_report(void)
}
append(&s, &c, "\n");
#endif
#ifndef RAD1O
append(&s, &c, "32kHz oscillator: ");
append(&s, &c, selftest.rtc_osc_ok ? "PASS" : "FAIL");
append(&s, &c, "\n");
#endif
#ifdef PRALINE
append(&s, &c, "SGPIO RX test: ");
append(&s, &c, selftest.sgpio_rx_ok ? "PASS" : "FAIL");