This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

LPC2368 IAP Flash programming

Hi fnds

I am using MCB 2300 board has LPC 2368 processor.Can any one help me how to store sensor data in to internal flash memory while sensor reading happen in real time.

Clarification:

1. I could read sensor and RTC data and sending in to UART.
2. I want to store the same data to Flash
3. I have referred IAP 512 program from C:\Keil_v5\ARM\Flash folder when i write sensor data to my processor it hangs and collect sensor data slowly.Also it write some garbage value so please suggest me a solution for this.

Regards

P.Thangarasu

  • Have you considered running the sensor collection in RAM, so it isn't affected by the flash rewrite?

  • Hi

    i have created char array and stored the constant hexa decimal values to understand writing process.Example 0x0d values are stroed in the array 512 times also increment the address 512 times to store new values.Array is passed every 512 seconds with new initialization address.

    My processor clock is 12Mhz can u suggest me what is initialization frequnecy for flash write i have to feed

    Kindly suggest me how to write sensor data in to Flash with procedure or examples program so that it will be very helpful

    Program:

    //Declaration
    unsigned char data_mem[512];
    rtcc_set();//Fucntion to start rtc
    unsigned int ijx=0; unsigned int ijxy=0;
    //starting address 0x10000
    //my processor clock 12 Mhz
    //writing flash clock 4 Mhz to ProgramPage function char datavar=0x0A;
    unsigned int mpointt;

    ///loop execute EVERY SECONDS

    while(1)
    { if(RTC Seconds changes)
    { if(ijx<512) { data_mem[ijx]=datavar;// value 0x0A 512 times stored respect to seconds increment } if(ijx==512) //data writing loop every 512 bytes with address increment { ijx=0; mpointt=ijxy*512; Init(0x10000+mpointt,4000000,2); //starting address 0x10000 ProgramPage(0x10000+mpointt,512,data_mem); flashdata = (unsigned char *)(0x10000+mpointt);
    sprintf(uart0_buf,"%x %x ijxy:%d ijx:%d \n",flashdata,*flashdata,ijxy,ijx); //sprintf(uart0_buf,"%x \n",datavar); print_uart0(); ijxy++; }

    }
    }

    Regards
    P.Thangarasu

  • You are aware that the LPC23xx chips are rated for 1000 erase cycles for each flash sector?

    If you do one write every 512 seconds, that means 168,75 writes per day.

    So if you only write to a single sector, that sector will reach the specified erase cycle count efter about 6 days.
    If you spread your writes over 10 sectors, you will still reach the specified erase cycle count after 60 days.

    And because the chip uses ECC, that means you can't write just 512 bytes to a 4kB flash sector and then at a later time fill the sector with more data. Any time the content of a flash sector is changed, if just to change a single bit, you need to perform a full erase cycle.

    Next thing - NXP has documented how to flash. So why request people on this forum to supply the information that the manufacturer has already made available?