|
|
|
|
|
 Re: 串口接收数据出错 - tpu [ 2008-01-29 12:44 | 123 byte(s)]
 Re: 串口接收数据出错 - tpu [ 2008-02-01 12:45 | 51 byte(s)]
 Re: 串口接收数据出错 - sunwen_ling [ 2008-02-01 19:55 | 161 byte(s)]
 Re: 串口接收数据出错 - edisonlive4u [ 2008-02-02 11:56 | 922 byte(s)]
|
|
|
|
[Original]
[Print]
[Top]
|
在arm9平台下扩展了一个SC16C550的芯片,驱动就用的现成的8250.c,只是添加了一些配置信息(定义了 STD_SERIAL_PORT_DEFNS这个宏,主要是配置基地址,中断等信息 ,并在8250.c的serial8250_init函数里初始化了这个扩展芯片,主要是配置它的基地址,中断等信息,这里的信息是和STD_SERIAL_PORT_DEFNS中的信息是匹配的),现在采用的是中断,fifo模式
现象:
接收数据的时候,如果对方发送一个字节,那这边是无法收到的(此时中断是产生了,产生的是超时中断,但是读取LSR的寄存器的时候,总是认为没有收到数据),如果对方发送4个字节,第一个字节也是收不到的,即收到了3个字节。
这种问题的原因是什么呢?如何解决呢?
|
|
|
[Original]
[Print]
[Top]
|
|
[Original]
[Print]
[Top]
|
真是用的SC16C550?啥也不说了,换SC16C550B,或者换ST16C550。
SC16C55x是philip第一代产品,有BUG。用也要用带B后缀的。
|
|
|
----
精益求精!
|
|
[Original]
[Print]
[Top]
|
|
[Original]
[Print]
[Top]
|
这两个脚是用于流量控制的,一般来讲没用,就算你要接一个modem,大部分时间也是没用的。
从产品的角度,如果modem说需要,那你最好要,如果只是debug可以先不用。
|
|
|
----
知之为知之,不知为不知,是知也!
|
|
[Original]
[Print]
[Top]
|
|
[Original]
[Print]
[Top]
|
看到SC16C550的Application Notes里面有这么几句话:
1. READING THE ISR REGISTER
Whenever reading the ISR register, the LCR bit 7 must be set to ‘0’.
=》我是否需要在读取中断寄存器之前要把LCR的bit 7设置为0?
5.DISABLE RECEIVE DATA TIMEOUT INTERRUPT
When the receive holding interrupt is enabled (IER bit 0 = 1) and the receiver receives a number of characters, the software must read the receive FIFO before the receive timeout interrupt is generated (refer to the data sheet to calculate the timeout). If the receive timeout interrupt is generated, the software must read all the data in the receive FIFO before disabling the receive ready interrupt.
=》我如何做到在中断之前来读取接收FIFO呢?
此外附件中是SC16C550和SC16C550B的区别,这里面好像等待LSR的bit7为0之后才能读取中断寄存器。其它的还需要注意些什么呢?
|
|
|
--
|
|
[Original]
[Print]
[Top]
|
|
|