0
\$\begingroup\$

I need to connect a GNSS module's RXD and TXD lines to my MCU. But the problem is I don't have any available UART connections on my MCU. There are 3 UART connections, one is used by flash, one is used for firmware uploads, and the last is connected to a LTE module.

Because I seldom update the firmware, this UART connection is somewhat wasted and I'd like to use it to connect to a GNSS module. Is there a way that I could use an array of transistors to only connect the RXD/TXD lines to firmware upload circuit when it is needed? Like when Vdd is detected at the micro-usb port of the MCU. The rest of the time the UART lines would be connected to the GNSS module.

Note that unless we are performing a firmware update, a battery is being used so any excessive power consumption is detrimental to the overall design. Below is the circuit used to upload firmware to the ESP through micro-USB which is then bridged to UART connection.

ESP firmware upload circuit

\$\endgroup\$
7
  • 1
    \$\begingroup\$ Just use a quad analog switch or a Mux chip, it’s just logic levels \$\endgroup\$ Apr 7, 2021 at 3:02
  • \$\begingroup\$ "one is used by flash, one is used for firmware uploads" What's the difference? And just disable bootloaders until you do something to put the part in bootloader mode? \$\endgroup\$
    – Lundin
    Apr 7, 2021 at 6:22
  • 1
    \$\begingroup\$ I also wondered what that "uart used for flash" is \$\endgroup\$
    – Maple
    Apr 7, 2021 at 6:42
  • \$\begingroup\$ @TonyStewartEE75 can you elaborate? Is there an SMD chip that can handle this function? \$\endgroup\$
    – Feynman137
    Apr 7, 2021 at 12:38
  • 1
    \$\begingroup\$ Yes there are A/B Mux logic chips basically AND gates \$\endgroup\$ Apr 7, 2021 at 12:57

3 Answers 3

1
\$\begingroup\$

Use resistors to connect the GNSS module

When you want to program the device tie the GNSS end of the TX resistor high

schematic

simulate this circuit – Schematic created using CircuitLab

connect the programmer at A and B and connec C to VDD so that the GNSS does not get confused by any responses sent by the MCU to the programmer.

\$\endgroup\$
4
  • 1
    \$\begingroup\$ I used this with the 'improvement' of grounding the resistor with a MOSFET automatically \$\endgroup\$ Apr 7, 2021 at 6:25
  • \$\begingroup\$ i was thinking to have a link in the programming plug, but yeah, that works too. \$\endgroup\$ Apr 7, 2021 at 6:55
  • \$\begingroup\$ Since the idle level on a UART is "1", override "C" with a high level, not a low level. \$\endgroup\$ Apr 7, 2021 at 6:57
  • \$\begingroup\$ yes, that wopuld work better. (edited) \$\endgroup\$ Apr 7, 2021 at 7:26
1
\$\begingroup\$

With a 200 to 300 ohm impedance programmer cable and 50 ohm driver into 1k series to high Z // x pF Cin will cause horrible ringing (up to 50% amplitude) but only result in that being ignored as 5ns cycle ringing per meter is steady state if centred-bit sampling works as expected after start edge 1 to 0. Adding 170 Ohms to programmer side will eliminate ringing into 220 ohm twisted pair is a “nice to have”.

So the series 1k resistor must be added to the shared Rx side to prevent attenuation but 150 Ohms added to Tx side will be nice to have for jitter, ringing reduction at both ends of cable but not essential. Is programmer plugged in with GNSS activity? Or visa versa? Then Tx to programmer or GNSS Rx may need to be clamped

Idle Prog. Rx port must be PNP or Pch clamped high to prevent start bits (=0) when used by other UART.

All these problems may be corrected with 300 ohm CMOS 4016 or 4066 switches with ESD protection used as a DPDT switch enable by a jumper or connection voltage from programmer side when connected. ( no stinkin’ s/w needed)

Simulation proof of ringing on 1m cable 250 ohms

\$\endgroup\$
2
  • \$\begingroup\$ this answer contains a lot of valuable info but I think adding some diagrams would help beginners and intermediates alike understand what exactly you are suggesting. \$\endgroup\$
    – Feynman137
    Apr 7, 2021 at 15:26
  • \$\begingroup\$ Not possible with iOS on CircuitLab but the simulation on Falstad’s browser link says it all, user may change anything. \$\endgroup\$ Apr 7, 2021 at 16:16
0
\$\begingroup\$

Thinking the best solution is a multiplexer such as TI's TMUX7219DGKR datasheet. For example for the RXD lines, S1 would come from GNSS RXD and S2 would be firmware update circuit's RXD and the single output of the chip (D) would go to the MCU's TXD.

The input will be selected by signaling High/Low at the select pin.

block diagram

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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