SH8 LVW problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SH8 LVW problem

1,277 Views
RobG
Contributor II
I'd like some assistance with the LVD system in the 9S08SH8 please.
I can't reset the LVWF flag once set.
 
I'm using ICDHCS08 debugger. Stepping through shows that;

          lda     #%01011100     ; set LVWACK
          sta     $1809                ; SPMSC1

does not clear LVWF (when Vdd > Vlvw).
 
What is the correct procedure for clearing LVWF please?
 
Thanks
Rob


Labels (1)
0 Kudos
3 Replies

341 Views
RobG
Contributor II
Perhaps I could add a bit more information.

Both LVD interupt and polling works in detecting LVWF = 1.
But clearing LVWF is the problem.
Mostly, only reset clears LVWF but sometimes even that does not clear it?????????

The following code is what I am using.

*interupt sub
BrownoutISR
        jsr    BrownoutSub      ; will not return while LVWF = 1
        rti


* Brownout subroutine
* will not exit while LVWF = 1
BrownoutSub
       lda    $1809                 ; get SPMSC1
       bpl    exitBSub             ; if LVWF = 0 then exit

* take action here in case of brownout (just disable outputs)
*       .......
*       .......

* clear flag. rem out appropriate option depending on polling or urupt being
used
*     lda     #%01011101     ; set LVWACK (polling method)
       lda     #%01111101     ; set LVWACK (irupt method)
       sta     $1809                 ; write to SPMSC1
       bra    BrownoutSub      ; stay in loop till Vdd recovers
exitBSub
       rts
 
Rob
0 Kudos

341 Views
bigmac
Specialist III
Hello Rob,

What is the Vdd level when you attempt to clear the low voltage warning?  Is your setting for bits LVDV:LWWV  within SPMSC2 register appropriate to your operating voltage?  Otherwise, I cannot see any reason why the LVWF flag should not be cleared.

Within the ISR, it may also be a good idea to re-write the LVDV:LVWV bit settings, just in case they might become corrupted over an extended period of time.

Regards,
Mac

0 Kudos

341 Views
RobG
Contributor II
Hi Mac,
Thanks. You woke me out of my mental blank. This application runs at 4.7 V. My intention is to use the low warning and reset levels but I was testing with the highest levels. I was puzzling over why once LVWF was set that even reset wouldn't clear it. The answer is simple. Hysteresis.
 
I'll take your advice and re-write SPMSC2 in the ISR.
 
Cheers and thanks again
 
Rob
 
0 Kudos