Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/04/10 15:42
Read: times


 
#177660 - C8051F120 Flash ScratchPad access
I am trying to write a 4 byte value to the Flash scratch pad area and read it back. But it does not seem to happen. I am using the "F120_Flash Primitives.c" downloaded from SiLabs site. It has the following functions :

Flash_ByteWrite( FLADDR addr, char byte, bit SFLE)
char Flash_ByteRead ( FLADDR addr, bit SFLE)
Flash_PageErase( FLADDR addr, bit SFLE)

I am using the flash address of 0x000A and for erase I am using the address 0x0400 as per the data sheet to erase both the 128 sectors of flash. I am using the following functions of mine :

//======================
void StoreOffTime (void )
    {
      char i;
      for ( i=0 ; i<4 ;i++)
         {
           FLASH_ByteWrite ( OffTimeAddr, OffDigit[i], 1);
	   ++OffTimeAddr;
	 }
    }	    

//======================
void ReadOffTime (void)
    {
      char i;
      for ( i=0; i<4 ; i++)
	 {
	   OffDigit[i] = FLASH_ByteRead (OffTimeAddr,1);
	   ++OffTimeAddr;
         }
     }  
//======================

 

But the Write or Read does not seem to happen as I get only zeros after the read. And I am not sure if there is any way to know if the Flash Write or Read was successful? Whats wrong and where ?

Thanks

Raghu

List of 3 messages in thread
TopicAuthorDate
C8051F120 Flash ScratchPad access            01/01/70 00:00      
   never used them            01/01/70 00:00      
      Solved..            01/01/70 00:00      

Back to Subject List