First of all, I would like to thank the forum for giving me the opportunity to evaluate the RA8D1. The Renesas RA8D1 MCU series is the industry's first 32-bit graphics microcontroller (MCU) based on the Arm Cortex -M85 (CM85) core. It can achieve breakthrough performance of more than 3000 CoreMark scores at 480 MHz and support high-resolution display and excellent graphics capabilities for visual AI applications. The evaluation board is also very beautiful and has rich IO interfaces. RA8D1 development supports two IDE platforms, e2studio and MDK. This time, the MDK environment was set up.
The software packages required for the RA8D1 MDK development environment are as follows
The installation is relatively simple, the default installation is OK, and then the project construction test is carried out. The purpose of this experiment is to realize the LED lighting and serial port test based on FreeRTOS.
First open Renesas RA Smart Configurator 5.4.0 and select the chip
Click next
Choosing FreeRTOS
First, set the clock. From the schematic diagram, we know that the external crystal oscillator is 24MHz, and the project default is 20MHz. We need to change it.
Next, configure the LED interface and create an LED thread. From the schematic diagram, we can see that the LED pin is PA01.
The IO configuration is as follows
Create led Thread and configure it as follows
Then click Create Project to generate the project as follows
Open the project and the generated directory is as follows
Compile it
First write a LED flashing, 2 times per second,
void led_thread_entry(void *pvParameters)
{
FSP_PARAMETER_NOT_USED(pvParameters);
/* TODO: add your own code here */
while (1)
{
R_IOPORT_PinWrite(&g_ioport_ctrl, BSP_IO_PORT_10_PIN_01, BSP_IO_LEVEL_LOW);
vTaskDelay(100);
R_IOPORT_PinWrite(&g_ioport_ctrl, BSP_IO_PORT_10_PIN_01, BSP_IO_LEVEL_HIGH);
vTaskDelay(400);
}
}
Configure the burning settings. First, add the download algorithm
There is a problem with the default download algorithm space, and the download will prompt an error
Modify the configuration
Modify as follows
The settings are completed and the lamp is turned on successfully.
Next, add a serial port thread and perform a printf redirection test. From the schematic diagram, we can see that serial port 3 is connected to the onboard JLink serial port.
Open the graphical configuration through MDK
Set the serial port clock
Configure serial port 3 pin
Add UART3_Thread
Configure Serial Port 3
Click Generate Code
Compile it and it will show an error.
This is caused by not adding a callback function. Now add a callback function and write a serial port loopback test first.
#include "uart3_thread.h"
/* uart3_thread entry function */
/* pvParameters contains TaskHandle_t */
void uart3_thread_entry(void *pvParameters)
{
FSP_PARAMETER_NOT_USED(pvParameters);
fsp_err_t err = FSP_SUCCESS;
err = R_SCI_B_UART_Open (&g_uart3_ctrl, &g_uart3_cfg);
assert(FSP_SUCCESS == err);
/* TODO: add your own code here */
while (1)
{
vTaskDelay(1000);
}
}
/* 发送完成标志 */
volatile bool uart_send_complete_flag = false;
/* 串口中断回调 */
void uart3_callback (uart_callback_args_t * p_args)
{
switch (p_args->event)
{
case UART_EVENT_RX_CHAR:
{
/* 把串口接收到的数据发送回去 */
R_SCI_B_UART_Write(&g_uart3_ctrl, (uint8_t *)&(p_args->data), 1);
break;
}
case UART_EVENT_TX_COMPLETE:
{
uart_send_complete_flag = true;
break;
}
default:
break;
}
}
Burn test
Printf redirection, printing test
int fputc(int ch, FILE *f)
{
(void)f;
R_SCI_B_UART_Write(&g_uart3_ctrl, (uint8_t *)&ch, 1);
while(uart_send_complete_flag == false);
uart_send_complete_flag = false;
return ch;
}
void uart3_thread_entry(void *pvParameters)
{
FSP_PARAMETER_NOT_USED(pvParameters);
fsp_err_t err = FSP_SUCCESS;
/* 初始化串口3 */
err = R_SCI_B_UART_Open (&g_uart3_ctrl, &g_uart3_cfg);
assert(FSP_SUCCESS == err);
/* TODO: add your own code here */
while (1)
{
printf("CPU : RA8D1BH, 主频: %dMHz\r\n", SystemCoreClock / 1000000);
vTaskDelay(1000);
}
}
At this point, the environment construction test is completed
Summary: Renesas' MDK environment is very simple to build, the graphical configuration is very convenient and easy to use, and the design of STACKS graphical configuration is more intuitive.