Data writing onto on-board Serial Flash using spi(Wiced-Wifi)

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

cross mob
Anonymous
Not applicable

Hi,

We are using WICED-WIFI BCM943362WCD4.

We are trying to write data onto serial flash available in evaluation board.

We tried using example code snip.spi_flash_read.

We could read data but not able write any data onto memory using wiced_spi_transfer() calls.

We could read the value of serial flash status register by entering the command 0x05h and it is giving right value(default 0x1E).

we tried to modify the value of serial flash status register  to 0x02 by giving command  0x01, data  0x02.

But after writing, when we try to read the register, it gives the value 0x00.

Are we missing anything.?

Does wiced_spi_transfer API takes care of enabling and disabling of CE of serial flash?

Thanks

0 Likes
5 Replies
Anonymous
Not applicable

Did you write 0x02?

As JEDEC defined, WEN bit can't be written by the host.

Please try other bits like BP0.

0 Likes
Anonymous
Not applicable

There is a function called sflash_write() that does what you need.

For the 2.4.x SDK it can be found here: Wiced/Platform/common/drivers/spi_flash/spi_flash.c

We've recognized that it isn't easy to find and so we have moved this functionality into the libraries for the 3.0 SDK.

0 Likes
Anonymous
Not applicable

The snip.spi_flash_read app is actually quite misleading, and I raised an action to fix it.

The best way in WICED to access SPI flash is to use the dedicated spi_flash driver.

This is located in the following directory:

     Wiced/Platform/common/drivers/spi_flash/

You can see the API for the driver in spi_flash.h

To add the sflash driver to your project, you should be able to just add the following to your app makefile:

$(NAME)_COMPONENTS  += common/drivers/spi_flash

Then include "spi_flash.h" in your C file.

For an example of using the SPI flash driver, please have a look at Apps/waf/sflash_write/sflash_write.c  which is an app that allows us to relay data over JTAG so that it can be stored in the serial flash.

Anonymous
Not applicable

Thanks for your reply.

Is it possible to use full 2MB serial spi flash for data storage.?

0 Likes
Anonymous
Not applicable

Yes, it is fairly easy to redefine sizes etc for the SPI flash storage to allow that.