2
\$\begingroup\$

I managed to flip the rx/tx lines on a project I'm working on. My GPS RX is going to my ATMega's RX, which is clearly wrong. Since the pin map lists the rx2 and tx2 lines as pins D16 and D17, I'm hoping I can work around this for the time being by using SoftwareSerial over those pins and flipping them virtually. This doesn't seem to be working. Is there something I need to do to disable the native UART? Can this work in principle?

\$\endgroup\$
  • 1
    \$\begingroup\$ This is about an Arduino mega, so would you change the title of the question to include "Mega"? I assume the GPS is connected to pin D16 and D17. It might help if you included your simplest test program as an example in your question. I'd expect software-serial to work over any pair of digital pins, and sort out driving the pins correctly, but I haven't checked that is the case. I can just about imagine it isn't expecting to run over a hardware UART, but it is quite a mature piece of software, so I am surprised. Have you put an LED on Rx and Tx (or used an oscilloscope) to check for activity? \$\endgroup\$ – gbulmer Aug 31 '14 at 21:22
  • \$\begingroup\$ Is possible to patch your arduino shield, or extend with extra set of Arduino Stackable Header and swap just the RX/TX pins? ... You're not the first -- in 20+ years, the most common error I've seen on UART/RS232 serial applications is mistakenly connecting TX to TX and RX to RX, but actually each TX output should drive the other device's RX input. Usually it's correct to connect similarly named pins together (GND, VCC, A[0..], D[0..]), and the serial port application is an exception to that rule. \$\endgroup\$ – MarkU Sep 1 '14 at 1:57
2
\$\begingroup\$

There is no pin change interrupt available on PH1, hence you cannot use SoftwareSerial. You will need to resort to a polled software UART instead.

\$\endgroup\$
  • \$\begingroup\$ I believe in the softserial library there is a flag to use either polling or pc change or polling. (Not at desk to verify.) \$\endgroup\$ – mpflaga Aug 31 '14 at 23:00
3
\$\begingroup\$

Cut the traces with a razor knife and use a wiring pencil to solder in a crossed connection to fix the wiring problem.

\$\endgroup\$
  • \$\begingroup\$ +1 for mentioning wiring pencil, a tool I have never heard of. \$\endgroup\$ – Dzarda Sep 1 '14 at 9:04

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.