Battery voltage when this is happening?
That is the first thing I would suspect or check out.
Then I would take a look at the ECM connectors for signs of corrosion. Unplug each connector on the ECM and check the pins for corrosion and or broken pins.
HTH
Patrick