Activity Forums Questions & Troubleshooting Issues with MEGA Serial1

  • Issues with MEGA Serial1

  • JamesC

    Member
    April 18, 2023 at 8:05 am

    I’m trying to use a CONTROLLINO MEGA to control two RS232 devices, I’d like to put one device on Serial1 and the other on Serial2. To communicate with the devices I’m using a MAX232 board (https://ie.rs-online.com/web/p/communication-wireless-development-tools/8829042) connected to the pin headers on X1 and X2. Serial2 works fine with both MAX232 boards while Serial1 works with neither. To further debug the issue I created a script that continually printed to Serial1 and Serial2 eg:

    while(true){

    Serial1.print(“w”);

    Serial2.print(“w”);

    delay(1);

    }

    I then used an oscilloscope to probe the TX1 pin. When the TX1 pin was not connected to the MAX232 board I was seeing the expected response of the pin oscillating between 5V and 0V. However, when the pin was connected to the MAX232 board it oscillated between 5V and 2.5V. Thus the MAX232 board was not detecting a state change.

    Again, Serial2 works perfectly with both MAX232 boards and was connected in an identical fashion to Serial1.

    Any help would be appreciated.

    • This discussion was modified 10 months, 1 week ago by  JamesC.
  • JamesC

    Member
    April 18, 2023 at 8:18 am

    I should also say that I connected both MAX232 boards to a regular Arduino Mega on Serial1 and Serial2 and they both worked fine.

    • This reply was modified 10 months, 1 week ago by  JamesC.
  • JamesC

    Member
    April 20, 2023 at 9:15 am

    I’ve also tested this now with a CONTROLLINO MAXI with the same result as above.

    I’ve also tried 24V and 12V power supplies.

    • Jarda

      Member
      April 26, 2023 at 7:53 am

      Hi JamesC,

      Serial1 is also used for USB programming and communication with PC when USB is connected. Maybe this can be the issue.

      BR

      Jarda

      • JamesC

        Member
        April 26, 2023 at 1:59 pm

        Hi Jarda,

        Thanks for the reply. I thought that “Serial” aka “Serial0” on pins 0 and 1 were used to communicate with a PC.

        My issue is with Serial1 which is connected on pins 18 and 19.

        James

      • JamesC

        Member
        May 10, 2023 at 8:33 am

        I’ve found a work around by using the AltSoftSerial library.

        I had tried using the SoftwareSerial library, but it’s incompatible with my code.

        Having said that, it would be extremely helpful to have a fix for the Serial1 issue as it would mean the difference between having to purchase a Controllino MEGA over a MAXI (the pins used in the AltSoftSerial are only accessible on the MEGA) and saving €100+ per controller.

  • JamesC

    Member
    June 1, 2023 at 10:46 am

    Just to close the loop on this.

    The issue here was that the MAX232 board that I mentioned above has an onboard 1k pull down resistor on the TX line. The Controllino MAXI and MEGA must have an internal pullup resistor installed on PD3 and that internal pullup resistor and the 1k pull down resistor were acting as a voltage divider.

    When I removed the 1k pulldown resistor the board worked fine with Serial1.

    • JamesC

      Member
      June 1, 2023 at 11:03 am

      Disregard the above. Below is the correct description.

      Just to close the loop on this.

      The issue here was that the MAX232 board that I mentioned above has an onboard 1k pullup resistor on the TX line. The Controllino MAXI and MEGA must also have an internal 1k pullup resistor installed on PD3 and that internal pullup resistor and the RS232 board’s 1k pullup resistor were acting as a voltage divider. This is why I was seeing an oscillation between 5V and 2.5V

      When I removed the 1k pullup resistor from the RS232 board it worked fine with Serial1.

  • This content has been hidden as the member is suspended.
Viewing 1 - 5 of 5 replies

Log in to reply.

Original Post
0 of 0 posts June 2018
Now