Activity › Forums › Questions & Troubleshooting › Issues with MEGA Serial1
-
Issues with MEGA Serial1
-
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 1 year, 8 months ago by JamesC.
-
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.
-
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
-
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
-
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.
-
-
-
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.
-
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.
-
-
Suspended MemberMemberThis content has been hidden as the member is suspended.
Log in to reply.