-2

I'm having an issue connecting a serial device to an embedded device I'm writing code for.

The device I am writing has two serial ports, an incoming from my laptop, and an outgoing to an external device.

When I connect both terminals to my laptop and view the data, I get exactly the data I am expecting.

When I connect my laptop to the external device directly, I am getting exactly what I expect, and a response.

When I connect the laptop and the external device to the embedded device I am working on, the laptop sends data to it, it receives it, it passes it on to the external device. This works as expected.

However, the external device doesn't send back the response.

If I send data to the external device from the embedded device, each new message I send allows it to send the original reply.

I know the first message got through correctly because the external device whirrs to live, and I know when it is sending the response by running and logic analyser on the tx/rx comms and viewing the traffic.

I considered that the embedded device is holding the rx line and preventing its transmission, but I don't see how that possible in the code. Also if that is the case it shouldn't work when I plug both lines into my laptop.

I also considered the DTR was not set high, but checked this and it appears to be set high.

Does anyone know a reason which would prevent a device from responding?

Note: When I say Serial Ports I am referring to the UART when referring to the embedded device. All device use a DB9 connector running RS232.

Edit: Operating System on laptop is Windows 10. Embedded device is a Atmega324p.

Edit 2: Did some more testing. It appears that it sometimes work and sometimes doesn't.

I have added an image which show a almost perfect signal of the response. Logic Analyser 1

The blue section is a gap in the signal that shouldn't be there.

12
  • The C language has no serial port library. You should start by specifying which OS you use. For example POSIX-compatible operating systems will use the <termios.h> header.
    – Julien-L
    Nov 15, 2017 at 0:42
  • OS? What's an OS? He said embedded device. Sounds like you'll have to break out the oscilloscope for this one. First, figure out if you actually are sending to the external device--not just that your code says it sent something, but that the signal actually happens. It's also handy if you have some third channel of output from the embedded device to use for debugging. Perhaps a third UART, or perhaps writing debug info to flash that can be read after the run. Nov 15, 2017 at 0:47
  • @Julien-L Updated my question to reflect some more specific regarding UART instead of Serial Port.
    – Daniel
    Nov 15, 2017 at 0:48
  • @Lee Daniel Crocker I'm using a Salae Logic Analyser instead of an oscilloscope, so I can view the signals directly. The embedded device sends the 'Initialise' message to the External device. The external device doesn't reply "Ack + MSG" back to the embedded device. Except, sometimes it does. And sometime it just sends part of the "Ack + MSG"
    – Daniel
    Nov 15, 2017 at 0:49
  • 1
    We don't know what code you are using, We don't know what OS/RTOS/whatever. We don't know what hardware We don't know what serial protocol you are using. What do you suggest that we do? Nov 15, 2017 at 0:53

1 Answer 1

0

Ended up finding a solution.

The RTS line was held via the embedded device at 1.2v, while the Pc was holding it at 5.2v.

Pulling the RTS line up to 5v fixed the issue.

1
  • Just pulling it up sounds risky - you should figure out why it was at 1.2v. What is the logic level of the I/O pin used for that? Was it actually configured as a push/pull driven output? Nov 16, 2017 at 4:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.