SPI port configuration for SFLASH on other than SPI2

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

cross mob
Anonymous
Not applicable

[WICED-SDK-2.2.1, MCU: STM32F205]

From what I see in code, the Broadcom External Flash talks over SPI2 and we are using SPI1 for our CGI External Flash.

When I look at SDK/Apps/waf/bootloader/bootloader.c and try to mimic the function of platform_restore_factory_app() but change the SPI port to our external flash (SPI 1) I see init_sflash and sflash_read.

init_sflash then calls sflash_platform_init with the requested SPI port. At that point the requested SPI port is ignored and the SFLASH (SPI 2) is always used. There is no way to change the spi port to our external flash.

Furthermore when you follow the sflash_read path, even if you were to manually update the SPI port to our SPI1, you eventually get to a call sflash_platform_send_recv_byte which then ignores the requested SPI port and uses the sflash spi, SPI 2.

There is no way for me to use these functions and supply a different SPI port. Can this be changed so that we can input the SPI we need? Is there some other function I am supposed to use to talk to SPI1?

0 Likes
6 Replies
Anonymous
Not applicable
Is the problem here that you have two SPI flash devices, and the bootloader needs to talk to one device, while the application talks to another?
0 Likes
Anonymous
Not applicable
Yes, the bootloader and golden image will be in one flash, not that there is a golden image that is necessary, but the other flash will contain application code.  There is not enough space in the 1M to contain the full image.
0 Likes
Anonymous
Not applicable
Do you need to access the other SPI flash from the bootloader?

FYI, the SDK includes a generic SPI flash API located in <WICED-SDK>/include/wiced_platform.h.

The API has three functions:

wiced_result_t wiced_spi_init( const wiced_spi_device_t* spi );

wiced_result_t wiced_spi_transfer( const wiced_spi_device_t* spi, wiced_spi_message_segment_t* segments, uint16_t number_of_segments );

wiced_result_t wiced_spi_deinit( const wiced_spi_device_t* spi );
0 Likes
Anonymous
Not applicable
Ok, reread this, you do want to use this from the bootloader.

Since the sflash_platform_init() function is implemented on a per-platform basis, you

should create a new platform with the SPI flash interface changed to suit your requirements.
0 Likes
Anonymous
Not applicable
I am interested in this discussion, we are in a very similar situation where we need to talk to an external SPI flash device from the application as well as the bootloader.
0 Likes
Anonymous
Not applicable
Applications access SPI serial flash with the WICED SPI API in <WICED-SDK>/include/wiced_platform.h.

The SPI API has three functions:

wiced_result_t wiced_spi_init( const wiced_spi_device_t* spi );

wiced_result_t wiced_spi_transfer( const wiced_spi_device_t* spi, wiced_spi_message_segment_t* segments, uint16_t number_of_segments );

wiced_result_t wiced_spi_deinit( const wiced_spi_device_t* spi );

The bootloader accesses serial flash via platform specific functions located in :

<WICED-SDK>/Wiced/Platform/common/drivers/spi_flash/<PLATFORM_NAME>.c

Platform specific functions can & should be created/defined/redefined to suit your hardware configuration.
0 Likes