3231 views|1 replies

144

Posts

0

Resources
The OP
 

[Perf-V Evaluation] Development of Hummingbird Timer Interrupt Based on Perf-V Development Board [Copy link]

Pengfeng Technology provides the Hummingbird E203 soft core for the Perf-V development board. Developers can easily use the RISC-V instruction set for programming applications. This article will try to program based on the Hummingbird E203 soft core.


With the Hummingbird E203 soft core, the Perf-V development board is transformed to the Hbird-B-SDK platform, and its structure is as follows:

We will use the following three header files later:
#include "platform.h" defines the SoC platform related macro definitions
#include "encoding.h" stores the macro definitions of encoding and constants
#include "plic/plic_driver.h" stores the driver code definitions
Based on the Pengfeng Technology three-color LED flashing program, we design a new timer interrupt program;
1. Design requirements
(1) D0 turns on and off every 1s
(2) Use timer interrupt
2. The hardware schematic diagram is as follows:


By querying the VIVADO project file, find out the mapping relationship between the E203 soft core and the FPGA pin as shown in the following table:
Name Direction GPGA pin IO standard E203 name
led_0 OUTPUT P6 LVCMOS33
led_1 OUTPUT K12 LVCMOS33
led_2 OUTPUT M16 LVCMOS33
led_3 OUTPUT P16 LVCMOS33
sw_0 INOUT T15 LVCMOS33

3. Project creation
Create a "test1_gpio" folder under software, create a new test1_gpio.c file, and the code is as follows:
// These buttons are present only on the Freedom E300 Arty Dev Kit.
#ifdef HAS_BOARD_BUTTONS
#define BUTTON_0_OFFSET 15
#define BUTTON_1_OFFSET 30
#define BUTTON_2_OFFSET 31

#define INT_DEVICE_BUTTON_0 (INT_GPIO_BASE + BUTTON_0_OFFSET)
#define INT_DEVICE_BUTTON_1 (INT_GPIO_BASE + BUTTON_1_OFFSET)
#define INT_DEVICE_BUTTON_2 (INT_GPIO_BASE + BUTTON_2_OFFSET)

//Perf-V pin definition list
//Three-color LED pin definition
#define led0_r PIN_1_OFFSET
#define led0_g PIN_2_OFFSET
#define led0_b PIN_3_OFFSET

#define led1_r PIN_19_OFFSET
//#define led1_g PIN_21_OFFSET
//#define led1_b PIN_22_OFFSET

#define led2_r PIN_11_OFFSET
#define led2_g PIN_12_OFFSET
#define led2_b PIN_13_OFFSET

#define btn_0 PIN_15_OFFSET
//#define btn_1 PIN_30_OFFSET
//#define btn_2 PIN_31_OFFSET

//SPI2 pins
//#define ck_ss PIN_26_OFFSET
//#define ck_mosi PIN_27_OFFSET
//#define ck_miso PIN_28_OFFSET
//#define ck_sck PIN_29_OFFSET
//led
#define led_0
#define led_1
#define led_2
#define led_3 PIN_14_OFFSET

4. Write the makefile

Write a makefile file, define the target file as test1_g, specify the header file address and source program, the code is as follows:
"make software PROGRAM=demo_gpio BOARD=Perf-V-creative-board"
5. Download

Download and test

This post is from FPGA/CPLD

Latest reply

Where can I find VIVADO project files?   Details Published on 2021-4-20 17:26
 

1662

Posts

0

Resources
2
 

Where can I find VIVADO project files?

This post is from FPGA/CPLD
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list