Forums

Unable to "Disable Watchdog" for F2812 target

Started by Marcos July 28, 2009
Hi,

I am trying to develop an application to perform Flash operations for
F2812 target with Parallel Port using Commandline mode.

When i use the SDFlash Utilty (SDFlash.exe) directly, there were no issues
in performing Flash operations for F2812 target using Parallel Port. 

But my application is unable to Disable the Watchdog, and i get the Error
: "Failed to Disable the Watchdog". I guess it has something to do with not
executing EALLOW and EDIS before the protected regiters are accessed. 

The following below is the code snippet for Disable watchdog :-

BOOL Disable_WD()
{
    BOOL      Success;
    MEM_TADDR Addr;
    TREG_16   Data;
    /* Enable WD override */
    //*0x7029 = *0x7029 | 0x0068;
    //*0x7025 = 0x0055;
    //*0x7025 = 0x00AA;
    Addr = 0x7029;
    Success = T28x->ReadMemory(  Addr, M_DATA, &Data, 1 );
    if( Success == FALSE )
     return( FALSE );
    Data |= 0x0068;
    Success = T28x->WriteMemory(  Addr, M_DATA, &Data, 1 );
    if( Success == FALSE )
     return( FALSE );
    Addr = 0x7025;
    Data = 0x0055;
    Success = T28x->WriteMemory(  Addr, M_DATA, &Data, 1 );
    if( Success == FALSE )
     return( FALSE );
    Data = 0x00AA;
    Success = T28x->WriteMemory(  Addr, M_DATA, &Data, 1 );
    return( Success );
}

The following piece of code does not seem to disable the watchdog in F2812
during a cold restart (Power OFF and Power ON). The function 
"T28x->ReadMemory" returns FALSE as it is unable to read the address
0x7029.

But once the SDFlash utlity was used to Erase, Program and Verify the DSC,
the above code does seem to disable the watchdog. That is, when i use my
commandline mode application, for the second time after the SDFlash
Utility, this disabling of watchdog works.

Waiting for response from anyone.

Thanks & Regards,
Marcos.



On Tue, 28 Jul 2009 00:24:48 -0500, "Marcos" <surnathma@gmail.com>
wrote in comp.arch.embedded:

> Hi, > > I am trying to develop an application to perform Flash operations for > F2812 target with Parallel Port using Commandline mode. > > When i use the SDFlash Utilty (SDFlash.exe) directly, there were no issues > in performing Flash operations for F2812 target using Parallel Port. > > But my application is unable to Disable the Watchdog, and i get the Error > : "Failed to Disable the Watchdog". I guess it has something to do with not > executing EALLOW and EDIS before the protected regiters are accessed.
If you KNOW that your code is missing a required EALLOW, why don't you add it?
> The following below is the code snippet for Disable watchdog :- > > BOOL Disable_WD() > { > BOOL Success; > MEM_TADDR Addr; > TREG_16 Data; > /* Enable WD override */ > //*0x7029 = *0x7029 | 0x0068; > //*0x7025 = 0x0055; > //*0x7025 = 0x00AA; > Addr = 0x7029; > Success = T28x->ReadMemory( Addr, M_DATA, &Data, 1 );
Whose idea was it to make a C++ member function to read a value from a memory address? How could it possible fail? What's the matter with the code that was commented out? Or even better, using the macros and headers supplied with Code Composer Studio, that would have compiled to the same object code and been much more legible? Maybe you'd better skip the 2812 and go to the 300MHz Delfino parts if you're generating this kind of bloat.
> if( Success == FALSE ) > return( FALSE ); > Data |= 0x0068; > Success = T28x->WriteMemory( Addr, M_DATA, &Data, 1 ); > if( Success == FALSE ) > return( FALSE ); > Addr = 0x7025; > Data = 0x0055; > Success = T28x->WriteMemory( Addr, M_DATA, &Data, 1 ); > if( Success == FALSE ) > return( FALSE ); > Data = 0x00AA; > Success = T28x->WriteMemory( Addr, M_DATA, &Data, 1 ); > return( Success ); > } > > The following piece of code does not seem to disable the watchdog in F2812 > during a cold restart (Power OFF and Power ON). The function > "T28x->ReadMemory" returns FALSE as it is unable to read the address > 0x7029.
What exactly is in this stupid function that it can tell it fails READING from a memory address? Since it does not know what the address is supposed to contain, how does it know what it read is wrong? Does it do something really dumb like reading the address more than once and comparing the contents to see if they are equal? There may be a good reason to do this, but almost never when reading memory-mapped hardware registers. Or is it the write function that fails? Does it do something equally inappropriate like try to read back what it just wrote? Again, that's usually not a good idea when dealing with memory-mapped hardware. I don't have TI documentation for the 2812 here, it's at work, and I don't remember what is at address 0x7029 or what is supposed to happen when you or in those three bits. But the rest of the function, writing 0x55 and then 0xAA to the same address, is almost certainly resetting the watchdog, and probably starting it again if it was actually stopped. Have you read the data sheet for the watchdog timer on the 2812?
> But once the SDFlash utlity was used to Erase, Program and Verify the DSC, > the above code does seem to disable the watchdog. That is, when i use my > commandline mode application, for the second time after the SDFlash > Utility, this disabling of watchdog works. > > Waiting for response from anyone. > > Thanks & Regards, > Marcos.
How do you know that the function is returning the right value? How does it decide FALSE or not FALSE? -- Jack Klein http://JK-Technology.Com FAQs for news:comp.lang.c http://c-faq.com/ news:comp.lang.c++ http://www.parashift.com/c++-faq-lite/ news:alt.comp.lang.learn.c-c++ http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html