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.

CCS/CC2640: Save bytes to SNV area in flash CC2640

Part Number: CC2640
Other Parts Discussed in Thread: CC2540, , CC2650

Tool/software: Code Composer Studio

This post is related saving bytes to SNV Flash.

I am following the section 3.10.3 in BLE Developers guide for cc2540 and cc2640. This section is related to “Using Simple NV for Flash Storage”. There according to the point “the protocol stack can be configured to reserve up to two 4 kB flash pages for SNV, although valid data is only stored in one active flash page”

So according to my understanding I can reserve up to two pages by setting OSAL_SNV preprocessor symbol in stack project. In explanation of compaction it uses the term sector. Are the terms sector and pages used here same or different. Will the api handle read/write operation on 1 page and 2 pages on its own.

Here are the two api calls

osal_snv_read(id, len, void *buf);

osal_snv_write(id, len, void *buf);

My Other question is in the doc it says the ids only available for customers is from 0x80 – 0x8F. Which is in total 16 ids. So how much number of bytes of uint8 can I write against an ID inside a buf/array. My requirement is to store less than 4kB. So can I save 4kB i.e 4096 bytes against an ID. Or two pages are divided among 16 ids. Can you please help me understand this.

My requirement is to store 4096 bytes at least in SNV. Also can I update the data against the ID later this means without erasing.

  • Hi,

    1 sector (or 1 page) on CC2640 is 4KB. Which device are you using? There are a couple of bytes overhead for SNV, but you should be able to write to the entire page with a single ID(after changing len type as described below).

    By default, osalSnvId_t and osalSnvLen_t are type defined as uint8. To use uint16-type definitions, define the preprocessor symbol OSAL_SNV_UINT16_ID in both the application and stack projects.

    Best wishes
  • Hi Zahid,
    My Board is smartRF06 and I am using CC2650 EM.

    What is the meaning of ID's.
    Why are they in total 16.
    How are they distributed among 4KB pages as you know that it can be set to 2 by OSAL_SNV.

    For clarification what is the advantage of using "To use uint16-type definitions, define the preprocessor symbol OSAL_SNV_UINT16_ID in both the application and stack projects."
  • for those looking to understand SNV Flash area.

    e2e.ti.com/.../457656

    Very much disappointed with the documentation that TI developers have created. Only giving a page for it in developers guide and response back from a TI employee is really frustrating. Copy pasting from the last line of section. We are here working on your platform not dumb. Provide some good supprt. Above post has a complete discussion on this.