Shop OBEX P1 Docs P2 Docs Learn Events
Dual UART problems ATTN: Gunther Daubach and anyone else — Parallax Forums

Dual UART problems ATTN: Gunther Daubach and anyone else

John WhitfieldJohn Whitfield Posts: 42
edited 2005-06-04 00:26 in General Discussion
I have been having endless troubles with this program. The main problems are occuring on the first UART which runs at 1200 baud with seven data bits and two stop bits. I get mostly correct and wholy verifiable data out of the second UART which runs at 9600 baud. When connected to a terminal program or logic analyzer: the first UART puts out no changes on·pin RB7. It appears to be sending some kind of output on the oscilloscope, but that could be some kind of random problem, I'm not sure. It could be that I'm still not getting the hardware setup right. The device I'm using METEX M-3850D is supposed to operate as RS232C, but the realterm terminal program only recognizes the device as RS485. It is imperative that this code be completed as soon as possible, so anyone with any ideas on hardware or software please post them. I am now the only one working on this project, so the situation is dire.

-John Whitfield

Comments

  • John WhitfieldJohn Whitfield Posts: 42
    edited 2005-06-02 22:33
    This code contains the changes Gunther suggested in another thread.
  • John WhitfieldJohn Whitfield Posts: 42
    edited 2005-06-02 23:47
    One other thing, it constantly puts out the data on the second UART regardless of whether or not the device is plugged into the first UART. It seems to be the same data over and over again.
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-06-03 00:33
    I own a M3850 myself and it does operate as RS232 device.

    I use the attached windows program to display/log DMM values to the PC.

    Please confirm your DMM·port operates correctly.

    regards peter
  • John WhitfieldJohn Whitfield Posts: 42
    edited 2005-06-03 00:57
    I have already used the program that comes with the multimeter and it works perfectly, the problem is a matter of communicating with the SX. The device does not operate as a standard RS232 device like the speakjet, which is the device on the second UART which works properly. The manual says it is RS232C, but I have not seen any DB-9 pin configuration that operates in the same manner it does. If anyone has any advice on this it would be appreaciated.

    Thanks,
    -John Whitfield
  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2005-06-03 07:38
    John,

    doing the right RS-232 protocol on one hand means correctly sending the serial data (speed, bit count, number of stop bits, polarity, and eventualy a parity bit) but - on the other hand, it eventually also requires that a hardware handshake is handled correctly, e.g. on the RTS and CTS lines.

    The SX UART code you are using does not handle any handshake. I don't know the M3850, so I can't say if it requires handshake, or not. But before taking care of that matter, you should verify that the 1200 Baud UART is sending data, and you can do this with an oscilloscope. For testing, you might use a main program loop which constantly sends out a specific character via the UART. In this loop, don't forget to test the tx_count variable being zero before preparing the UART for sending another character.

    In the source code you have posted, I noticed that you invert the data bits when writing to the TX port pins. Please double-check if this is necessary. Nevertheless, using the test, described before, polarity does not matter because you should first verify if the UART is sending at all.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Greetings from Germany,

    G
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-06-03 07:42
    John,

    I read your code and your protocol is correct.

    You send 'D' to the DMM and it responds with 14 bytes, but only

    if DTR is on (I tested it with a PC and terminal program).

    So the DMM pin that connects to PC com port pin 4 (DB9) must

    be on. So you need 4 wires from the SX to the DMM.

    GND, RX, TX, DTR

    I did not find in your code that you turn on DTR.

    regards peter
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-06-03 07:45
    Also, RTS has no effect and you do need a RS232 level shifter like a MAX232.
    regards peter
    ·
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2005-06-03 09:20
    Correction on my last reply:

    DTR must be on and RTS must be off!

    Here is the M3850 cable layout

    DMM pins

    o o o·· o o

    | | |··· | |······ DB25F· DB9F· name(PC)
    | | |··· | +----··· 3······ 2······· RX········ output from DMM
    | | |··· +
    ·· 20······4······ DTR······· input to DMM
    | | +
    ··· 4····· 7······ RTS········input to DMM
    | +
    ··· 2······ 3········TX········ input to DMM
    +
    ·· 7······· 5······ GND

    If you use a MAX232 you can tap the DTR signal from MAX232 pin 6 (V-)
    and RTS signal from MAX232 pin 2 (V+)
    (I believe V- is on and V+ is off, If nothing happens, swap these)


    regards peter

    ·
  • John WhitfieldJohn Whitfield Posts: 42
    edited 2005-06-03 20:19
    I tried what you said using a max 233 chip and the program is still sending out the same codes to the speakjet as before, I am going to try and rewrite the algorithm for the comparison code of the program since I think it may be getting stuck there.

    Thanks,
    -John
  • John WhitfieldJohn Whitfield Posts: 42
    edited 2005-06-04 00:26
    Using the voltages -10V at pin 7 and +10V at pin 4 works, as far as fooling the terminal program, but the SX is still caught in an infinite loop. I rewrote the code and it is doing much the same thing as before, meaning it is sending out codes from the SendDigit section. I am going to post the new code in a new thread.

    -John Whitfield
Sign In or Register to comment.