Home AMX User Forum NetLinx Studio

Missing serial data?

I have a strange problem. I am interfacing a NXI/NXC-ME with a Zyxel 2864i modem using a serial connection. There are 2 ideas: one is to get a 'phone is ringing' signal and the second is to be able to send/receive short messages to GSM cell phones.

I have made a suitable cable for the modem including RTS/CTS from NetLinx and loopbacking DTR/DSR. I can send AT commands and get the result, no problem.

When connected to a PC and the phone rings, the modem sends
RING
FM: 0228500222 TO: 0228500222
and then further RINGs.

It seems I am missing the first RING information. Nothing in the buffer, no system error or anything. All I get is the second and subsequent RING messages. I could live with the delay but it would be nice to show the calling number on the panel!
If without powering it down, I plug the modem in the PC it shows the first RING, so I guess it is sending it!

I tried to disable RTS/CTS, various baud rates, various obscure settings on the modem to make it dumber, no change.
Anybody has an idea? Could the modem be expecting too much from the Netlinx serial ports?

Thanks for any pointers

Fred

Comments

  • jbeamjbeam Posts: 14
    If it's a code issue, it would help to see your serial port configuration , send and recieve code.

    TX

    Jeff
  • frthomasfrthomas Posts: 176
    Here is the event on the serial port device of the NXI. Log is just a rountine that logs to a syslog server. PrintHex returns the string in hex. Both routines work perfectly everywere else.

    DATA_EVENT[dRS232]
    {
    ONLINE:
    {
    Log('dRS232 DE', 'ONLINE');

    SEND_COMMAND dRS232, 'TSET BAUD 57600,N,8,1';
    SEND_COMMAND dRS232, 'HSON';
    }
    OFFLINE:
    {
    Log('dRS232 DE', 'ERROR: OFFLINE');
    }
    STRING:
    {
    Log('dRS232 DE', "'BUFFER: ', PrintHex(gdRS232_Buffer, 1)");

    IF (LENGTH_STRING(gdRS232_Buffer))
    {
    WHILE (FIND_STRING(gdRS232_Buffer, "CR", 1))
    {
    ...
    }
    }
    }
    }

    For now I only send one thing at init time (long after define start)

    SEND_STRING dRS232, "'ATN7E0V1', CR";

    for which I have the expected "'OK', CR" reply in the log.

    Thanks for any pointer

    Fred
  • jbeamjbeam Posts: 14
    Missing serial data?

    I seem to recall serial port problems (dropping characters) for the NXI or NI-x000 on older firmware. Current version on AMX site is v1.00.22 You should probably check both the master and NXI firmware and install the latest. If that doesn't fix it we can delve into the code more.

    TX,
    Jeff
  • frthomasfrthomas Posts: 176
    Using NXI 1.00.22 and NXC-ME 2.30.135, the latest available I think.

    Thanks for the help

    Fred
  • jbeamjbeam Posts: 14
    A couple more questions.
    1). How big is the variable your using for your buffer?
    2). Have you tried to turn on debugging in Netlinx Studio and enter your buffer variable to see what gets recieved from the modem?
    3). Have you tried using the "Pass" command from the terminal to talk to the modem? ( this allows you to verify communications with the modem by connecting to the controller's program port with a terminal program and issuing the command "pass Device:Port:System <enter>" which connects the program port to the serial port with the modem for bi-directional communications. To exit hit ++ Esc Esc.)


    Jeff
  • Chip MoodyChip Moody Posts: 727
    Originally posted by frthomas

    STRING:
    {
    Log('dRS232 DE', "'BUFFER: ', PrintHex(gdRS232_Buffer, 1)");

    IF (LENGTH_STRING(gdRS232_Buffer))
    {
    WHILE (FIND_STRING(gdRS232_Buffer, "CR", 1))
    {
    ...
    }
    }
    }

    No help here with the dropped character problems, but I have a question regarding the code. Since the STRING: handler will only see an event if data comes in to that buffer, why bother checking for string length? Why not nuke the "IF (LENGTH_STRING..." and just use the "WHILE (FIND_STRING..." instead?

    Just curious. It's also after 3 am, and while I can't sleep, my brain may not be working real well.

    - Chip
  • alexanboalexanbo Posts: 282
    You might want to try changing which port on the NXI your using, especially if you have the modem hooked up to port 1.
  • frthomasfrthomas Posts: 176
    Jeff,

    The buffer is 300 bytes. Nothing appearing in the debugger. Printhex is not even called (i.e. no STRING event). I have not tried (3) since for some reason I can't connect using serial to the master.

    alexanbo,

    I am using the second serial port on the NXI, i.e. 5001:2:0. I wonder though what is special about serial port 1?

    Chip,

    I am not certain an empty string is not a valid event. It seems to me you can do SEND_STRING DEV, "''" and the event is trigerred. It seems I do from time to time get such events, f.e. when a device is powered up..
    In any case, the point is valid since the FIND_STRING will take care of this case as well. I'll remove that.


    Thanks to all for your suggestions... keep them coming!

    Fred
  • alexanboalexanbo Posts: 282
    You still might want to change to a different port just to eliminate the hardware itself as a problem. I've heard second hand that people have fixed some odd serial problems just by switching serial ports.
  • jbeamjbeam Posts: 14
    I assume from your code you have a:
    {CREATE_BUFFER dRS232, gdRS232_Buffer}
    in your DEFINE_START section of your program?
    I'd increase the buffer variable size to something like 2048 just in case.

    What does the RX led on the NXI do when your modem rings?

    If when the above is true and you enter debugging, setup a watch variable for "gdRS232_Buffer", cause the modem to send some data and nothing appears in the value field (note you may have to click the value field and scroll with the arrow keys to see data) then i can think of three possibilities.
    1. Bad serial port? Try another ( also does your program have any other serial receive buffers setup for other ports? I have seen interference on axcent3's, ports 1-3 and 4-6 seem to share the same interupt)
    2. Problem with port setup or wiring. ( you seem to have covered this)
    3. Modem not properly initialized. For this you may be able to connect it to your computer and see how the computer initializes the modem . In WIN XP goto Control Panel>Phone and modem options>Modems Tab and click Properties, Click Diagnostics Tab and View log. Look for the modem initialization string(s) and add to your program. (note you may need to dial out once with the modem to see some thing in the log)

    As far as not being able to connect to the master serially (using term) Check your baud rates and cable(null modem cable) ME master has dip switches on the board to set program port baud rate (usually 38400) The master may not respond until you send a "ECHO ON" [Enter] command. Typing "HELP" [Enter] should all list commands including the pass command. (enter commands without quotes)

    Good Luck
    Jeff
  • I just put a thread stating a problem with the RS232 ports unable to handle large of amount of data. I found out that port 2 in the only one that can handle large amounts of data. AMX stated that it is a hardware problem. They should be or have already fixed with the new batch of NI units. I am waiting for confirmation.
  • I have tried to make a PC to NetLinx connector (to modem) cable to test. In that case also I do not get the first ring. So it's the cable, not my NXI eating up serial data.

    But then, what is the problem? I have CTS/RTS/Tx/Rx/GND connected, DTR/CD/DSR connected together... That pretty much makes all pins on a DB9. What could be missing, shield?
    I need to try a good direct cable and test all DB25 pins...

    Thanks for all the help received investigating this issue!

    Fred
  • Fred,

    How long is the cable and what type of wire are you using (guage and solid/stranded)? Also, what type of connectors (crimp, solder, screw-down, RJ-xx adapters)? Is the DTR/DSR jump on the device side or the controler end of the cable?

    KevinK
  • The cable is probably 5 feet long and is a standard molded 1:1 serial cable cut in half, with the wire to pin mapping identified. The DSR/DTR/CD wires are crimped together, the useful cables connected to the Phoenix connector, and the unused cables cut clean (not short but no termination either).

    Thanks for your help

    Fred
Sign In or Register to comment.