What setting(s) are required to initialize a new Wiced sflash chip - Inventek ISM43340?

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

cross mob
CrDe_3090586
Level 1
Level 1
5 sign-ins First like received First reply posted

I'm trying to initialize a new sflash chip on an ISM43340. Reading the community content, I was able to determine how to add the flash chip and size to the Wiced configuration.

However, determining how to initialize the sflash chip for the first time, took several days of digging, and I'm not sure it's  the correct change or in the proper place.

=== Solution ?? ===
The line below was added to initialize the sflash when running the make: snip.sflash_write-.

- Is this the correct change? Is this the correct placement?

../43xxx_Wi-Fi/platforms/ISM43340_M4G_L44/ISM43340_M4G_L44.mk
RESOURCES_LOCATION ?= RESOURCES_IN_WICEDFS

=== Fix Attempts ===
The first attempt was to run snip.ota_fr-ISM43340_M4G_L44 because that's what the documentation suggests to use to flash a new OTA app file. However, that failed because the wiced_apps_common.c / wiced_apps_get_size code isn't designed to detect an uninitialized sflash chip. 

When building the sflash_write, the filesystem.bin file wasn't being generated nor was the sflash being initialized. See below for the missing messages.  It took a couple of days to root cause the problem and find a possible solution. BTW, this sflash initialization worked fine out of the box for the eval board: CYW943907AEVAL1F, but not for the ISM43340.

=== wiced_apps_common.c / wiced_apps_get_size code improvement?  ===

There was no indication of a problem when running the http://192.168.10.1/wiced_ota_server/upgrade.html that there was a problem with the sflash. The wiced_apps_get_size() code essentially went into a nearly infinite loop because the entire chip was set to all 1s.  It seems feasible to add a code check to prevent this problem. The chip being used was (MX25U1633FM2I) apparently factory initialized to all 1s, because the error eventually found in debugging that (wiced_apps_get_size) method was reading all 1s for the app_header.count field. That is, under the assumption that all sflash chips are either factory initialized to all 1s or all zeros.... perhaps a code check would be helpful.

===wiced_apps_common.c / wiced_apps_get_size code suggested change ===

wiced_result_t wiced_apps_get_size( const image_location_t* app_header_location, uint32_t* size ) {

...
    WICED_VERIFY( init_sflash( &sflash_handle, PLATFORM_SFLASH_PERIPHERAL_ID, ...));
    WICED_VERIFY( sflash_read( &sflash_handle, app_header_location->detail.external_fixed.location, .......));

    // code change here suggested checking for 255 or 0, which will be an error 99.999999% of the time

    if (app_header.count > 254 || app_header.count == 0) return ERR_CODE_SFLASH_NOT_INITIALIZED; 

=== The messages below would NOT appear in the make/build log until after adding the make file line as mentioned above

     (RESOURCES_LOCATION ?= RESOURCES_IN_WICEDFS) ==== 

16:20:54.367 -> NO Support Range Erase Command!!
16:21:05.562 -> Waiting for command
............

0 Likes
1 Solution
3 Replies
Aditi_B
Moderator
Moderator
Moderator
500 replies posted 5 questions asked 250 replies posted

Hi,

Which version of WICED STUDIO are you using?

As per WICED 6.6 sflash_write application is located in "waf" folder. Location: 43xxx_Wi-Fi\apps\waf\sflash_write

/43xxx_Wi-Fi/platforms/ISM43340_M4G_L44. This is the correct path to add a new platform in WICED STUDIO. Can you attach a snapshot of all files provided in this platform folder? for ex: the ISM43340_M4G_L44.mk file etc.

RESOURCES_LOCATION ?= RESOURCES_IN_WICEDFS. This too is correct because this downloads all the resources in the external flash rather than internal flash and I think that's what you suppose to check.

The first attempt was to run snip.ota_fr-ISM43340_M4G_L44 because that's what the documentation suggests to use to flash a new OTA app file. Which documentation are you referring here?

Can you provide the location of the sflash-write application you're using?

Thanks

Aditi

0 Likes

Thanks for the reply. Answers to your questions:

Which version of WICED STUDIO are you using?
I'm using 6.3 of WICED due to constraints from Inventek on platform files, etc.

Can you attach a snapshot of all files provided in this platform folder? 

-rw-r--r-- 1 user staff 7125 Jun 25 16:16 ISM43340_M4G_L44.mk
-rw-r--r-- 1 user staff 822 Oct 10 2019 README.txt
drwxr-xr-x 5 user staff 160 Oct 10 2019 firmware
-rw-r--r-- 1 user staff 6194 Oct 10 2019 ota2_image_defines.mk
-rw-r--r-- 1 user staff 30177 Oct 10 2019 platform.c
-rw-r--r-- 1 user staff 30389 Oct 10 2019 platform.c.old.txt
-rw-r--r-- 1 user staff 30975 May 24 10:57 platform.h
-rw-r--r-- 1 user staff 6571 Jun 10 11:06 platform_config.h
-rw-r--r-- 1 user staff 2787 Oct 10 2019 platform_ota2_image.h
-rw-r--r-- 1 user staff 2793 Oct 10 2019 platform_xip.mk
drwxr-xr-x 11 user staff 352 Oct 10 2019 utilities
-rw-r--r-- 1 user staff 11648 Oct 10 2019 wifi_nvram_image.h

./firmware:
total 1920
-rw-r--r-- 1 user staff 370154 Oct 10 2019 ISM43341B0-6.49.1.0.bin
-rw-r--r-- 1 user staff 437513 Oct 10 2019 ISM43341B0-mfgtest-6.49.1.0.bin
-rw-r--r-- 1 user staff 171906 Oct 10 2019 ISM4334x_bt_firmware_image_8dBm.c

./utilities:
total 10272
-rw-r--r-- 1 user staff 1048576 Oct 10 2019 ISM43340_M4G_L44_flash_image.bin
-rw-r--r-- 1 user staff 1048576 Oct 10 2019 ISM43341_M4G_L44_flash_image.bin
-rw-r--r-- 1 user staff 1048576 Oct 10 2019 ism43340_flash_image.bin
-rw-r--r-- 1 user staff 1005 Oct 10 2019 ism43340_read_flash_image.bat
-rw-r--r-- 1 user staff 933 Oct 10 2019 ism43340_write_flash_image.bat
-rw-r--r-- 1 user staff 1320 Oct 10 2019 read.log
-rw-r--r-- 1 user staff 1048576 Oct 10 2019 temp1_flash_image.bin
-rw-r--r-- 1 user staff 1048576 Oct 10 2019 temp_flash_image.bin
-rw-r--r-- 1 user staff 814 Oct 10 2019 utilities.7z.rename

MyUser-MacBook-Pro:ISM43340_M4G_L44 myuser$

Can you provide the location of the sflash-write application you're using?

/43xxx_Wi-Fi/apps/waf/sflash_write
sflash_write.c shows: Copyright 2018.

Which documentation are you referring here?
https://community.cypress.com/t5/WICED-Studio-Wi-Fi-Combo/Initializing-formatting-Serial-Flash-for-m...

0 Likes
Aditi_B
Moderator
Moderator
Moderator
500 replies posted 5 questions asked 250 replies posted

Hi,

Please go through this page to get more pointers on how to add external flash in WICED-

https://community.infineon.com/t5/Resource-Library/CYW43907-with-External-SFLASH-in-WICED/ta-p/24631...

Thanks

Aditi

0 Likes