Other Parts Discussed in Thread: SYSCONFIG
Hi buddies,
Just curious about something today I lost some time with.
I configured sysconfig to access and use the MX25R on the cc26x2r launchpad via SPI, the one which CS is DIO_20.
I have my small test program consisting of:
flash_open();
eraseFlashPg(0);
Task_sleep(100000);
uint8_t * s = "1234567";
writeFlash(0, s, 10);
Task_sleep(100000);
uint8_t r[10] = {0};
readFlash(0, r, 10);
flash_close();
At the end of it I just compare "r" to "s".
My writeFlash() function is as easy as:
uint8_t writeFlash(uint_least32_t addr, uint8_t *pBuf, size_t len)
{
uint8_t flashStat = FLASH_FAILURE;
uint16_t flags = 0;
if (is_open)
{
if (NVS_write(
_h,
addr,
pBuf,
len,
flags) == NVS_STATUS_SUCCESS)
{
flashStat = FLASH_SUCCESS;
}
}
return (flashStat);
}
This works if within writeFlash(), the NVS flags are 0.
If I set the flags as
uint16_t flags = NVS_WRITE_PRE_VERIFY | NVS_WRITE_POST_VERIFY;
it fails with FLASH_FAILURE and nothing is read in "r" variable.
If instead I set the flags as:
uint16_t flags = NVS_WRITE_POST_VERIFY;
it also fails, but the "r" variable content at least is fine.
So my question is simple, why are the flags making this fail? Is because the length content is not 256 for example?
Ok, please let me know and have the nicest Friday!