Page 15 of the Garmin 5012 install manual has the exact wiring diagram for what you are trying to do... For connecting with Raymarine equipment you will use the differential diagram, not the single-ended one.
I found the manual at
https://buy.garmin.com/shop/store/ma...D=148&pID=6312