Windows Serial Port Buffers help needed
william chan
Posts: 1,326
Help! Any MSDN experts out there!
I opened a classic COM port (COM1) using
ComID = CreateFileA(ComName,generic_read + generic_write,0,0,open_existing,0x80,0)
and it opened successfully at 19.2k baud.
I send a character from the PC running Windows XP using
TransmitCommChar(ComID,Ch)
it sends successfully to the Propeller.
The problem is that I have to pace the transmit of chars with a 10ms delay in between or some chars will be lost.
I tried all kinds of buffering using
SetupComm(ComID,64,64)
but it can't seem to properly buffer the transmission. ( slow pacing is still required )
Receiving characters from the Propeller seems to be buffered well.
What is the problem?
Thanks a million.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my
I opened a classic COM port (COM1) using
ComID = CreateFileA(ComName,generic_read + generic_write,0,0,open_existing,0x80,0)
and it opened successfully at 19.2k baud.
I send a character from the PC running Windows XP using
TransmitCommChar(ComID,Ch)
it sends successfully to the Propeller.
The problem is that I have to pace the transmit of chars with a 10ms delay in between or some chars will be lost.
I tried all kinds of buffering using
SetupComm(ComID,64,64)
but it can't seem to properly buffer the transmission. ( slow pacing is still required )
Receiving characters from the Propeller seems to be buffered well.
What is the problem?
Thanks a million.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my
Comments
What, then, about the Propellor side of things? If you have to pace the xmission from the serial port to the Prop, it sounds like the Prop is having "difficulty" in accepting the transmission.
I'm not familiar with the Prop...does it have a dedicated serial port? If so, does it have a buffer? Is 19.2k baud too fast? Etc. In other words, what are the characteristics of the Prop serial port?
DJ
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Instead of:
"Those who can, do.· Those who can't, teach." (Shaw)
I prefer:
"Those who know, do.· Those who understand, teach." (Aristotle)
·
· What serial object are you using on your Prop?· The simple_serial has no buffer.· The FullDuplexSerial has a buffer and I have not had any problems using VS 2008 to do comms with a prop.
I'd not call myself an msdn expert, but here's what I'd try:
First, if I read what you've said correctly, it does work if you slow down the baud rate?
Are your cables correctly wired ? (You might be attempting hardware handshaking without knowing it).
I assume you've tried making the prop buff bigger?
- H
[noparse][[/noparse]EDIT: Well, my post hit after your first several replies --- looks like we're all asking about the same, eh? ]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I'm thinking that your options may be -
1. fix the reason for needing the pacing. This is a relatively slow rate; why is pacing needed?
2. implement either software or hardware handshaking
3. use a slower baudrate
4. have the sending program itself implement the delay between individual character sends
I am quite sure the buffering at the Propeller side is working because if the Propeller is busy with some things, it still can come back and process in the received chars a few seconds later.
David,
The Windows Application that I wrote is actually doing that, adding delays of 10ms between calls to TransmitCommChar(ComID,Ch).
If I remove the delays, chars gets lost.
The same problem exists at 9600 baud.
I don't understand why the pacing is needed either.
I am using the 2 transistor circuit as described in the Propeller datasheet.
CounterRotatingProps,
It works at 19.2k and 9600 bauds but only with pacing.
There are only 4 wires, tx, rx, dtr, and gnd.
Pin 6 and 7 on the 9 pin comm port connector are shorted.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my
I'd be *very* surprised if it was a windows problem. A library problem would also be unlikely.
Which version of the OS and SP are you on, and what are you compiling/scripting with?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I will try the Null modem suggestion.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.fd.com.my
www.mercedes.com.my