S08LL64/36 Difficulty controlling LVD

Discussion created by PG1 on Sep 30, 2011
Latest reply on Oct 4, 2011 by PG1

I am wondering if anyone else is having problems with the LVD module in the S08 LL36/64. 


1. My microcontroller is using 76uA and it should be using less than 2uA per the Freescale Battery Life Calculator in STOP3,


2. Here is an interesting experiment and results that should avoid having to tackle the issues of floating inputs and misconfigured modules.

A, Freescale Battery Life Calulator predicts 76uA current draw with LVD on and many other details in a known state.

B. My Microcontroller draws 76uA with LVD SET TO OFF and many other details matching Freescale Battery Life Calculator.

C. I changed my software so LVD IS SET TO ON.

D. Now my microcontroller draws 76uA with LVD SET TO ON! There is no change!


What could be wrong? Here are my assumptions:


1. LVD is controlled exclusively  in SPMSC1 register. The code below should turn off LVD. See the section marked RELEVANT TO PROBLEM. (I put assembly code in startup08.c  to get control of silicon before the c run-time environment is set up to eliminate vulnerabilities)



  312:    asm {
  313:             SEI          //kill any ints that want to happen
  0000 9b       [1]             SEI  
  314:            LDA #SOPT1_INIT
  0001 a663     [2]             LDA   #99
  0003 451800   [3]             LDHX  #6144
  315:            STA 0x1802        //hard coded address for sopt registers easier than rearranging metrowerks .h and .c files
  0006 e702     [3]             STA   2,X
  316:            LDA #SOPT2_INIT
  0008 a606     [2]             LDA   #6
  317:            STA 0x1803            
  000a e703     [3]             STA   3,X
  318:            STA 0x1800             //reset wdt 
  000c f7       [2]             STA   ,X
  319:             LDA #SPMSC1_INIT
 *************RELEVANT TO PROBLEM*************** 

  000d a600     [2]             LDA   #0
  320:             STA 0x1808

000f e708     [3]             STA   8,X
  321:             LDA #SPMSC2_INIT
  0011 a600     [2]             LDA   #0
  322:             STA 0x1809
  0013 e709     [3]             STA   9,X
  323:           LDA #SPMSC3_INIT
  0015 a600     [2]             LDA   #0
  324:           STA 0x180B
  0017 e70b     [3]             STA   11,X
  326:        };

2. The LVD cannot be turned on or off from anywhere else...for instance the Multilink BDM does not change the state of the LVD.