This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM3359 (ICE v1) Can't Store Data Into Flash Manually

Folks,

I have an issue when storing data into flash memory during my program's run time (I need to use one page of Flash memory in my program instead of using the EEPROM).

These are the steps I follow during testing:

1) I flash a new firmware into my ICE (I have never manually written anything to Flash before this step, other than bootloader and firmware flashing)

2) I run my program and write one page of data to Flash, I read it back to confirm. Then I power cycle, and repeat process. I do this several times, and it always works. 

3) I flash a new firmware into my ICE board (something happens during this step that seems to block my flash for manual use)

4) I repeat step 2, but this time I get back zeros when I read the same page from my Flash.

Now, in order to initialize SPI0 to manually write to flash, then I have to set SPI0 to SINGLE CHANNEL mode. I don't know why it only works there. But I can flash my firmware with either SINGLE or MULTI CHANNEL mode. I tried flashing the firmware both modes, and I still have the same problem as in step 4 above. I am writing my page in location 0xB0000 (page location suggestions are welcomed).

Is there a blocking or write protect being enabled, perhaps, after I write data and then flash my firmware? 

  • Pototo,

    "something happens during this step that seems to block my flash for manual use"

    Can you please describe what happens during this process? Does the process complete?
    Have you checked to ensure that you are reading back from the correct location?

    Lali
  • Lali,

    It seems that my firmware took over that page where I was manually writing to. That is why I could not write to it. I am now using page 0x3D0000. And after re-running the above tests, now it works fine. My firmware is 885KB. I did not think there would such discrepancy.

    Now, I am using the function:
    int SpiFlashWrite(unsigned int offset,unsigned int noOfbytes,unsigned char* txBuff,unsigned char erase_flag);
    to write to the flash location, and 256 is the number of bytes I am writing. How do I make sure that my flash is not gonna run out of write/erase cycles? How does EEPROM emulation works? Or is the function SpiFlashWrite() already implementing the emulation?