CS-Lab have a M31 macro which may work better than G31, have you tried it?
http://www.cs-lab.eu/en/artykul-129-M31_as_an_alternative_to_G31.htmlThe spindle turning off is a strange one, does the LED in Mach for spindle actually turn off or is it just the signal to the motor that is lost? Is the motor set as a spindle axis or is it just a VFD?
Have you tried removing the PoKeys from the equation to see if there is a problem between it and the IP-A as I have never had any issues like that with mine.
Losing settings in Ports and pins is again strange, they should be in the xml file so unless the xml is set as read only and changes you make should be saved on closing Mach.
Hood