CC2340R5: Internal Flash Data Read/Write, code reset automatically, garbeg data in NVS flash location.

Part Number: CC2340R5
Other Parts Discussed in Thread: SYSCONFIG

After integrating internal flash (NVS) read/write logic into my existing BLE application, I am observing garbage/unexpected values while reading data back from flash.
If I remove the I2C task logic used for BQ7695202 communication, the flash read/write logic works correctly. However, when both flash logic and I2C tasks are enabled together under FreeRTOS, garbage/unexpected data is observed while reading from flash.
 I have attached a debug screenshot and memory view, Memory allocation in view and MEMORY CONFIGURATION in .map file  for reference.
Request your urgent support on:
  • Correct and safe usage of internal flash/NVS with BLE + FreeRTOS
  • Recommended flash memory layout for CC2340R5
  • Any reference example or known issues causing invalid data reads
Please guide me to debug and fix this issue.
Screenshot_img_2.jpgScreenshot_img_1.jpg
Screenshot (35).pngScreenshot (32).png
  • Hello Sandeep,

    Please provide the SimpleLink F3 SDK version you are working from.  Be aware that since you are using the BLE5-Stack NVS instance, there is particular space for customer NV items which must be adhered to in order to not conflict with BLE NV items.  The documentation also lists other limitations to be aware of.

    If you prefer to not adhere to the BLE5-Stack NVS instance's rules, it is possible for you to add a second NVS region in SysConfig which you can access and control directly through the NVS TI Driver.  However you will need to account for this additional space in the command linker file (cc2340_freertos.cmd) as well.

    If the I2C task logic and NVS read/write logic continue to conflict, then you can consider putting your NVS functions into critical sections, practically this is disabling HWI/SWI to avoid interruptions and restoring them after the operation is completed. 

    If none of this is helpful, it would be good to know more about your NVS implementation with code snippets.

    Regards,
    Ryan