Shop OBEX P1 Docs P2 Docs Learn Events
COM port mystery — Parallax Forums

COM port mystery

Don FrenchDon French Posts: 126
edited 2007-02-03 20:17 in General Discussion
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?

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2007-02-03 09:34
    When testing using 2 pc's do you type characters or do you transmit files?
    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
  • Don FrenchDon French Posts: 126
    edited 2007-02-03 15:38
    You are a genius, Peter. Thank you.

    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.
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2007-02-03 16:36
    If you delay 1 second (CPU.delay(10500)) between characters,
    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
  • Don FrenchDon French Posts: 126
    edited 2007-02-03 18:25
    Yes, it still drops characters.· Doesn't the Javelin output +-12V on the COM port?· (See page 65 of the manual)· This is the standard RS232 signal level and I thought that was what the SP237ACT did.· I thought that might be the problem, and maybe it is related, but why would it work on 90% of the characters and drop the other 10%?
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2007-02-03 18:57
    I think the SP237 outputs +/- 10V (charge pump doubles VCC=5V)
    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
  • Don FrenchDon French Posts: 126
    edited 2007-02-03 19:10
    There is an IC between the DB9 and the microcontroller, labeled U2 on the schematic. They don't give a chip ID for it and all that is printed on it is a large 7T followed by a small 64. I wasn't able to ID it. Maybe someone else can. But unless this does level shifting like the Sipex chip on the Javelin board, I guess that it is sending a 3.3V signal to the Javelin RX pin. I don't know enough about it to say if that is problematic or not.

    Maybe you were saying that the SP237ACT expects either 5V or 12V?
  • Don FrenchDon French Posts: 126
    edited 2007-02-03 19:12
    No, I don't see any characters being dropped when I connect the Javelin directly to the PC. (Our previous posts crossed in the ether.)
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2007-02-03 19:23
    I meant connect javelin to tranceiver, connect 2nd tranceiver to pc.
    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
  • Don FrenchDon French Posts: 126
    edited 2007-02-03 19:33
    I drop characters going in both directions. And I drop characters going from PC to PC via transceivers when just typing. Maybe it is the problem you said with the voltage level difference (on the PC as well as on the Javelin), but if the RS232 range is 3-12, you would think it would work. I also think that the software on the transceivers is not written to handle errors. I haven't really dug into it yet but that is my next project. I think I can improve on their firmware.
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2007-02-03 20:17
    Another thing that might be important: according to the schematic,
    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
Sign In or Register to comment.