0
\$\begingroup\$

I am working on a project using Atmel SAMD20 microcontroller (anyway, my question is in a general aspect, so I think this should not affect the answer)

I use an USART to connect my board to the serial port for debugging purposes, TX and RX lines are directly connect to CP2102 RX and TX respectively and I send debug information through the serial port during the whole execution of the program.

When developing stage is over and the product is in use, these pins are no longer used and are left floating.

Everything was fine until I detected that putting noise (just touching BOTH lines with my hands) cause a hardware reset in the uC and the program stop working at all. I suspect that the uC is interpreting that noise as a signal and causing infinity USART interrupts.

What can I do to ignore signal on these pins when the CP2102 is not connected?

What I've tried:

  • Setting a pull down in RX pin. Didnt work.

What I definitely CANT do:

  • Have two different boards, one for developing and another without those pins when the product is finished.

What I could do:

  • Have two different firmwares. One for developing and another for production removing all code related to that USART, avoid it's initialization and sending information through it. But is this the best solution??

Is there any hardware or software change I could do to avoid this problem using just one firmware?

Many thanks!

\$\endgroup\$
  • 1
    \$\begingroup\$ Certainly, you should not send information on an UART not even connected or used. But disable interrupts at least. UART idle is high by the way, try pullup resistors maybe. \$\endgroup\$ – Bence Kaulics Nov 18 '16 at 13:38
  • 1
    \$\begingroup\$ "I suspect that the uC is interpreting that noise as a signal and causing infinity USART interrupts." No, that is not how USART interrupts work, they can't re-fire until handled and cleared, and it typically takes time for them to occur anyway, as the UART is running at a finite baud rate / oversampling. Stabilizing the lines with resistors is a good idea. But your actual issue is most likely caused by ESD or other electrical issues leading to misoperation of the processor circuitry. \$\endgroup\$ – Chris Stratton Nov 18 '16 at 17:35
3
\$\begingroup\$

Setting a pull down in RX pin. Didnt work.

Bad idea, that would be detected as a break. Use a pullup resistor for RX, as UART signals are idle high.

Everything was fine until I detected that putting noise (just touching BOTH lines with my hands) cause a hardware reset in the uC and the program stop working at all.

Touching signal lines with bare hands may cause ESD, and no, the MCU is not supposed to work properly in that case.

\$\endgroup\$

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.