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.
Tool/software: TI-RTOS
I have started with the SimpleLink example for CC2640r2F and added code to write into the internal FLASH in the main function.
The intention is to have one sector in the FLASH to store configuration/parameters for the application.
For test I have added the following lines of code in main()
uint8_t array[] = {1, 2, 3, 4, 5};
uint8_t array2[10];
HalFlashErase( 29 );
HalFlashWrite( 0x1D000, array, 5 );
HalFlashRead(29, 0, array2, 10 );
The data read back is the data that was in the FLASH before I started to erase. Even if I add a very long loop, more that 30 seconds, after the write it is still the same value that is read.
If I make a reset of the CPU or if I let the program run the value in the FLASH will be updated.
My quess is the it has something with a cache to do and that it needs to be flushed or something.
And please don't tell me to use osal_snv_read or write since this seems not to be possible without registering a task to ICall and at the moment when I want to read the configuration there is no task started.
Regards Ørjan
Hello JXS!
Thanks for a fast response.
Maybe not the answer that I wanted since we in our application wants to read our parameters befor starting any thread. But after hitting my head against the keyboard a couple of times I finally found the reason that the code above was not working as expected.
It was, as I suspected a cache problem. So by adding a few lines of code it worked perfectly.
uint8_t array[] = {1, 2, 3, 4, 5};
uint8_t array2[10];
VIMSModeSafeSet(VIMS_BASE, VIMS_MODE_DISABLED, 1);
VIMSLineBufDisable(VIMS_BASE);
HalFlashErase( 29 );
HalFlashWrite( 0x1D000, array, 5 );
VIMSLineBufEnable(VIMS_BASE);
VIMSModeSafeSet(VIMS_BASE, VIMS_MODE_ENABLED, 1);
HalFlashRead(29, 0, array2, 10 );
Please, tell me If this is totally wrong or may have some unwanted sideeffect. Because then I have to redesign and use the osal_snv_read/write instead.
Regards Ørjan