rtt_arch.h File Reference

Architecture specific RTT functions for ESP32. More...

Detailed Description

Architecture specific RTT functions for ESP32.

The RTT peripheral driver implements a 32-bit RTT counter with a frequency of 32.768 kHz. It uses either

  • the 48-bit RTC counter if an external 32.678 kHz crystal is connected or
  • the 64-bit microsecond system timer.

For this purpose, a hardware abstraction layer is defined by a driver interface of the type rtt_hw_driver_t, which generally provides a 48-bit RTC counter with a frequency of 32.678 kHz. This way the RTT implementation always sees a 48-bit counter with a frequency of 32.768 kHz regardless of which hardware implementation is actually used.

If pseudomodule esp_rtc_timer_32 is enabled by the board definition and the 32.768 kHz crystal is actually connected, the 48-bit RTC counter is used. Otherwise, the 64 bit microsecond system timer is used.

Since the 64-bit microsecond system timer does not work during light/deep or during a reboot, the status of the 64-bit microsecond system timer is saved in RTC memory before entering a sleep mode or reboot. When leaving the sleep mode or after a reboot, it will be updated from the RTC counter.

Author
Gunar Schorcht gunar.nosp@m.@sch.nosp@m.orcht.nosp@m..net

Definition in file rtt_arch.h.

#include "periph/rtt.h"
+ Include dependency graph for rtt_arch.h:

Go to the source code of this file.

Data Structures

struct  rtt_hw_driver_t
 RTT hardware abstraction layer driver. More...
 
#define RTT_HW_COUNTER_MAX   ((1ULL << 48) - 1)
 Maximum value of the 48-bit RTT hardware counter.
 
uint64_t rtt_pm_sleep_enter (unsigned mode)
 Called before the power management enters a light or deep sleep mode. More...
 
void rtt_pm_sleep_exit (uint32_t cause)
 Called after the power management left light sleep mode. More...
 

Function Documentation

◆ rtt_pm_sleep_enter()

uint64_t rtt_pm_sleep_enter ( unsigned  mode)

Called before the power management enters a light or deep sleep mode.

Parameters
modesleep mode that is entered
Returns
time to sleep in us

◆ rtt_pm_sleep_exit()

void rtt_pm_sleep_exit ( uint32_t  cause)

Called after the power management left light sleep mode.

Parameters
causewake-up cause