I am currently trying to optimize the sleep mode in my battery application. I have attempted to disable all GPIO signals and other HC12 subsystems in order to reduce current consumption during sleep. The MSCAN, however, has given me some problems. I have been trying to reduce the CANtx and CANrx signal levels to zero by disabling MSCAN altogether before putting the processor into STOP mode. I then use the respective port M bits as GPIO and set them to output low. I do this with the following code (or variations of it):
CANE is write once bit. You can't turn it off in normal mode. It is possible only in special modes (debugger by default uses special single chip mode).
Did you wire your chip directly to CAN bus? In normal systems there's CAN driver between MCU and the BUS. Disabling MSCAN won't drop bus levels to zero.
Thx kef for your prompt response to my issue.
I was aware of the restrictions on writing CANE and had indeed put the processor into special single chip mode beforehand. However, I am not sure there are any restrictions on putting the HC12 into this mode, after it has already been in normal single chip mode.
On your other question, our CAN lines from the MCU go directly into an isolator chip, just before going to a CAN transceiver. As for the CAN signal from the MCU, I have noticed that in certain circumstances (when operating in debug mode through our BDM debugger) the MCU signals go right down to zero but in other circumstances (when not reset by our deugger) the CAN signals float between 3.5-4.0 volts. The first outcome is what I want, since the sleep current of our target drops towards what we want.
In special single chip mode CPU is stopped out of reset. This is useful for debugging, since you can debug from the start of your application; but it is not useful for real life applications. After reset (booting) into special single chip mode, to make target running you need to send GO command via BDM interface...
I think you should either extend your circuit to make MCU driving some FET, that would switch on/off current to optocoupler emitters, or maybe consider isolated transceiver like ISO1050.
BTW this is a 8-bitters forum. S12 is 16-bits. Please use right forum next time.
It was my intention to enter special single chip mode only for the purpose of bringing down the CAN, prior to putting my MCU into stop mode. However, I am not sure this is allowed but the documentation does not obviously forbid it. Once in stop mode, we only wakeup again by resetting the MCU, which puts it back into normal single chip.
On your point about FETs, upon shutting down the MCU CAN, we subsequently shutdown power to the opto-coupler chip as well. This, in turn, zeros any stray CAN signal levels getting onto the CAN bus. This is desired. However, what I am struggling to understand is why the MCU CAN signals can, in one scenario, have a non-zero output and in another, have zero signal level when I disable MSCAN.
Transition from normal to special modes is not possible. To enter SS mode, you pull BKGD/MODC pin low and reset.
Could you show MSCAN part of your circuit diagram?