Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - ERROR – Reading serial port (devc-ser8250): (3 Items)
   
ERROR – Reading serial port (devc-ser8250)  
Context:
•	CPU : x86 (CME137686LX)
•	QNX : 6.3.2
Using Serial Ports CPU (ser1 and SER2) and an expansion card (SER3 ... ser6); devc-ser8250 driver provided by QNX.
Serial port configuration :
devc-ser8250 -b9600 -E -F -u1 3F8,0x4 &
devc-ser8250 -b9600 -E -F -u2 2F8,0x3 &
devc-ser8250 -b9600 -E -F -u3 100,0x5 &
devc-ser8250 -b9600 -E -F -u4 108,0x6 &
devc-ser8250 -b9600 -E -F -u5 110,0x7 &
devc-ser8250 -b9600 -E -F -u6 118,0x9 &

Software:
The software attached software is a test. I use this same implementation in much bigger software.
The serial port is configured as follows:
•	Baudrate: 115200bauds
•	Parity: None
•	Stop bit: 1
•	Number of bits: 8
For read on a serial port I use the notification system QNX (_NOTIFY_ACTION_TRANARM).
In front I use a Windows application that sends messages to high frequency; generating a data stream of about 60Kbit/s.

Problem:
Sometimes when reading, the read function indicates you have read more byte requested.
For example, I ask reading two bytes. The read function tells me to read 3, 4, etc ... bytes. Strange! Normally is 
impossible?
These characters seem to be read, but I am not well provided. They are not in my buffer and ask if I read these are not 
present.

Tests:
I've done other tests, no effect:
•	Using different serial ports
•	Using different CPU
•	Using different IRQ
•	Using _NOTIFY_ACTION_POLLARM.
Using a simple read (blocking or not) or a select corrects this problem. This solution does not satisfy me because this 
implies the complete modification my software (thread, etc.).

Does anyone have a solution? Maybe my implementation is not it ok? ... I have no idea...

Thank you in advance
Attachment: Text test.c 6.36 KB
Re: ERROR – Reading serial port (devc-ser8250)  
I advanced on my problem.

I worked on the source files ddk-devc-ser8250 and in particular on the part io-char. I found some potential errors in 
the code; io_read part. Access to certain variables (nbBytes, bup-> cnt, ...) are not properly protected.
After correction, I have no problem reading that returns a value greater than nbBytes

I have another problem that was already there before, but that seemed to me to be the same.
Randomly reading the serial port 2x return me the same character.
Example:
I sent: 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19
I read: 0x10 0x11 0x12 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19

Has anyone ever had this problem?
Someone he had problems with the devc-ser8250 driver?
Someone he had problems with the io-char library?

Thank you in advance
Re: ERROR – Reading serial port (devc-ser8250)  
I found a workaround for my problem:

I use the 8250 driver as follows :
devc-ser8250 -b9600 -E –F –t1 -u3 100,0x5 -b9600 -E –F –t1 –u4 108,0x6 -b9600 -E –F –t1 –u5 110,0x0c -b9600 -E 
–F –t1 –u6 118,0x0f &

Sharing IT problem. I am also obliged to use a 1 FIFO to prevent OVERRUN