CYW20719 NVRAM or EFLASH usage

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
kmantem
Level 1
Level 1
10 sign-ins 5 questions asked 5 sign-ins

Hi,

I am trying to use the NVRAM or EFLASH and have run into to some odd behavior on my CYW20719 board

 On Eflash - if I pick a page offset , say 100 and then write to the page, then read from the page , then write again all the values come back as 0 -- 

If I try to issue an erase - I get an 0x28 error which is the generic WICED_BT_ERASE

Can someone point me to an example of how to use eflash properly? (Code snippet below)

I also see that there is a note that a Sector is 512, but there is 1 meg of memory to use, and pages are 4096bytes and there are 256 pages?

 

For NVRAM - how much usable memory is there actually to use, the SDK pages seem to say 3 megs, but then I see quotes on 4k only - and then NVRAM can be overrun by SRAM?  Can someone point me to the addressable area that I can actually use and won't be impacted by other SRAM or areas?

 

 

 

writeDriverDataFlash(tbuf, 512, 0);

WICED_BT_TRACE("Test before %d %d %d %d %d \n\r", tbuf[0], tbuf[1],
tbuf[2], tbuf[3], tbuf[4]);
memset(tbuf, 0, 1280);
readDriverDataFlash(tbuf, 512, 0);

WICED_BT_TRACE("Test after %d %d %d %d %d \n\r", tbuf[0], tbuf[1],
tbuf[2], tbuf[3], tbuf[4]);

writeDriverDataFlash(tbuf, 512, 2);

memset(tbuf, 6, 1280);
WICED_BT_TRACE("Test before %d %d %d %d %d \n\r", tbuf[0], tbuf[1],
tbuf[2], tbuf[3], tbuf[4]);
//readDriverDataFlash(tbuf, 1280, 0);

writeDriverDataFlash(tbuf, 512, 0);

memset(tbuf, 2, 1280);
readDriverDataFlash(tbuf, 512, 0);
WICED_BT_TRACE("Test after %d %d %d %d %d \n\r", tbuf[0], tbuf[1],
tbuf[2], tbuf[3], tbuf[4]);

int writeDriverDataFlash(uint8_t *data, uint16_t size, uint8_t off) {

wiced_result_t result;
if (size <= 4096) {
result = wiced_hal_eflash_erase(eflashstart + off, 512);
WICED_BT_TRACE("Erase 0x%02x\n\r",result);
result = wiced_hal_eflash_write(eflashstart + off, data, size);
if (result == WICED_BT_SUCCESS) {
WICED_BT_TRACE("Sucess in writing\n\r");
return 1;
}
}

return 0;

}

int readDriverDataFlash(uint8_t *data, uint16_t size, uint8_t off) {
wiced_result_t result;
if (size <= 4096) {
result = wiced_hal_eflash_read(eflashstart + off, data, size);
if (result == WICED_BT_SUCCESS) {
WICED_BT_TRACE("Sucess in Reading\n\r");
return 1;
}
}

return 0;
}

0 Likes
1 Solution
DheerajPK_41
Moderator
Moderator
Moderator
750 replies posted 500 likes received 500 replies posted

Hi,

I have a sample application which will demonstrate the usage of NVRAM. Please check below link. It is written for CYW20819, but it will mostly work on CYW20719 also without any change. Please try it.

https://github.com/Infineon/CypressAcademy_BT101_Files/tree/master/Projects/ch02/key_ch02_ex09_nvram 

 

Regarding the eflash, let me try the program at my side and get back to you. Could you please share your whole code? Are you setting the length and buffers correctly?

Thanks,

-Dheeraj

View solution in original post

0 Likes
1 Reply
DheerajPK_41
Moderator
Moderator
Moderator
750 replies posted 500 likes received 500 replies posted

Hi,

I have a sample application which will demonstrate the usage of NVRAM. Please check below link. It is written for CYW20819, but it will mostly work on CYW20719 also without any change. Please try it.

https://github.com/Infineon/CypressAcademy_BT101_Files/tree/master/Projects/ch02/key_ch02_ex09_nvram 

 

Regarding the eflash, let me try the program at my side and get back to you. Could you please share your whole code? Are you setting the length and buffers correctly?

Thanks,

-Dheeraj

0 Likes