1. Software Installation
1. First, install the NIOS II development kit. Use virtual CD-ROM software, such as DAEMON, to map the NIOS II V1.0 BUILD316E.ISO file to the virtual CD-ROM.
Click the CD-ROM icon to automatically run the installation program.
Select the first option, Install.
Select the Next button.
When asked whether to accept the agreement, select Yes. Press Yes for the next option and continue.
If you are a beginner, you can choose the last option. You can choose a language you are familiar with for Examples. It is recommended to select all other options.
Select the installation directory of QuartusII. If it is not C: drive, specify it from the Browse option. For example, e: alterakits ios2.
Next, select a program group. Generally, just press Next.
Start the installation. It takes about a few minutes to copy files.
Click Finish. An IE format document pops up. It is recommended that you read the Example Designs option carefully. You can have a better understanding of the configuration and routines of the NIOS II CPU, which will be very helpful for future debugging.
In this way, the development software is installed. Let's run our first program quickly.
2. Hello LED program debugging
1. First, back up the Example directory. Because we are going to modify the files in the directory, it is better to keep a copy. Once the modification is damaged, it can be restored. Enter the directory E: alterakits ios2 (my QuartusII is installed in the E: drive), back up the example directory, and name it example_old.
2. Enter E: alterakits ios2examplesverilog iosII_cyclone_1c20, delete the low_cost directory, and copy the low_cost.rar file we provided, and compress it at the same time to extract a low_cost directory with the same name. 3. Start
QuartusII 4.1; select File -》Open Project, or Cntl+J to open the low cost project.
After opening the project, you can see a system named low_cost_1c20. The last option in the View menu can be used to select whether to display pin allocation information.
Select the appropriate chip model (EP1C6Q240C8 for EFA-CY1C6, EP1C12Q240C8 for EFA-CY1C6):
A. Select the Assignments menu, and then select the first item: Device.
B.
Select the model of the chip on the board in Available device
. The above dialog box appears. Be sure to select No, otherwise the pin assignment will be lost.
C. Set other unused pins.
First select Device & Pin Options and see the following screen.
Open the Unused Pins tab,
select the first item, and set all unused pins to input state and set them to tri-state.
After the above processing, you can compile and download the program.
Compile the project
.
Select Start compilation from the Processing menu, or Cntl + L to start compiling. If a warning message appears, you can ignore it and wait for the compilation to end.
Configure FPGA
Select Programmer from the Tools menu, select JTAG mode and the corresponding sof file, click Start,
start downloading, and if successful, then start entering the software debugging environment.
Start NIOS II IDE environment
Close Programmer and open the top-level file. The shortcut is to click the icon
Double-click the low_cost_1C20 system module to enter SOPC Builder.
Select Run Nios II IDE to enter the IDE development environment.
Create a software project file
Select File -> New -> Project option.
Select C/C++ Application and click Next.
Select Hello LED from the template, set other settings as default, and click Finish.
Compile the project file
Select hello_led_0, right-click, and select Build Project
.
After the completion, the console in the lower right corner will prompt that the compilation is completed.
Run the program
Select Run -> Run... from the menu, and a dialog box will pop up
Click New to automatically generate a system configuration.
Click Apply, then click Run.
Start downloading the program to SDRAM and running it.
Observe the 4 LEDs on the board. The LEDs will flash once every 4 seconds.
Congratulations, your first C program is running on the NIOSII CPU.
If you are interested, you can modify the source file, then compile and run to see what changes the LED has
.
Here is an example to make the LED flash more frequently:
int main (void) __attribute__ ((weak, alias ("alt_main")));
/*
* Use alt_main as entry point for this free-standing application
*/
int alt_main (void)
{
alt_u8 led = 0x2;
alt_u8 dir = 0;
volatile int i;
/*
* Infinitly shift a variable with one bit set back and forth, and write
* it to the LED PIO. Software loop provides delay element.
*/
while (1)
{
if (led & 0x09) // There are only 4 LEDs on our board, so when Bit3 and Bit0 of led are valid,
// change direction;
{
dir = (dir ^ 0x1);
}
if (dir)
{
led = led >> 1;
}
else
{
led = led << 1;
}
IOWR_ALTERA_AVALON_PIO_DATA(LED_PIO_BASE, led);
/*
* The delay element in this design has been written as a while loop
* to avoid confusing the software debugger. A tight, one line software
* delay loop such as:
* for(i=0; i<200000; i++);
* can cause problems when it is stepped through using a software
debugger.
* The while loop below produces the same behavior as the for loop shown
* above, but without causing potential debugger problems.
*/
i = 0;
while (i<100000) //加快闪烁间隔
i++;
}
return 0;
}
Previous article:How to use and tips for electronic simulation software MultiSIM
Next article:Easy-to-understand modelsim learning notes
Recommended ReadingLatest update time:2024-11-16 15:49
- High signal-to-noise ratio MEMS microphone drives artificial intelligence interaction
- Advantages of using a differential-to-single-ended RF amplifier in a transmit signal chain design
- ON Semiconductor CEO Appears at Munich Electronica Show and Launches Treo Platform
- ON Semiconductor Launches Industry-Leading Analog and Mixed-Signal Platform
- Analog Devices ADAQ7767-1 μModule DAQ Solution for Rapid Development of Precision Data Acquisition Systems Now Available at Mouser
- Domestic high-precision, high-speed ADC chips are on the rise
- Microcontrollers that combine Hi-Fi, intelligence and USB multi-channel features – ushering in a new era of digital audio
- Using capacitive PGA, Naxin Micro launches high-precision multi-channel 24/16-bit Δ-Σ ADC
- Fully Differential Amplifier Provides High Voltage, Low Noise Signals for Precision Data Acquisition Signal Chain
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- EEWORLD University - Simplifying Digital Power Supply
- Excuse me, what is this component with silk screen 6023?
- Analysis of the working principles of seven types of three-pole emitter DC circuits (updated)
- Design and implementation of FIR filter in DSP
- Some Allegro practical skills that PCB Layout engineers regret not knowing earlier
- Buck-Boost and Step-Up Converters in Wireless Security Cameras and Video Doorbells
- EEWORLD University Hall----Operating System Zhejiang University (Li Shanping)
- TI CapTIvate technology adds capacitive touch capabilities to stoves
- PCB short circuit problem
- Fanuc PLC help newbie