cancel
Showing results for 
Search instead for 
Did you mean: 

eeprom not working

Cshah
Associate

#include <built_in.h>

unsigned long buff[32];

unsigned long i, tmp,j;

unsigned long Address = 0x08008000;

unsigned long Address2 =0x08000000;

unsigned long* ptr;

void main() {

 GPIO_Digital_Output(&GPIOB_BASE, _GPIO_PINMASK_ALL);  // digital output PORTB

 ptr = (unsigned long*)Address2;

 j = *ptr;

 GPIOB_ODR = (LoWord(j));

  delay_ms(500);

 while(1){

 j+=1;

 if(j>=0xffffff)

 j=0;

 FLASH_Unlock();

 FLASH_ErasePage(Address2);      // erase block (Address must be 2048 byte aligned)

 FLASH_Write_HalfWord(Address2,j); // write one word

 FLASH_Lock();

  

 delay_ms(500);

 }

1 REPLY 1

Posts lacking context and detail will be ignored. Please learn to formulate a coherent question

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..