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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/08/11 08:52
Read: times


 
#183654 - 8051F120 SPI EEPROM Page_write
Hi again,

I'm currently trying to use an external EEPROM.
Everything works fine with byte writing.
As I need faster sample-savings I changed to page writing.
Regarding to the 25AA128 datasheet the page size is 64byte.

I implemented the write procedure within the measurement function in the way that I'm calling a new page, write 64 samples and call the next page.


=Result * 2430 / 4095;  //Result is coming from ADC_Procedure

	EA = 1;                          // Re-enable interrupts
	Time0 = ~Time0;					// generate clk at output for frequency check
	counter2++;						// counts # of samples


	Delay_ms(100);
	x1= measurement[buf];				//low value 8bit
	x2= measurement[buf] >> 8 ;			//high value 8bit (recalculated with *256)
	SFRPAGE   = UART1_PAGE;
	//printf("n x1:%d x2:%d",x1,x2);
	printf("n meas_value:%ld x1:%d x2:%d counter:%ld",measurement[buf],x1,x2,counter);
	SFRPAGE   = SPI0_PAGE;
   SPIF     = 0;
   NSSMD0   = 0;
		
   SPI0DAT  = 166;				//perform test (with constant value)
   while (!SPIF);

   SPIF     = 0;
   NSSMD0   = 1;
   //Delay_us (1);
   

   }	 //for end

   // Step5: Poll on the Write In Progress (WIP) bit in Read Status Register
   do
   {
      NSSMD0   = 0;                    // Activate Slave Select
      SPI0DAT  = EEPROM_CMD_RDSR;      // Send the Read Status Register command
     while (!SPIF);                   // Wait for the command to be sent out
      SPIF     = 0;
      SPI0DAT  = 0;                    // Dummy write to output serial clock
     while (!SPIF);                   // Wait for the register to be read
      SPIF     = 0;
      NSSMD0   = 1;                    // Deactivate Slave Select after read
    //  Delay_us (1);
   } while( (SPI0DAT & 0x01) == 0x01 );

   SFRPAGE  = save_sfrpage;
	counter=counter+64;				//go to next page

	}	//while end	 	

 



The first page is written in the right way. But as I'm going to the next page, only the first byte is written. The following bytes are not written. Same happens to all following pages (only first byte is written).

Does anyone can give me a hint please?

Best regards,
Reinhard

List of 9 messages in thread
TopicAuthorDate
8051F120 SPI EEPROM Page_write            01/01/70 00:00      
   Code            01/01/70 00:00      
      disable printf?            01/01/70 00:00      
   which '51 derivative?            01/01/70 00:00      
      Isn't that obvious?            01/01/70 00:00      
         I keep missing the titles :(            01/01/70 00:00      
         Working (?)            01/01/70 00:00      
            Wow - now that is fast            01/01/70 00:00      
               Mhz            01/01/70 00:00      

Back to Subject List