|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Deep-Sleep mode (LPMD=0, SCR.SLEEPDEEP=1) one-shot wake demo. More...
#include <stdint.h>#include "ra8_attributes.h"#include "ra8_board_ek_ra8d2.h"#include "ra8_boot_entry.h"#include "ra8_cgc.h"#include "ra8_err.h"#include "ra8_isr.h"#include "ra8_lpm.h"#include "ra8_lpm_regs.h"#include "ra8_time.h"Go to the source code of this file.
Enumerations | |
| enum | lpm_deep_config_t : uint32_t { k_lpm_deep_park_blink_ms = 500U , k_lpm_deep_baud = 115200U } |
| Compile-time tunables for the deep-sleep demo. More... | |
Functions | |
| static void | internal_lpm_deep_panic_halt (void) |
| Park forever after a fatal low-power demo failure. | |
| static void | internal_lpm_deep_setup_or_halt (void) |
| Bring CGC + SysTick + LED1 + SCI8 + LPM up. | |
| void | main (void) |
| Application entry. | |
Variables | |
| static const uint8_t | s_lpm_deep_msg_boot [] = "lpm_deep: boot\r\n" |
| Fixed UART banners emitted before and after the Deep-Sleep cycle. | |
| static const uint8_t | s_lpm_deep_msg_woke [] = "lpm_deep: woke\r\n" |
| volatile uint32_t | g_lpm_deep_pre_count = 0U |
| Counter bumped right BEFORE the Deep-Sleep entry. | |
| volatile uint32_t | g_lpm_deep_wake_count = 0U |
| Counter bumped right AFTER waking from Deep-Sleep. | |
Deep-Sleep mode (LPMD=0, SCR.SLEEPDEEP=1) one-shot wake demo.
Demonstrates Cortex-M85 Deep Sleep (the second-shallowest LPM state) on the EK-RA8D2. LPSCR.LPMD stays at 0 (System Active) but SCR.SLEEPDEEP is asserted before WFI so the core power-gates more aggressively than plain Sleep. SysTick is the wake source.
Sequence:
No external hardware required – bare EK-RA8D2.
Definition in file main.c.
| enum lpm_deep_config_t : uint32_t |
|
static |
Park forever after a fatal low-power demo failure.
Repeats wait-for-interrupt without initiating another low-power transition, preserving the wake and setup state for a debugger.
Definition at line 118 of file main.c.
References RA8_INTERNAL.
Referenced by internal_lpm_deep_setup_or_halt(), and main().
|
static |
Bring CGC + SysTick + LED1 + SCI8 + LPM up.
Initializes the clock and time base, board status LED, UART console, and LPM policy required for the single Deep-Sleep transition. Any dependency failure enters the permanent panic halt.
Definition at line 143 of file main.c.
References internal_lpm_deep_panic_halt(), k_lpm_deep_baud, k_ra8_board_led1, k_ra8_clock_id_cpuclk0, k_ra8_lpm_dcssmode_128us, k_ra8_lpm_ss2lp_default, k_ra8_ok, ra8_board_led_init(), ra8_board_uart_console_init(), ra8_cgc_get_clock_hz(), ra8_cgc_init(), RA8_INTERNAL, ra8_lpm_init(), and ra8_time_init().
Referenced by main().
| void main | ( | void | ) |
Application entry.
The application entry point Reset_Handler hands control to.
Performs one Deep-Sleep cycle, emits the wake banner, then parks in a normal blink loop.
Definition at line 192 of file main.c.
References g_lpm_deep_pre_count, g_lpm_deep_wake_count, internal_lpm_deep_panic_halt(), internal_lpm_deep_setup_or_halt(), k_lpm_deep_park_blink_ms, k_ra8_board_led1, k_ra8_ok, k_ra8_sleep_mode_deep_sleep, ra8_board_led_toggle(), ra8_board_uart_console_write(), ra8_delay_ms(), ra8_isr_globals_enable(), ra8_lpm_enter_sleep(), s_lpm_deep_msg_boot, and s_lpm_deep_msg_woke.
| volatile uint32_t g_lpm_deep_pre_count = 0U |
Counter bumped right BEFORE the Deep-Sleep entry.
Externally readable via SWD memprobe. Lets future regression-bisects distinguish "LPM init crashed" (this counter stays 0) from "Deep-Sleep entry crashed" (this counter increments once, g_lpm_deep_wake_count stays 0).
Definition at line 88 of file main.c.
Referenced by main().
| volatile uint32_t g_lpm_deep_wake_count = 0U |
|
static |