Loading...
Searching...
No Matches
hardware_rosc

Ring Oscillator (ROSC) API. More...

Functions

void rosc_disable (void)
 Disable the Ring Oscillator.
 
void rosc_set_dormant (void)
 Put Ring Oscillator in to dormant mode.
 
void rosc_restart (void)
 Re-enable the ring oscillator so that the processor cores can wake up after sleep/dormant mode.
 
uint rosc_measure_freq_khz (void)
 Measure the frequency of the Ring Oscillator.
 
static void rosc_write (io_rw_32 *addr, uint32_t value)
 Checked write to a Ring Oscillator register.
 

Detailed Description

Ring Oscillator (ROSC) API.

A Ring Oscillator is an on-chip oscillator that requires no external crystal. Instead, the output is generated from a series of inverters that are chained together to create a feedback loop. RP2 chips boot from the ring oscillator initially, meaning the first stages of the bootrom, including booting from SPI flash, will be clocked by the ring oscillator. If your design has a crystal oscillator, you’ll likely want to switch to this as your reference clock as soon as possible, because the frequency is more accurate than the ring oscillator.

Function Documentation

◆ rosc_measure_freq_khz()

uint rosc_measure_freq_khz ( void  )

Measure the frequency of the Ring Oscillator.

This will only be accurate if clk_ref is currently running from an accurate source (eg the XOSC).

Returns
The frequency of the Ring Oscillator in kHz.

◆ rosc_restart()

void rosc_restart ( void  )

Re-enable the ring oscillator so that the processor cores can wake up after sleep/dormant mode.

This must be called at the end of the sleeping period (e.g., in an interrupt service routine)

◆ rosc_set_dormant()

void rosc_set_dormant ( void  )

Put Ring Oscillator in to dormant mode.

The ROSC supports a dormant mode, which stops oscillation until woken up up by an asynchronous interrupt. This can either come from the RTC, being clocked by an external clock, or a GPIO pin going high or low. If no IRQ is configured before going into dormant mode the ROSC will never restart.

PLLs should be stopped before selecting dormant mode.

◆ rosc_write()

static void rosc_write ( io_rw_32 *  addr,
uint32_t  value 
)
inlinestatic

Checked write to a Ring Oscillator register.

This would normally clear the bad write flag and asserts that the write is okay. However, ROSC BADWRITE is not reliable (see RP2040-E10) so we don't do this.

Parameters
addrThe register address.
valueThe value to write.