Vision Board Series Tutorial | Key Interrupt Experiment

RT-Thread IoT OS
4 min readJust now

--

Preparation

  • A computer running Windows 10 or 11
  • A FAT32 formatted SD card (recommended)
  • A Type-C data cable (recommended)
  • Renesas RA8D1 Vision Board

Resource Acquisition
The shared network drive contains essential development tools for Vision Board development:
Download Link

Before you begin development, ensure that the following four software tools are installed:

  • RT-Thread Studio
  • Compiler Toolchain
  • Renesas FSP 5.1.0
  • OpenMV-IDE

Install RT-Thread Studio IDE

  1. Visit RT-Thread Studio to download and install the IDE.

Install the FSP Configuration Tool

  1. Download and install the FSP tool.
  2. Follow the on-screen instructions to complete the installation process.

Experiment 1: FSP Configuration and Key Interrupt

In this experiment, we will configure the FSP and implement a Key Interrupt using RT-Thread Studio. Let’s get started!

1. Open RT-Thread Studio and select New → RT-Thread Project:

2. Choose to create a new project for the Vision Board development board, and select BSP version 1.3.0.

3. If prompted that the toolchain or download tool is missing, click “OK” to download it (ensure your computer is connected to the internet).

4. Next, proceed to compile the project:

The image below confirms a successful compilation:

5. Click the “Download” button to flash the successfully compiled firmware onto the development board.

Experimental Outcome: The blue LED on the front of the development board will blink at 500ms intervals.

6. Now, let’s open the FSP configuration for this project.

7. Ensure that the RASC 5.1.0 software from the provided data package is installed. Then, return to RT-Thread Studio, double-click on “RA Smart Configurator,” and follow the prompts to choose the installation directory.

8. Select the sc_v2023-10_fsp_v5.1.0 directory, and the FSP configuration software will open automatically.

9. Now, let’s configure the button as an external interrupt pin. First, open the Vision Board schematic:

10. Open the second page of the PDF and locate the user button section. Analysis: When the button is pressed, the pin is pulled low, which means the interrupt trigger mode is set to falling edge trigger.

11. Find the pin number corresponding to KEY0: P907

12. Next, open FSP, and you’ll see that the P907 pin corresponds to interrupt channel 10.

13. Next, enable IRQ10 and bind it to the P907 pin.

14. Next, go back to the Stack interface and select New Stack -> Input -> External IRQ.

15. Following the analysis above, we will configure the 10 channels as shown below:

16. Finally, the underlying driver code is generated:

17. Finally, the underlying driver code will be generated:

18. Next, return to the RT-Thread Studio project and open hal_entry.c:

#include <rtthread.h>
#include <rtdevice.h>
#include "hal_data.h"
#define IRQ_TEST_PIN    "p907"void irq_callback_test(void *args)
{
rt_kprintf("\n IRQ10 triggered \n");
}
void hal_entry(void)
{
/* init */
rt_uint32_t pin = rt_pin_get(IRQ_TEST_PIN);
rt_kprintf("\n pin number : 0x%04X \n", pin);
rt_err_t err = rt_pin_attach_irq(pin, PIN_IRQ_MODE_FALLING, irq_callback_test, RT_NULL);
if(RT_EOK != err)
{
rt_kprintf("\n attach irq failed. \n");
}
err = rt_pin_irq_enable(pin, PIN_IRQ_ENABLE);
if(RT_EOK != err)
{
rt_kprintf("\n enable irq failed. \n");
}
}

19. After compiling and flashing the firmware onto the development board, open the serial terminal. When the USER BOOT button on the development board is pressed, the following information will be displayed:

--

--

RT-Thread IoT OS

An Open-Source Community-Powered Real-Time Operating System (RTOS) Project! Let’s develop, DIY, create, share, and explore this new IoT World together!