I want to connect 2 devices together using RS232. I initially thought both devices used the power ground as the reference signal for their RS232 (they're powered by the same PSU) so I designed my RS232 cable just using Tx and Rx. However, after some testing and some bad RS232 communication, I learned that one of the devices actually uses case ground (earth ground) as the reference signal. If I connect the RS232 reference signal pin, the communication is flawless, but I want to avoid connecting my floating ground to earth ground (I believe this is good safety practice). Is there someway I can create an isolated reference signal for the two devices to use?
You need to wire the signal ground (Pin 5 on DB-9 RS232) always.
Using only TX and RX is simply not a valid wiring IMHO. If it works, it's by accident and you are relying on the having the exact same ground potential on both sides. Which is ok for an internal UART connection within a device, but not between two separate devices.
If this causes a ground loops between two devices, or unwanted potential shifts, using fully opto-isolated RS232 as mentioned earlier is the only correct way.