Don't tie the grounds together anywhere! In the diagram, the ground symbols with an "M" next to them refer to the "motor" power supply ground, and with an "L" refer the the logic power supply ground.