For Pixhawk 
Connect the four-position cable to the MAG port and to your autopilot’s I2C port.
Image
For Pixhawk, connect the six-position cable to the GPS ports. 
Image
For APM 
Connect the four-position cable to the MAG port and to your autopilot’s I2C port.
Image
For APM 2.6, connect the five-to-six-position cable to the GPS ports. 
Image