Blinky from Scratch for FPB‐RA0E1 - YukikoDate/IoT GitHub Wiki

Getting Started with FPB-RA0E1

This guide helps you get started with the RA0E1 Fast Prototyping Board (FPB-RA0E1) using e² studio and the Flexible Software Package (FSP).

📄 Original Document (PDF)


Overview

This tutorial covers:

  • Setting up the development environment
  • Creating a new FSP project
  • Blinking an LED on the FPB-RA0E1 board
  • Debugging and running the project

Requirements

  • Board: FPB-RA0E1
  • IDE: e² studio (2024-01.1 or later)
  • FSP: Version 5.2.0 or later
  • Cable: USB Micro-B

Step 1: Install e² studio

  1. Download Renesas e² studio & FSP from GitHub.
  • Please download the appropriate file for your operating system from the Release Notes section. If you're using Windows, click the "here" link inside the red box.

Step 2: Create a New Project

  1. Launch e² studio.
  1. Select File > New > Renesas C/C++ Project > Renesas RA.

"Renesas RA C/C++ Project " and click "Next".

  1. Project name Write any name and click "Next"
  1. Choose FPB-RA0E1 as your board.
  1. Confirm the settings in the red framed areas and click "Next.
  1. Set the following:
    • Artifact Type: Executable
    • RTOS: No RTOS
  1. Set Template type Bare Metal - Minimal
  • Bare Metal - Blinky will generate an application which toggles all on board LEDs determined from the BSP using a simple software delay.
  • Bare Metal - Minimal will generate an empty application with basic C-runtime setup but no executable code.

Step 3: Configure FSP

  1. Open the Configuration.xml file.
  1. Set up the clock tree.

In the program being described we require a timer with period 500ms. As this cannot be created with a supply clock (CK00) of 32MHz we must reduce it down to a more sensible value of 62.5kHz. Click TAU CK00 Div /1 and select TAU CK00 Div /512 from the list.

  1. Configure pins to control LED1 (P008).
  1. Set the "Mode" to Output mode (Initial High)
  1. Control LED2 (P009), set the "Mode" to Output mode (Initial Low)
  1. Select the "Stack" tab
  1. Select "New Stack"

Select Timers > Timer, Independent Channel, 16-bit and 8-bit Timer Operation (r_tau)


Step 4: Add Code to Main Function

#include "hal_data.h"

void R_BSP_WarmStart(bsp_warm_start_event_t event)
{
    if (BSP_WARM_START_POST_C == event)
    {
        R_IOPORT_PinWrite(&g_ioport_ctrl, BSP_IO_PORT_02_PIN_05, BSP_IO_LEVEL_HIGH);
    }
}

void hal_entry(void)
{
    while (1)
    {
        R_IOPORT_PinWrite(&g_ioport_ctrl, BSP_IO_PORT_02_PIN_05, BSP_IO_LEVEL_HIGH);
        R_BSP_SoftwareDelay(500, BSP_DELAY_UNITS_MILLISECONDS);
        R_IOPORT_PinWrite(&g_ioport_ctrl, BSP_IO_PORT_02_PIN_05, BSP_IO_LEVEL_LOW);
        R_BSP_SoftwareDelay(500, BSP_DELAY_UNITS_MILLISECONDS);
    }
}


Step 5: Build and Debug

  1. Click Build Project in e² studio.
  2. Connect the FPB-RA0E1 board to your PC via USB.
  3. Click Debug to program and run the code on the hardware.

✅ You should see the onboard LED blink at 1Hz.