steve tian

CW7.0 for MCF52211 RTC, can't access MCF_RTC_GOCU and MCF_RTC_GOCL

Discussion created by steve tian on Mar 13, 2008
Latest reply on Jun 7, 2008 by Mark Butcher
.1. In CW 7.0 IDE, after create a project for M52210. In MCF52210_RTC.h file , missing declaration for registers
   RTCGOCU and RTCGOCL. so I add following lines to that file.
 
  #define MCF_RTC_GOCU                         (*(vuint16*)(&__IPSBAR[0x3F4]))
  #define MCF_RTC_GOCL                         (*(vuint16*)(&__IPSBAR[0x3F8]))
 
2. So far , I have no a good idea to init both registers(ABOVE).
    Have tried  very hard to init MCF_RTC_GOCU and MCF_RTC_GOCL, but from IDE register view funcaton,  that two always 0000.
    I also check their memory  , it also is 0000, 0000. but other registers are ok to access. such as DAYS, CCR...
  
3. Here is some code what I tried init RTC,

     MCF_CLOCK_RTCCR = 0x10;
   
    
     MCF_RTC_RTCCTL = 0x80;
    
     MCF_RTC_DAYS =     MCF_RTC_DAYS_DAYS(30);
     MCF_RTC_HOURMIN =  MCF_RTC_HOURMIN_MINUTES(30);
     MCF_RTC_HOURMIN =  MCF_RTC_HOURMIN_HOURS(5);
     MCF_RTC_SECONDS =  MCF_RTC_SECONDS_SECONDS(20);
    
     MCF_RTC_ALRM_DAY = MCF_RTC_ALRM_DAY_DAYSAL(30);
     MCF_RTC_ALRM_HM =  MCF_RTC_ALRM_HM_MINUTES(30);
     MCF_RTC_ALRM_HM =  MCF_RTC_ALRM_HM_HOURS(5);
     MCF_RTC_ALRM_SEC = MCF_RTC_ALRM_SEC_SECONDS(45);   // 5 seconds after the RTC enabled
    
    
     MCF_RTC_GOCU = 0x40;
     MCF_RTC_GOCL = 0x08;
    
     temple1=MCF_RTC_GOCU;
     temple2=MCF_RTC_GOCL;
    
     MCF_RTC_RTCIENR =0x0f;
    // MCF_RTC_RTCCTL = MCF_RTC_RTCCTL_EN;
 
4 here is some assembler code
     MCF_CLOCK_RTCCR = 0x00;
2000090A: 423940120012    clr.b    0x40120012 (0x40120012)
     MCF_RTC_RTCCTL = 0x00;
20000910: 42B9400003D0    clr.l    0x400003D0 (0x400003d0)
    
     MCF_RTC_GOCU = 0x0000;
20000916: 4279400003F4    clr.w    0x400003F4 (0x400003f4)
     MCF_RTC_GOCL = 0x8000;
2000091C: 303C8000        move.w   #-32768,d0
20000920: 33C0400003F8    move.w   d0,0x400003F8 (0x400003f8)
    
     in there, I can see 0x8000(#-32768)  loaded to D0. then step to next
     in IDE  MCF_RTC_GOCL or memory of 0x400003F8  is 0000
   
    after excaution, it shoud be 0x8000.
 
 
????  something wrong ?
 
 
OLdme

Outcomes