Jump to content
43oh

papa

Members
  • Content Count

    3
  • Joined

  • Last visited

Posts posted by papa

  1. I want to resend each character from one UART port to another.

    Hardware: Lauchpad TivaC EK-TM4C123GXL.

    First port is the default port that is connected to microUSB on the board.

    The second port is UART2 (Rx = PD6; Tx = PD7) connected to DB9 through MAX3232:. Power is VBUS - GND.

    DB9 is now connected to computer through RS232-USB adapter.

    I communicate with 1st serial port through serial monitor in Energia (ttyACM0).

    I communicate with 2nd serial port through serial terminal in Linux (ttyUSB0). 

    Code is very simple:

    void setup() {
      // initialize ports:
      Serial.begin(9600); //connected with USB
      delay(100);
      Serial2.begin(9600); //RS232: Rx = PD6; Tx = PD7
      delay(100);
    }
    
    void loop() {
    }
    
    void serialEvent() {
      while (Serial.available()) {
        // get the new byte:
        char inChar = (char)Serial.read();
        //send it to RS232
        Serial2.print(inChar); 
      }
      while (Serial2.available()) {
        // get the new byte:
        char inChar = (char)Serial2.read();
        //send it to UI
        Serial.print(inChar); 
      } 
    }
    

    I got the following:

    Then I send something from Energia serial monitor (serial) - this message is displayed in linux serial terminal (serial2) - this is all good.

    Another way (from Serial2 to Serial) it does not work - I send messages from linux terminal, but nothing changes in Energia serial monitor.

     

    What is wrong with my setup?

×
×
  • Create New...