COM port mystery
Don French
Posts: 126
I am trying to use the Parallax Demo board's COM port to do serial communication through a pair of RF transceivers to a PC.· The transceiver is this one from Sparkfun:
http://www.sparkfun.com/commerce/product_info.php?products_id=713
It has a serial port and a RF transciever and is preprogrammed to relay serial communications to another transceiver.· I successfully use a pair of these transceivers to do serial communication between two PC's, using a simple terminal program on both PC's and connecting the transceivers to the PCs through standard PC serial cables.·
I can also successfully use the HypertermCom.java example·program to communicate between the Javelin COM port·and·a PC, also·via a standard serial cable to a PC.
So, the HypertermCom program works, the Parallax·COM port works when attached directly to the PC, and the transceivers work when attached to the serial ports of two PC's.· But when I attach one of the transceivers to the Parallax COM port (through a null modem) and the other transceiver to one of the PCs, I only get the first two characters ever transmitted from the Javelin to the PC.· And I only get those two characters once unless and until·I reset the transceiver.·
The transceiver does not use hardware handshaking, so I used the Uart·constructor appropriate for no handshaking.· Both baud rates are set at 9600 and·8-1-N.
·static Uart txUart = new Uart( Uart.dirTransmit, SERIAL_TX_PIN, Uart.dontInvert, Uart.speed9600, Uart.stop1 );
·static Uart rxUart = new Uart( Uart.dirReceive, SERIAL_RX_PIN, Uart.dontInvert, Uart.speed9600, Uart.stop1 );
So, this sounds like a synchronization problem of some sort, but why do the transceivers work when both are attached to the PCs but not when one is attached to the Parallax port?· Might the 9600 baud rate on the Parallax be off by a significant amount?· But if that is true, why does it work communicating directly from the Parallax port to the PC· with the exact same program?·
Any ideas?
http://www.sparkfun.com/commerce/product_info.php?products_id=713
It has a serial port and a RF transciever and is preprogrammed to relay serial communications to another transceiver.· I successfully use a pair of these transceivers to do serial communication between two PC's, using a simple terminal program on both PC's and connecting the transceivers to the PCs through standard PC serial cables.·
I can also successfully use the HypertermCom.java example·program to communicate between the Javelin COM port·and·a PC, also·via a standard serial cable to a PC.
So, the HypertermCom program works, the Parallax·COM port works when attached directly to the PC, and the transceivers work when attached to the serial ports of two PC's.· But when I attach one of the transceivers to the Parallax COM port (through a null modem) and the other transceiver to one of the PCs, I only get the first two characters ever transmitted from the Javelin to the PC.· And I only get those two characters once unless and until·I reset the transceiver.·
The transceiver does not use hardware handshaking, so I used the Uart·constructor appropriate for no handshaking.· Both baud rates are set at 9600 and·8-1-N.
·static Uart txUart = new Uart( Uart.dirTransmit, SERIAL_TX_PIN, Uart.dontInvert, Uart.speed9600, Uart.stop1 );
·static Uart rxUart = new Uart( Uart.dirReceive, SERIAL_RX_PIN, Uart.dontInvert, Uart.speed9600, Uart.stop1 );
So, this sounds like a synchronization problem of some sort, but why do the transceivers work when both are attached to the PCs but not when one is attached to the Parallax port?· Might the 9600 baud rate on the Parallax be off by a significant amount?· But if that is true, why does it work communicating directly from the Parallax port to the PC· with the exact same program?·
Any ideas?
Comments
If you type characters, it may be the javelin sends out characters too fast.
Have you tried a delay between sending characters?
char[noparse]/noparse text = new char[noparse]/noparse{'H','e','l','l','o',' ','w','o','r','l','d','\r','\n',0};
int i=0;
while (text[noparse][[/noparse]i]!=0) {
· tx.sendByte(text[noparse][[/noparse]i]); //send character
· while (!tx.sendBufferEmpty()) ; //wait until character transmitted
· CPU.delay(105); //wait some time, 105 equals 10msec
· i++;
}
regards peter
I am still dropping every 10th character on average, but it is independent of the delay between characters. This is not related to the Javelin, however, as it happens between the two PCs too.
do you then still miss characters?
The schematic on the web link above, shows the device rx/tx interface
uses 3.3V and steals negative voltage from its rx pin.
The 3.3V may be the cause (Javelin is designed for 5V).
regards peter
but the device outputs (-10V / +3.3V) according to schematic.
Officially anything between +3 to +12V and -3V to -12V is valid for rs232 level.
Are the characters dropped when receiving on pc (eg. transmitted from javelin)
or vice versa?
regards peter
Maybe you were saying that the SP237ACT expects either 5V or 12V?
Do you then miss characters transmitting from javelin, or transmitting from pc?
The SP237 operates from 5V and generates +/-10V.
I talked about the rx/tx interface of the rf device.
In this schematic
http://www.sparkfun.com/datasheets/RF/RF-24G-Dev-Schematic.pdf
to the right of the DB9 connector.
There is a 10uF cap that is supposed to keep the negative level
at the negative level of the rx input.
The tx output switches between this negative level and +3.3V.
This 3.3V may be problematic to the rx input of the SP237
regards peter
there is a hardware feedback between rs-in and rs-out. It may be that
some transitions on the rs-in pin may appear on the rs-out pin
due to·resistor R6. That could interfere with data being transmitted
out of the rs-out pin, hence missing some characters.
regards peter