Electrical – Make a forward from one UART to another UART

uart

I am working with the TI TM4C MCU. Connected to one UART of this MCU, I have a GSM module or a GPS Module (let's say UART1). I need to establish communication between the MCU and the module by sending some "AT commands" and receiving some replies to verify what the module is doing.

Therefore I need to see what AT commands are sent by the MCU to the module and I need to see what the module replies to the MCU. Of course those commands are defined via C files, but I need to check what is sent when and how and what is received when and how.

I suppose that I can not use CCS to visualize those data flow, correct?

Therefore to achieve this, I am thinking to use MCU UART0 and connect that to my computer, where I use "Tera Term" software to receive a copy of what is sent and received by the MCU on UART1.

I am not an expert in C but I have some notion of it. I found some example of UART use in the TI lab workshop for TM4C, but I am not sure fully about how to implement this "forwarding" (copy like). I think I need to copy the value in the FIFO/ buffer of the UART1 to UART0 and then sent them to UART0.

I am a bit confused about how to operate it.

I would appreciate if someone got experience about it to explain how you usually process to analyze sending and receiving of data via UART, which are not directly linked to a computer terminal.

Best Answer

I am not sure fully about how to implement this "forwarding" (copy like)

An (often quicker) alternative to this type of software "forwarding" approach, is to monitor the two signals you mention, directly via hardware.

I'm short of time, so excuse the lack of a diagram at the moment. In brief:

MCU Tx -> GSM module Rx -> Here connect Rx of UART-to-USB adapter 1
MCU Rx <- GSM module Tx -> Here connect Rx of UART-to-USB adapter 2

Note: You only connect the Rx inputs of those two UART-to-USB adapters. Leave the Tx pins of those adapters unconnected.

Then you can monitor (and, although I've forgotten the name at the moment, I'm sure I've used software to merge or view) these two data streams on a PC. You could even run two simultaneous copies of "Tera Term" as you suggested, one opening the PC COM port for UART-to-USB adapter 1; the other opening the PC COM port for UART-to-USB adapter 2.

This avoids adding complexity at the MCU now. You can add this MCU functionality later, if you need to and when you have learned those programming skills. However during development, using hardware monitoring can be a quicker way to achieve the end result (i.e. monitoring those serial data streams) which you want.