CYW20706 Flash ersase

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

cross mob
adam
Level 4
Level 4
5 solutions authored 25 replies posted 50 sign-ins

Hi. 

I am using project hello_sensor in CYW20706,  SDK3.2ver.

In wiced_hal_sflash.h I find some API about FLASH control.

I upgrade FW in Flash Data Section1 (0x4000), and call API wiced_hal_sflash_erase(0x42000, 0x3e000); to clean Data section2, 

It will happen whole Flash data erase, so next time reset chip it will have no FW to use.

adam_0-1666856015924.png

Although I didn't call wiced_hal_sflash_set_size() before wiced_hal_sflash_erase, 

Is there any example to guide hotw to use these Flash control API?

I want to erase Data Section2 when I using FW in Data Section1, in th other hand when I using FW in Data Section 2 I want to erase Data Section 1 .

0 Likes
1 Solution

Hi @advait_kulkarni , 

I found the issue will happen when I call wiced_hal_sflash_init(void) in initialization.

so  I comment out wiced_hal_sflash_init, everything work fine.

View solution in original post

0 Likes
4 Replies
AnjanaM_61
Moderator
Moderator
Moderator
5 comments on KBA First comment on KBA 5 questions asked

Hello @adam ,

This is generally used in case of FW update. You can refer to the FW update projects available : Firmware_Upgrade_via_HCI , Firmware_Upgrade_via_OTA  

wiced_hal_sflash_erase - function is being used by the FW upgrade libraries : C:\Users\.....\latest_btsdk\mtb_shared\wiced_btsdk\dev-kit\libraries\btsdk-ota\release-v3.3.0\COMPONENT_fw_upgrade_lib\20706-A2\fw_upgrade.c

Regards,
Anjana

0 Likes
adam
Level 4
Level 4
5 solutions authored 25 replies posted 50 sign-ins

Hi @AnjanaM_61 , 

I have some test step, 

Could you hlep me to check where is incorrect?

In system initialize I call wiced_hal_sflash_set_size(4000000); 4M exnternal Flash.

1. Flash read 5 bytes from address 0x42000

wiced_hal_sflash_read(0x42000, 5, tBuf);

debug print tBuf = 0xFF, 0xFF, 0xFF, 0xFF, 0xFF

2. Flash write 5Bytes to address 0x42000

uint8_t tBuf[5] = {0x11, 0x11, 0x11, 0x11, 0x11};

wiced_hal_sflash_write(0x42000, 5, tBuf);

3. Flash read 5 bytes from address 0x42000

wiced_hal_sflash_read(0x42000, 5, tBuf);

debug print tBuf = 0x11, 0x11, 0x11, 0x11, 0x11

4. Flash erase 1byte in address 0x42000

wiced_hal_sflash_erase(0x42000, 1);

5. Flash read 5 bytes from address 0x42000

wiced_hal_sflash_read(0x42000, 5, tBuf);

debug print tBuf = 0xFF, 0xFF, 0xFF, 0xFF, 0xFF

 

 

0 Likes
advait_kulkarni
Moderator
Moderator
Moderator
25 likes received 250 sign-ins 100 solutions authored

Hi@adam,

The test steps for writing and reading the data from the flash are all correct. Is there any further issue or is your initial query answered?

Thanks and best regards

0 Likes

Hi @advait_kulkarni , 

I found the issue will happen when I call wiced_hal_sflash_init(void) in initialization.

so  I comment out wiced_hal_sflash_init, everything work fine.

0 Likes