"Ernie8".......Just in case you don't know, the Automatic Transfer Switch (ATS) is a black box, about the size of a cigar box, typically located inside your power bay. Your shore power cord runs into the ATS. The ATS decides which power to use, the shore power or the generator. It sounds like yours is going bad or has a loose connection as mentioned. Make sure you disconnect the power cord and the generator is off before doing anything. Open the ATS box, usually the lid has tabs, that allows you to pry it open. Inside you'll find where the power cord is attached to three or four large screws, depending if your coach is 30 amp or 50 amp. Tighten all of the screws. It takes a large screwdriver and a fair amount of force.
Every coach manufacturer determines what power source they want to have priority when both shore power is connected and the generator is running. It sounds like your coach is making shore power the priority over the generator, but I find it odd that the generator is shutting off on it's own after five minutes, like it's being told to.
Maybe someone else will know if the newer systems are capable of doing that.