phvic wrote:
I guess the datasheet has an error then -- or at least it's misleading. I think the sentence "during low power standby mode" shouldn't be there in the PHI2 input description.
The data sheet's language could use some refinement. You need to define what you are attempting to do in order to select the manner in which you will do it.
Specifically, you have the following choices:
- Halt the MPU by asserting (negating) RDY
. The MPU will stop on the next Ø2 high and remain stopped until RDY is deasserted. At that time, the MPU will restart on the next Ø2 high. While halted in this fashion, the MPU will acknowledge interrupt input activity but will remain halted. Interrupt processing will occur as soon as RDY has been deasserted and the current instruction has been completed.
- Halt the the MPU by executing a WAI (WAit for Interrupt) instruction. The MPU will stop on the next Ø2 high, go into a very low power consumption state (in the microampere range) and remain stopped until any hardware interrupt input is asserted. At that time, the MPU will resume execution on the next Ø2 high. There is a special use of SEI in conjunction with WAI to produce single cycle hardware interrupt latency.
- Halt the MPU by executing an STP (SToP) instruction. STP is identical in effect to WAI, but can only be cleared with a reset.
- Halt the MPU by stopping Ø2. As both the W65C02S and W65C816S have fully static cores, they can be indefinitely halted by stopping Ø2 in either phase without loss of data. Execution resumption will occur when Ø2 is restarted. Caution must be exercised in restarting the clock so that the phases do not get reversed.
I favor number 1 if stopping and starting the MPU is to be done in hardware, e.g., to generate wait-states for accessing slow devices. Stopping or stretching Ø2 could also be used as a wait-state method, but is more complicated to implement and can result in knotty timing problems.
Methods 2 and 3 are intended primarily for use in embedded hardware that must wait for long periods of time while imposing minimal drain on the power source (usually a battery), yet immediately spring into action when required. An example of such a device would be an implanted defibrillator, which usually spends most of the time awaiting input indicating that its services are required.
Method 4 is actually a byproduct of the implementation of methods 2 and 3. I personally don't recommend halting the MPU by halting Ø2, as timing issues may develop on restart. Accidentally restarting Ø2 in the wrong phase would surely confuse the MPU, since it performs actions on both phases of the clock cycle. Something else to consider is that 65xx peripheral devices are slaved to Ø2 and may malfunction if Ø2 is halted. In particular, the timers in the 65C22 are driven by Ø2 and will cease to keep time if the clock is halted.
Something to note is that halting the MPU by any of the above methods doesn't cause the MPU to relinquish the buses. You must assert BE if you want that to happen. As a fairly general rule, the sequence would be:
- Halt the MPU.
- Assert BE to disconnect the MPU from the buses. The data and address bus outputs, as well as RWB, will go to the high-Z state.
- Enable your other device to do what it has to do.
- Deassert BE to reconnect the MPU to the buses.
- Finally, restart the MPU.