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.

Using CC2540 flash instead of RAM

Other Parts Discussed in Thread: CC2540

I’m trying to overcome the CC2540 8K RAM limitation without adding an external RAM part, and I came across HalFlashWrite().  I am using the TI sample code and BLE stack.  Questions:

1)      Where is the documentation for this function?

2)      Where is the documentation for the proper way to reserve a 8K block of flash for proprietary use with HalFlashWrite()?

3)      Any other thoughts / warnings? 

Thanks in advance,

MH

  • The documentation is fairly limited on this, mostly you just have to read the code.

    Depending on the type of data you can use the OSAL NVM module which will handle it for you.

    What type of data are you trying to store? - Flash behaves very differently to RAM.

  • Hello Mark,

    The OSAL API guide swra194 found in the BLE documents folder has two sections I believe for using NV memory, section 10 & 11.  There are several post on the subject in the forum.  You can do a search and see some of the issues that people where having.  In those post you will also see a link to programming the falsh. However, the implementation is straight forward when using the OSAL API.

    There is also the known issue with NV memory that is outlined in the release notes for the BLE Stack.

    Thanks,

  • Hi Mark,

    You can use osal_snv_write and osal_snv_read in osal_snv.c to do that. To reserve a 8K block of flash, you need to manage that by yourself. BLE code won't touch your proprietary flash.

  • Thanks for the 3 answers so far, and thanks greenja for reminding me to check the release notes for "known issues'. 

    The first known issue seems to preclude our plan to store a large-ish sized (7K) file temporarily in flash.  We were planning to send over data from the BLE central 20 bytes at a time, incrementally write it to flash, and then when done send it elsewhere. 

    Does anyone know if TI plans to address this? 

    MH

  • Mark Hinds said:

     We were planning to send over data from the BLE central 20 bytes at a time, incrementally write it to flash, and then when done send it elsewhere. 

    It is generally not a good idea to store temporary data to flash, due to several reasons:

    • Writing to flash takes very long, compared to RAM (milliseconds vs. nanoseconds), which is part of the "known issues": The realtime capabilities are very limited
    • Unlike with RAM, there is limited number of write/erase cycles (see datasheet)
    • Flash can only be erased in blocks bigger than 20 bytes; you need a rather complex algorithm to deal with that issue

    If you have the chance to reduce the size of the buffered data block to, say, 4 kBytes, do so and use RAM for buffering.