|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
I3C (ra8_i3c) controller bring-up self-test for the EK-RA8D2. More...
#include <stdint.h>#include "ra8_board_ek_ra8d2.h"#include "ra8_boot_entry.h"#include "ra8_cgc.h"#include "ra8_err.h"#include "ra8_gpio_constants.h"#include "ra8_i3c.h"#include "ra8_isr.h"#include "ra8_mpc.h"#include "ra8_mstp.h"#include "ra8_port_utils.h"#include "ra8_time.h"Go to the source code of this file.
Enumerations | |
| enum | i3c_demo_const_t : uint32_t { k_i3c_demo_baud = 115200U , k_i3c_demo_period_ms = 1000U , k_i3c_demo_bus_hz = 100000U , k_i3c_demo_iic_channel = 0U } |
| App-wide tunables. More... | |
| enum | i3c_demo_byte_t : uint8_t { k_i3c_demo_probe_addr = 0x43U } |
| Probe address on the I3C ch0 bus. More... | |
Functions | |
| static void | i3c_demo_panic_halt (void) |
| Park forever after a fatal init failure. | |
| static void | i3c_demo_clocks_or_halt (uint32_t *out_pclka_hz) |
Bring CGC + SysTick + MSTP up; return PCLKA via out_pclka_hz. | |
| static void | i3c_demo_pfs_or_halt (void) |
| Route IIC channel-0 SCL/SDA via PFS. | |
| static void | i3c_demo_setup_or_halt (void) |
| Bring CGC + SysTick + console + IIC_B up. | |
| void | main (void) |
| Application entry. | |
Variables | |
| static const ra8_port_pin_t | k_i3c_demo_pin_scl = (ra8_port_pin_t)k_ra8_board_i3c0_pin_scl |
| Pinout for I3C channel 0 (P400 SCL0 / P401 SDA0 on EK-RA8D2), routed to the J27 header (board UM section 5.4.2 Table 31 row J27-1/J27-2 p ~32). | |
| static const ra8_port_pin_t | k_i3c_demo_pin_sda = (ra8_port_pin_t)k_ra8_board_i3c0_pin_sda |
| static const uint8_t | k_i3c_demo_msg_ack [] = "i3c: ctrl init ok | scan 0x43 ack=1\r\n" |
| static const uint8_t | k_i3c_demo_msg_nack [] = "i3c: ctrl init ok | scan 0x43 ack=0\r\n" |
| static const uint8_t | k_i3c_demo_msg_err [] = "i3c: ctrl init ok | bus idle on J27 (bare EVM)\r\n" |
I3C (ra8_i3c) controller bring-up self-test for the EK-RA8D2.
Standalone EVM-tier app that exercises the ra8_i3c controller driver in I2C-compatibility mode (libs/ra8_hal/inc/ra8_i3c.h) on channel 0. The I3C peripheral's ch0 bus (P400 SCL0 / P401 SDA0) routes to the J27 header (board UM section 5.4.2 Table 31), which has no guaranteed on-board device – U15 lives on RIIC ch1 (see i2c_loopback and #46). So this is a controller self-test: it proves ra8_i3c powers up and clocks a real START / address / STOP, not a data round-trip. The flow:
Hardware: bare EK-RA8D2 v1. Attach an I2C device to J27 to see ack=1.
Definition in file main.c.
| enum i3c_demo_byte_t : uint8_t |
| enum i3c_demo_const_t : uint32_t |
|
static |
Bring CGC + SysTick + MSTP up; return PCLKA via out_pclka_hz.
| [out] | out_pclka_hz | Receives the live PCLKA frequency. |
Definition at line 109 of file main.c.
References i3c_demo_panic_halt(), k_ra8_clock_id_cpuclk0, k_ra8_clock_id_pclka, k_ra8_ok, ra8_cgc_get_clock_hz(), ra8_cgc_init(), ra8_mstp_init(), and ra8_time_init().
Referenced by i3c_demo_setup_or_halt().
|
static |
Park forever after a fatal init failure.
Definition at line 92 of file main.c.
Referenced by i3c_demo_clocks_or_halt(), i3c_demo_pfs_or_halt(), i3c_demo_setup_or_halt(), and main().
|
static |
Route IIC channel-0 SCL/SDA via PFS.
Definition at line 137 of file main.c.
References i3c_demo_panic_halt(), k_i3c_demo_pin_scl, k_i3c_demo_pin_sda, k_ra8_ok, k_ra8_pin_0, k_ra8_pin_1, k_ra8_port_4, k_ra8_psel_iic, ra8_mpc_set_open_drain(), and ra8_pfs_route_peripheral().
Referenced by i3c_demo_setup_or_halt().
|
static |
Bring CGC + SysTick + console + IIC_B up.
Panic-halts on any fail.
Pulls PCLKA via ra8_cgc_get_clock_hz so the IIC_B BRR computation tracks whatever clock tree the CGC driver is set to.
Definition at line 171 of file main.c.
References i3c_demo_clocks_or_halt(), i3c_demo_panic_halt(), i3c_demo_pfs_or_halt(), k_i3c_demo_baud, k_i3c_demo_bus_hz, k_i3c_demo_iic_channel, k_ra8_board_led1, k_ra8_board_led2, k_ra8_i3c_mode_i2c, k_ra8_ok, ra8_board_led_init(), ra8_board_uart_console_init(), and ra8_i3c_init().
Referenced by main().
| 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 207 of file main.c.
References i3c_demo_panic_halt(), i3c_demo_setup_or_halt(), k_i3c_demo_iic_channel, k_i3c_demo_msg_ack, k_i3c_demo_msg_err, k_i3c_demo_msg_nack, k_i3c_demo_period_ms, k_i3c_demo_probe_addr, k_ra8_board_led1, k_ra8_ok, ra8_board_led_toggle(), ra8_board_uart_console_write(), ra8_delay_ms(), ra8_i3c_scan(), and ra8_isr_globals_enable().
|
static |
|
static |
|
static |
|
static |
Pinout for I3C channel 0 (P400 SCL0 / P401 SDA0 on EK-RA8D2), routed to the J27 header (board UM section 5.4.2 Table 31 row J27-1/J27-2 p ~32).
No on-board device sits here – this is the I3C peripheral's I2C-compat bus, exercised as a controller self-test.
Definition at line 73 of file main.c.
Referenced by i3c_demo_pfs_or_halt().
|
static |
Definition at line 74 of file main.c.
Referenced by i3c_demo_pfs_or_halt().