|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
RIIC (ra8_i2c) controller self-test against the on-board U15. 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_i2c.h"#include "ra8_isr.h"#include "ra8_mpc.h"#include "ra8_mstp.h"#include "ra8_time.h"Go to the source code of this file.
Enumerations | |
| enum | i2c_demo_const_t : uint32_t { k_i2c_demo_baud = 115200U , k_i2c_demo_period_ms = 1000U , k_i2c_demo_bus_hz = 100000U , k_i2c_demo_iic_channel = 1U } |
| App-wide tunables. More... | |
| enum | i2c_demo_byte_t : uint8_t { k_i2c_demo_probe_addr = 0x43U } |
| Probe target – on-board PI4IOE5V6408 I/O port expander U15 at 7-bit address 0x43 (board UM section 4.3.4, p 24). More... | |
Functions | |
| static void | internal_panic_halt (void) |
| Park forever after a fatal initialization failure. | |
| static void | internal_clocks_or_halt (void) |
| Bring CGC + SysTick + MSTP up. | |
| static void | internal_setup_or_halt (void) |
| Bring CGC + SysTick + console + IIC_B up. | |
| void | main (void) |
| Application entry. | |
Variables | |
| static const uint8_t | s_i2c_demo_msg_ack [] = "i2c: scan 0x43 ack=1\r\n" |
| static const uint8_t | s_i2c_demo_msg_nack [] = "i2c: scan 0x43 ack=0\r\n" |
| static const uint8_t | s_i2c_demo_msg_err [] = "i2c: scan ERROR\r\n" |
RIIC (ra8_i2c) controller self-test against the on-board U15.
Standalone EVM-tier app that exercises the ra8_i2c (RIIC) controller driver (libs/ra8_hal/inc/ra8_i2c.h) against the on-board PI4IOE5V6408 I2C I/O port expander (U15) at 7-bit address 0x43 – the only I2C peripheral guaranteed to be populated on a bare EK-RA8D2 v1 (board UM section 4.3.4 "Switch Configuration", p 24). U15 sits on RIIC channel 1 (P512 SCL1 / P511 SDA1), per issue #46. The flow:
Hardware: bare EK-RA8D2 v1 only – U15 is on-board, no jumpers needed.
Definition in file main.c.
| enum i2c_demo_byte_t : uint8_t |
Probe target – on-board PI4IOE5V6408 I/O port expander U15 at 7-bit address 0x43 (board UM section 4.3.4, p 24).
This device is always populated on a bare EK-RA8D2 v1 and ACKs every address-only probe, so a successful scan proves both the bus and the controller are alive.
| Enumerator | |
|---|---|
| k_i2c_demo_probe_addr | I2C demo probe address. |
| enum i2c_demo_const_t : uint32_t |
|
static |
Bring CGC + SysTick + MSTP up.
Initializes the canonical clock tree, samples CPUCLK0, ungates required peripheral modules, and starts the millisecond timebase.
Definition at line 108 of file main.c.
References internal_panic_halt(), k_ra8_clock_id_cpuclk0, k_ra8_ok, ra8_cgc_get_clock_hz(), ra8_cgc_init(), RA8_INTERNAL, ra8_mstp_init(), and ra8_time_init().
Referenced by internal_setup_or_halt().
|
static |
Park forever after a fatal initialization failure.
Repeatedly executes WFI so a debugger can inspect the failed bus or clock state without additional I2C traffic.
Definition at line 88 of file main.c.
References RA8_INTERNAL.
|
static |
Bring CGC + SysTick + console + IIC_B up.
Panic-halts on any fail.
The BSP ra8_board_uart_console_init owns the SCI8 console (PD02 TXD / PD03 RXD pin routing + baud), so the app no longer hand-rolls the SCI bring-up.
Definition at line 140 of file main.c.
References internal_clocks_or_halt(), internal_panic_halt(), k_i2c_demo_baud, k_ra8_board_led1, k_ra8_board_led2, k_ra8_ok, ra8_board_io_expander_apply_project_sw4_defaults(), ra8_board_led_init(), ra8_board_uart_console_init(), and RA8_INTERNAL.
| void main | ( | void | ) |
Application entry.
The application entry point Reset_Handler hands control to.
Brings up CGC + IIC_B + console then probes.
Definition at line 173 of file main.c.
References internal_panic_halt(), internal_setup_or_halt(), k_i2c_demo_iic_channel, k_i2c_demo_period_ms, k_i2c_demo_probe_addr, k_ra8_board_led1, k_ra8_board_led2, k_ra8_ok, ra8_board_led_on(), ra8_board_led_toggle(), ra8_board_uart_console_write(), ra8_delay_ms(), ra8_i2c_scan(), ra8_isr_globals_enable(), s_i2c_demo_msg_ack, s_i2c_demo_msg_err, and s_i2c_demo_msg_nack.
|
static |
|
static |