QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 2152|回复: 8

关于模拟USART的问题

[复制链接]
发表于 2007-12-13 21:30:10 | 显示全部楼层 |阅读模式
我现在用的是skyeye 1.23。

最近在调试 USART的读写程序(个人按照手册的提示写的)
但是我这边因为用的是笔记本,所以没有 串行口 因此,我想问一下如何使用键盘作为USART的输入,终端作为USART的输出。或者以普通文件作为USART的输入和输出。

谢谢赐教。

另外,想问一下,如何在skyeye中人为模拟产生硬件中断信号,比如CPU进入休眠状态,那么人为的在skyeye中模拟一个外部中断信号来将CPU唤醒,请问这个唤醒的外部中断如何在skyeye中模拟?
发表于 2007-12-14 16:54:42 | 显示全部楼层
1. 当前skyeye默认用键盘和终端来作为usart的模拟输入和输出。具体代码在device/uart/skyeye_uart_stdio.c
2. 在每一个开发板模拟代码中的io_do_cycle函数,如skyeye_mach_ep7312.c的io_do_cycle函数。设置中断标志,并且跳转PC到中断处理函数
回复

使用道具 举报

 楼主| 发表于 2007-12-15 17:29:15 | 显示全部楼层
可是我这边的代码无法被正常执行。

我的C代码如下


  1. void app(void){
  2.   long* USART_THR=(long*)0xfffd001c;
  3.   long* USART_RHR=(long*)0xfffd0018;
  4.   long* USART_CSR=(long*)0xfffd0014;
  5.   long stat;
  6.   while(1){
  7.     stat=*USART_CSR;
  8.     if(stat&0x001){
  9.       *USART_THR='M';
  10.     }
  11.   }
  12.   while(1);
  13.   return;
  14. }
复制代码


我的skyeye的配置文件

  1. #skyeye config file sample
  2. cpu: arm7tdmi

  3. mach: at91

  4. mem_bank: map=M,type=RW,addr=0x01000000,size=0x00400000,file=app.bin,boot=yes
  5. mem_bank: map=I,type=RW,addr=0xf0000000,size=0x10000000
  6. log: logon=0,logfile=./sk1.log,start=0,end=200000
复制代码


当我向用键盘输入时,什么也没反应。可是按照代码,我每次输入都应该输出一个M的。
回复

使用道具 举报

发表于 2007-12-17 10:27:55 | 显示全部楼层
Please read helloworld example in this board.
http://www.linuxfans.org/bbs/thread-82187-1-1.html
You will get some idea from it.
回复

使用道具 举报

 楼主| 发表于 2007-12-20 20:55:23 | 显示全部楼层
那个我看过了,我的代码是按照手册上来的。应该没有问题的。

而且,我可以在屏幕上输出数据,但是,不能从键盘读数据
回复

使用道具 举报

发表于 2007-12-21 10:32:46 | 显示全部楼层
Try to debug it. I also think that should not be the mistake of SkyEye. At least uCos and uClinux for at91 can run correctly on SkyEye.
回复

使用道具 举报

 楼主| 发表于 2007-12-22 22:33:17 | 显示全部楼层
调试过了,代码没有问题。那如果既不是我的问题,按照KSH的说法,也不是skyeye的问题~,那这个是谁的问题呢?
我觉得推卸责任不是解决之道,不知道KSH接下来是不是又要说,It maybe the matter of your computer,.....???
回复

使用道具 举报

发表于 2007-12-23 23:24:52 | 显示全部楼层
I read the source code of skyeye and datasheet. There is two issues:
1. Perhaps RCR register need to be initialized before read data to RHR. Is it necessary? I am not familiar with the usart of AT91. There is a description related to it:
RXCTR must be loaded with the size of the receive buffer.

2. The implementation of SkyEye also is not incompletely. CSR is not set correctly.

Thanks your report.

[ 本帖最后由 ksh 于 2007-12-24 00:01 编辑 ]
回复

使用道具 举报

发表于 2007-12-23 23:59:08 | 显示全部楼层

回复 #5 北斗星君 的帖子

I read the source code of skyeye and datasheet. There is two issues:
1. Perhaps RCR register need to be initialized before read data to RHR. Is it necessary? I am not familiar with the usart of AT91. There is a description related to it:
RXCTR must be loaded with the size of the receive buffer.

2. The implementation of SkyEye also is not incompletely. CSR is not set correctly.

Thanks your report.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-6-8 02:30 , Processed in 0.255328 second(s), 16 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表