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.

RTOS/CC2640R2F: Flash Write Routine

Part Number: CC2640R2F


Tool/software: TI-RTOS

Hello

i try to write into internal flash  with following code

uint32_t newValue = 0x00110011;

uint8_t cacheState = disableCache();

uint32_t rv = FlashProgram((uint8_t *) &newValue, 0x1C000, 4);

enableCache(cacheState);

this code is embedded in the Task init function of a simple peripheral project

my Problem is that i get FAPI_STATUS_FSM_ERROR as return value from FlashProgram()

What is missing??

i surrounded the routine by HAL_ENTER_CRITICAL_SECTION / HAL_EXIT_CRITICAL_SECTION but it did not help

Martin

  • The write protection bit is not set in the CCFG register
  • Have you looked at the nvs example found in the SDK?

    dev.ti.com/.../

    Siri
  • Hi Siri

    Thanks for your anser.
    I looked at your example and found a difference of using the "FlashProgram" routine. In your example the Hardwareinterrupts are disabled prior to the flash routine. I tried also to disable the Interrupts but nothing changes. My implementation was based on the OAD onchip example in your SDK. Is there some predefined symbol necessary to access the internal flash?
    In the Register FLASH_FMSTAT (0x40032054) has the value 0x00000030 after the function call of "FlashProgram".

    Thanks for your assistance
    Martin
  • I am not familiar with the simple peripheral project, but did some testing with the empty example instead.
    To be able to write to flash, I first had to do a FlashSectorErase.

    BR

    Siri
  • It is working after a SectorErase for me too. Now i found the problem. If i write a bitvalue 1 to an address where a bitvalue 0 is then i got the error and no single bit is written at all! (I wanted to write 0x00110011 at a location where 0xFFFFFFAB was written before). Is it true that the routine checks if the word i want to write is possible to write? Is there some documentation of the ROM functions used for modification of the internal flash?

    Thank you for your assistance.

    BR
    Martin