118 __asm__
volatile(
"wfi");
135 uint32_t cpuclk0_hz = 0U;
252 c6_probe_puts(link_live ?
"c6_probe: PASS esp-hosted link up mode="
253 :
"c6_probe: FAIL no esp-hosted frame mode=");
289 bool link_live =
false;
303 c6_probe_puts(
"c6_probe: pull-up contest failed; map falls back to votes\r\n");
330 c6_probe_puts(
"\r\nc6_probe: EK-RA8D2 <-> ESP32-C6 esp-hosted SPI probe\r\n");
331 c6_probe_puts(
"c6_probe: pmod1 sci2 simple-spi controller, cs on P804\r\n");
void main(void)
Secure fallback main entry point.
Shared contract for the EK-RA8D2 <-> ESP32-C6 esp-hosted SPI probe.
@ k_c6_sb_count
Side-band pin count.
ra8_err_t c6_probe_spi_pins_init(void)
Route the Pmod1 SPI pins to SCI2 and own the chip-select as GPIO.
const char * c6_probe_sideband_name(uint8_t idx)
Name a side-band pin for the console.
@ k_c6_probe_uart_baud
Console baud (J-Link OB VCOM).
@ k_c6_probe_boot_wait_ms
Let the C6 finish booting.
@ k_c6_probe_idle_ms
Background heartbeat period.
@ k_c6_probe_sck_hz
Conservative first-light SCK rate.
void c6_probe_puts(const char *text)
Emit a bounded, NUL-terminated ASCII literal on the console.
bool c6_probe_sweep_mode(ra8_spi_mode_t mode, uint32_t pclka_hz, c6_probe_stats_t *st, uint8_t *hs_idx)
Run the transaction burst for one SPI mode.
void c6_probe_put_u32(uint32_t value)
Emit an unsigned integer in decimal.
void c6_probe_sample_sideband(c6_sideband_sample_t *out)
Read every Pmod1 side-band pin into one sample.
void c6_probe_print_sideband(const char *label, const c6_sideband_sample_t *s)
Print a labelled side-band sample as label P006=1 P402=0 ....
ra8_err_t c6_probe_pull_contest(c6_probe_stats_t *st)
Find which side-band pins an external driver is holding low.
@ k_c6_probe_min_votes
Votes required to claim a mapping.
@ k_c6_probe_mode_count
SPI modes swept.
ra8_err_t c6_probe_sideband_init(void)
Claim the four Pmod1 side-band pins as no-pull digital inputs.
uint8_t c6_probe_best(const uint32_t *votes, uint8_t ignore, uint32_t min_votes)
Pick the side-band pin that won the vote outright, or report none.
void c6_probe_wire_test(void)
Run the drive-and-release test over every Pmod1 muxed net.
uint8_t c6_probe_cs_hunt(c6_probe_stats_t *st)
Find which MCU pin the board's Pmod1 mux has wired to the C6's chip-select, and identify HANDSHAKE at...
void c6_probe_resolve_map(const c6_probe_stats_t *st, uint8_t *hs_idx, uint8_t *dr_idx)
Resolve the HANDSHAKE and DATA_READY side-band map from the accumulated evidence.
static uint32_t s_c6_pclka_hz
Cached PCLKA rate, the SCI baud-clock source.
static void c6_probe_setup_or_halt(void)
Bring clocks, console, LEDs and side-band inputs up.
static void c6_probe_print_verdict(const c6_probe_stats_t *st, ra8_spi_mode_t mode, bool link_live)
Print the single-line PASS / FAIL verdict.
static const ra8_spi_mode_t k_c6_mode_order[k_c6_probe_mode_count]
SPI modes tried, most likely first.
static void c6_probe_clocks_or_halt(void)
Bring CGC, MSTP and SysTick up, caching PCLKA.
static void c6_probe_run(void)
Sweep the SPI modes, resolve the side-band map, report the outcome.
static c6_probe_stats_t s_c6_stats
Accumulated probe evidence for the final verdict and pin map.
static void c6_probe_print_map(const c6_probe_stats_t *st, uint8_t hs_idx, uint8_t dr_idx)
Print the resolved DATA_READY / HANDSHAKE side-band map.
static void c6_probe_panic_halt(void)
Park forever after a fatal initialisation failure.
Board-support layer for the Renesas EK-RA8D2 v1 evaluation kit.
ra8_err_t ra8_board_led_toggle(ra8_board_led_id_t led)
Toggle led's output state.
ra8_err_t ra8_board_led_init(ra8_board_led_id_t led)
Configure led as a digital output, initial level low (off).
ra8_err_t ra8_board_led_on(ra8_board_led_id_t led)
Drive led HIGH (light it).
@ k_ra8_board_led2
LED2, GREEN, P303 (jumper E26).
@ k_ra8_board_led1
LED1, BLUE, P600 (jumper E27).
ra8_err_t ra8_board_uart_console_init(uint32_t baud)
Configure SCI8 + PD02/PD03 as the debug-console UART.
Boot entry points shared between a vector table and its startup code.
High-level Clock Generation Circuit driver.
ra8_err_t ra8_cgc_get_clock_hz(ra8_clock_id_t id, uint32_t *out_hz)
Query the current frequency of a clock-tree domain.
@ k_ra8_clock_id_cpuclk0
Cortex-M85 CPUCLK0.
@ k_ra8_clock_id_pclka
PCLKA.
ra8_err_t ra8_cgc_init(void)
Configure the clock tree to a safe default.
Error Code Definitions for ra8-firmware.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
NVIC + ICU IELSR allocator.
void ra8_isr_globals_enable(void)
Globally enable maskable interrupts (PRIMASK = 0).
Ref-counted Module Stop Control wrapper for the RA8D2.
ra8_err_t ra8_mstp_init(void)
Re-establish the ra8_mstp ref-count table from current hardware state.
SPI_B controller driver (RA8D2 Type-B SPI peripheral).
ra8_spi_mode_t
CPOL / CPHA combinations.
@ k_ra8_spi_mode_0
CPOL=0, CPHA=0.
@ k_ra8_spi_mode_3
CPOL=1, CPHA=1.
@ k_ra8_spi_mode_1
CPOL=0, CPHA=1.
@ k_ra8_spi_mode_2
CPOL=1, CPHA=0.
SysTick-based tick counter, delay and timestamp helpers.
ra8_err_t ra8_time_init(uint32_t cpu_hz)
Initialise SysTick for a 1 kHz tick interrupt.
void ra8_delay_ms(uint32_t ms)
Busy-wait for at least ms milliseconds.
Running evidence gathered across every transaction.
uint8_t pull_low[k_c6_sb_count]
Reads that lost to an external sink.
uint8_t ever_high[k_c6_sb_count]
Pin was seen high at least once.
uint32_t hs_vote[k_c6_sb_count]
Pin dropped while CS was asserted.
uint32_t attempts
Transactions clocked.
uint32_t idle_frames
Idle filler frames decoded.
uint32_t dr_vote[k_c6_sb_count]
Pin dropped once the queue drained.
uint32_t data_frames
Real frames with a good checksum.
uint8_t pull_samples
Pull-up reads per pin; 0 = not run.
uint8_t ever_low[k_c6_sb_count]
Pin was seen low at least once.
uint32_t bad_csum_frames
Sane shape, checksum mismatched.
One simultaneous reading of every side-band pin.