刚开始学习这个。也遇到串口不输出的问题。
用的microblaze,加了rs232和4bit LED。
LED可以循环点亮了,但是rs232始终没有输出。
STDIN和STDOUT是选的RS232。ucf 也对过了。
超级终端和EDK里边设置的是115200 8-N-1。但是没有找到EDK里设置停止位的地方。
不知道是怎么回事就是不吐东西。哪位老大可以指点一下?谢啦。
程序如下:
#include "xparameters.h"
#include "xgpio.h"
#include "xgpio_l.h"
#include "xutil.h"
#include "stdio.h"
//====================================================
int main (void)
{
u32 i,j;
Xuint32 *ledptr;
xil_printf("-- xil_printf Start of the Program
--\r\n");
print("-- print Start of the Program --\r\n");
ledptr=(Xuint32 *)0x81400000; //指针指向LED所在的GPIO的基地址
*(ledptr+4)=0x00000000; //初始化该GPIO为输出类型
while (1)
{
*ledptr = 0x0E; //写LED的值
j = 0;
for (i=0; i<10000000; i++) //延迟一会儿
{
j++;
if(j > 0x100000)
break;
}
print("-- *ledptr = 0x0E OK --\r\n"); //打印一下
*ledptr=0x0D;
j = 0;
for (i=0; i<10000000; i++)
{
j++;
if(j > 0x100000)
break;
}
print("-- *ledptr = 0x0D OK --\r\n");
*ledptr=0x0B;
j = 0;
for (i=0; i<10000000; i++)
{
j++;
if(j > 0x100000)
break;
}
print("-- *ledptr = 0x0B OK --\r\n");
*ledptr=0x07;
j = 0;
for (i=0; i<10000000; i++)
{
j++;
if(j > 0x100000)
break;
}
print("-- *ledptr = 0x07 OK --\r\n");
}
}
ucf 文件如下:
############################################################################
## This system.ucf file is generated by Base System Builder based
on the
## settings in the selected Xilinx Board Definition file. Please
add other
## user constraints to this file based on customer design
specifications.
############################################################################
Net sys_clk_pin LOC="P177" | IOSTANDARD = LVTTL;
Net sys_rst_pin LOC="P97" | IOSTANDARD = LVTTL;
## System level constraints
Net sys_clk_pin TNM_NET = sys_clk_pin;
TIMESPEC TS_sys_clk_pin = PERIOD sys_clk_pin 20000 ps;
Net sys_rst_pin TIG;
## IO Devices constraints
#### Module RS232 constraints
Net fpga_0_RS232_RX_pin LOC= "P69" | IOSTANDARD = LVTTL;
Net fpga_0_RS232_TX_pin LOC= "P74" | IOSTANDARD = LVTTL;
#### Module LEDS constraints
Net fpga_0_LEDS_GPIO_d_out_pin<0> LOC= "P61" |
IOSTANDARD = LVTTL;
Net fpga_0_LEDS_GPIO_d_out_pin<1> LOC= "P62" |
IOSTANDARD = LVTTL;
Net fpga_0_LEDS_GPIO_d_out_pin<2> LOC= "P63" |
IOSTANDARD = LVTTL;
Net fpga_0_LEDS_GPIO_d_out_pin<3> LOC= "P64" |
IOSTANDARD = LVTTL;