First off the battery needs to be in good condition. Lately batteries are being constructed using more and more recycled material lowering the quality of the internal plate metals. This leads to a shorter service life, batteries dont seem to last 10+ years anymore. Atleast have it tested.
Also ensuring the battery connections are clean tight and in good order.
Good continuity to ground can be ensured by cleaning up and coating a collection of ground wires under the battery on top of the transmission.
The PCM needs a clean constant power delivery as do many other electrical modules in the car. You can experience anomalies when individual modules wont operate properly or when they cant communicate properly from power fluctuations.
Unfortunately it is still possible the PCM is experiencing internal issues and further diagnostic work will be required to verify. The P0604/P0605 codes are not common. There is a possibility an update could be in order, however I experienced a P0604 on my wife's Mazda a couple years ago. The PCM was bad and required replacement...luckily under warranty.