DE0上的NIOSII点灯程序分析

最近刚刚开始学习NIOSII和DE0,准备记录下过程中的点点滴滴,也还请各位多多指教~~~~~~

     DE0上的点灯程序分析

1

CPU

2

SDRAM

3

4

Flash

5 6

上面是SOPC中的组件,其中SDRAM和Flash的时序我看了一下手册但是也没有搞太明白,还请DE0 的高手们多多指教,谢谢了,其中Flash采用的是8位模式。

QuartusII中的引脚分配,昨天搞了一天才稍微明白了Flash的什么8位模式和16位模式的接法,老是提示CFI连接不上。把引脚分好之后就没有提示这个错误了。

 

 

image

然后接下来是软件的开发了。

先建立一个SOPC.h文件

 

//sopc.h

#ifndef SOPC_H_
#define SOPC_H_

#include "system.h"
#define _LED

typedef struct 
{
    unsigned long int DATA;
    unsigned long int DIRECTION;
    unsigned long int INRERRUPT_MASK;
    unsigned long int EDGE_CAPTURE;
}PIO_STR;

#ifdef _LED
#define LED ((PIO_STR*)LED_BASE)
#endif

#endif /*SOPC_H_*/


和main.c文件

/*
 * "Hello World" example.
 *
 * This example prints 'Hello from Nios II' to the STDOUT stream. It runs on
 * the Nios II 'standard', 'full_featured', 'fast', and 'low_cost' example
 * designs. It runs with or without the MicroC/OS-II RTOS and requires a STDOUT
 * device in your system's hardware.
 * The memory footprint of this hosted application is ~69 kbytes by default
 * using the standard reference design.
 *
 * For a reduced footprint version of this template, and an explanation of how
 * to reduce the memory footprint for a given application, see the
 * "small_hello_world" template.
 *
 */

#include <stdio.h>
#include<unistd.h>

#include"../inc/sopc.h"

int main()
{
  int i;
  while(1)
  {
    for(i=0;i<4;i++)
    {
        LED->DATA=1<<i;
        usleep(500000);
    }
  }
  return 0;
}

 

接下了就是程序的下载了,先在Quartus中把硬件下进去,再在IDE中下软件的时候出现的问题如下:

Invalid project path: Missing project folder or file: \altera.components\bin for Output path.        altera.components    (这是IDE下面problem的提示)

 

然后console中的提示是

Using cable "USB-Blaster [USB-0]", device 1, instance 0x00
Pausing target processor: OK
Reading System ID at address 0x00401018: verified
Initializing CPU cache (if present)
OK

Downloading 01000020 ( 0%)
Downloaded 28KB in 0.4s (70.0KB/s)

Verifying 01000020 ( 0%)
Verify failed between address 0x1000020 and 0x1006D13
Leaving target processor paused

我很奇怪的是我在SOPC中都没有用到address 0x1000020 and 0x1006D13,我不明白这是哪儿来的,要是哪位知道的话麻烦告诉我一声啊,O(∩_∩)O~

 

重新看了SDRAM(A3v64s40ETP-G6后的配置)如下:

但是好像还是没有找到那个T_ac 和t_wr.

posted on 2010-08-06 09:34  齐威王  阅读(1652)  评论(2编辑  收藏  举报

导航