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.

Questions about flash Read/Write

Other Parts Discussed in Thread: CC2540

 

Hello
I am currently studying on the TI CC2540 flash section of the problem

There are several questions to ask:

1、 In the "CC253X-CC254X User Guide" P.25 mentioned, as I would like to store the data into the flash space.   Need to use the 0x8000 ~ 0xFFFF section of the XDATA memory , total of 32K Bytes can be used.  And CC2540 Provides Non-Volatile Memory, and Simple Non-Volatile Memory. There are three blocks counted, so the data I stored  can reach the range of about 96KB, is that right?

2、 why  engineer’s recommend is to use the  snv memory in the following articlebut the OSAL API document still exists the introduction of sn memory ? CC2540 whether there Non-Volatile memory space?

http://e2e.ti.com/support/low_power_rf/f/538/t/120842.aspx

3I have tried to write some Flash-code, on the part of the read/write, reading is OK, but writing has something problematic. I have set an array written, observed the written address value in memory window under IAR Workbench Debug mode, and the value I wrote can’t be successfully  recorded  that I  expect, but there are changes in the appointed address, the Code is provided below for reference I wrote:

=======================================================================================

uint8 temp[4] = {0x61,0x62,0x63,0x64};

while(FCTL&0x80); //   make sure that erase operation is completed

EA = 0;

HalFlashWrite(0x2A80,temp ,1);//0xAA00

EA = 1;

=======================================================================================

Using the above code, Memory window is displayed as {61 40 02 00}, do not know how the kind of problem?

 I 'm not quite sure if this change is correct. Thanks!

 

Best Regard

Wen-Chia Chao

 

  • Hi,

    I only have a suggestion for you third question. It seems you are only writing a single byte to flash address 0x2A80. You should change the last argument of the  HalFlashWrite() function to the byte count you wish to write (4 in the case of the temp variable).

     

    Regards,
    ABO 

  • Hi, ABO

     

    Hello,

    According to your suggestions I have implemented, but in the HalFilshWrite function of hal_flash.c mentioned, cnt is Number of 4-byte blocks to write.

    HAL_DMA_SET_LEN (ch, (cnt * HAL_FLASH_WORD_SIZE)); Already helped me to make the cnt*4 movement

    So when I writing 4 bytes{0x61,0x62,0x63,0x64} should be right.

    And I changed it, observed the written address value under memory window, the result still is {61 40 02 00}

     

     I 'm not quite sure if this change is correct. 

     

    Best Regards,

    Chao

  • You are absolutely right about the HalFlashWrite() function taking the number of 4-byte blocks to write as argument. I was a bit too quick to in posting my answer. 

  • Excuse me,

    in this period of time I attempted to figure out the work,

    but still occur the error ,

    I did not know whether you have a better solution way,

    or can provide your mail so that I can send you the picture of my computer to interpret the problem I have.