c - 我无法从 UART/Nios 读取

标签 c vhdl fpga nios

我已经在我的 FPGA 中包含了一个 UART 组件,并且我已经编写了这个示例代码来输出一个字符(我想测试它是否工作):

  #include <alt_types.h>
#include <altera_avalon_pio_regs.h>
#include <altera_avalon_uart_regs.h>
#include <sys/alt_irq.h>
#include <sys/alt_alarm.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include "system.h"

int main(void)
{
int filed;
int x=0;
unsigned char c=5;
filed = open ("dev/uart_0", O_RDWR| O_NOCTTY );
while (x<10){
write (filed, &c,1);
x++;
}

}

我正在使用realterm读取输出,但没有出现任何内容,有什么帮助吗? 谢谢

最佳答案

谢谢大家,我做了一个修改,一切都很好,而不是写:filed = open ("dev/uart_0", O_RDWR| O_NOCTTY ); 我写filed = open("dev/uart_0", O_RDWR); 我真的不知道为什么它有效,如果有人有答案请告诉我:)

关于c - 我无法从 UART/Nios 读取,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28947220/

相关文章:

c - 串行通讯不工作。读取文件出错

c - 使用指向字符的指针作为 strtok 的参数

C:节点移除

在 C 中工作时,在 Rust 中使用 Linux 的直接渲染管理器在 dumbuffer 上调用 mmap 失败

vhdl - 是否有与Verilog的@(*)等效的VHDL,即自动过程敏感性列表

fpga - 从 PC 读取 FPGA block RAM

c - 我没有得到 C 程序所需的输出

entity - VHDL 你能在同一个文件中声明一个包和一个实体吗?

matlab - simulink中仿真和HDL代码生成的区别

vhdl - 如何在 FPGA 中实现无限循环?