ogulcan123
Member level 5
- Joined
- Apr 23, 2011
- Messages
- 81
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Location
- Istanbul, Turkey
- Activity points
- 2,024
Hi,
I have Winbond W25Q64FVSSIG, an 8-Mbyte SPI flash, connected to STM32F407VGT6, a 32bit ARM Cortex M4 MCU.
I'm using the MCU as a webserver, so I'm planning to use the SPI flash to store the web page content and some data logs. Therefore, I guess I need to apply a FatFs to whole chip, or some of it if possible.
The problem is I cannot find a way to initialize the MCUs SPI interface to communicate with the SPI Flash chip. There are some documents and examples on the net, but none of them really helped.
Here is how I connected the chip (Although I couldn't test, guess there is no problem with that):
I'm using STM32F4 standard libraries and the corresponding library file is "stm32f4xx_spi.c" file.
In this file, it explains how to use the driver, but I couldn't apply what is written in the third and fourth items, which are as follow:
-----------------------------------------------------------------------------------------------------------------------
* 3. Peripherals alternate function:
* - Connect the pin to the desired peripherals' Alternate
* Function (AF) using GPIO_PinAFConfig() function
* - Configure the desired pin in alternate function by:
* GPIO_InitStruct->GPIO_Mode = GPIO_Mode_AF
* - Select the type, pull-up/pull-down and output speed via
* GPIO_PuPd, GPIO_OType and GPIO_Speed members
* - Call GPIO_Init() function
* In I2S mode, if an external clock source is used then the I2S CKIN pin
* should be also configured in Alternate function Push-pull pull-up mode.
*
* 4. Program the Polarity, Phase, First Data, Baud Rate Prescaler, Slave
* Management, Peripheral Mode and CRC Polynomial values using the SPI_Init()
* function.
* In I2S mode, program the Mode, Standard, Data Format, MCLK Output, Audio
* frequency and Polarity using I2S_Init() function.
* For I2S mode, make sure that either:
* - I2S PLL is configured using the functions RCC_I2SCLKConfig(RCC_I2S2CLKSource_PLLI2S),
* RCC_PLLI2SCmd(ENABLE) and RCC_GetFlagStatus(RCC_FLAG_PLLI2SRDY).
* or
* - External clock source is configured using the function
* RCC_I2SCLKConfig(RCC_I2S2CLKSource_Ext) and after setting correctly the define constant
* I2S_EXTERNAL_CLOCK_VAL in the stm32f4xx_conf.h file.
-----------------------------------------------------------------------------------------------------------------------
Is there anyone that can help with the proper initialization and use according to the purpose I explained?
Links:
STM32F407xx Datasheet:
http://www.st.com/content/ccc/resou...df/jcr:content/translations/en.DM00037051.pdf
W25Q64FVSSIG Datasheet:
http://www.winbond.com/resource-files/w25q64fv revq 06142016.pdf
stm32f4xx_spi.c library file:
http://github.com/dbridges/stm32f4-discovery-lib/blob/master/StdPeriph/src/stm32f4xx_spi.c
Tags: STM32F4, SPI Flash, SPI Serial Flash, ARM Cortex M4, W25Q64FVSSIG
I have Winbond W25Q64FVSSIG, an 8-Mbyte SPI flash, connected to STM32F407VGT6, a 32bit ARM Cortex M4 MCU.
I'm using the MCU as a webserver, so I'm planning to use the SPI flash to store the web page content and some data logs. Therefore, I guess I need to apply a FatFs to whole chip, or some of it if possible.
The problem is I cannot find a way to initialize the MCUs SPI interface to communicate with the SPI Flash chip. There are some documents and examples on the net, but none of them really helped.
Here is how I connected the chip (Although I couldn't test, guess there is no problem with that):
I'm using STM32F4 standard libraries and the corresponding library file is "stm32f4xx_spi.c" file.
In this file, it explains how to use the driver, but I couldn't apply what is written in the third and fourth items, which are as follow:
-----------------------------------------------------------------------------------------------------------------------
* 3. Peripherals alternate function:
* - Connect the pin to the desired peripherals' Alternate
* Function (AF) using GPIO_PinAFConfig() function
* - Configure the desired pin in alternate function by:
* GPIO_InitStruct->GPIO_Mode = GPIO_Mode_AF
* - Select the type, pull-up/pull-down and output speed via
* GPIO_PuPd, GPIO_OType and GPIO_Speed members
* - Call GPIO_Init() function
* In I2S mode, if an external clock source is used then the I2S CKIN pin
* should be also configured in Alternate function Push-pull pull-up mode.
*
* 4. Program the Polarity, Phase, First Data, Baud Rate Prescaler, Slave
* Management, Peripheral Mode and CRC Polynomial values using the SPI_Init()
* function.
* In I2S mode, program the Mode, Standard, Data Format, MCLK Output, Audio
* frequency and Polarity using I2S_Init() function.
* For I2S mode, make sure that either:
* - I2S PLL is configured using the functions RCC_I2SCLKConfig(RCC_I2S2CLKSource_PLLI2S),
* RCC_PLLI2SCmd(ENABLE) and RCC_GetFlagStatus(RCC_FLAG_PLLI2SRDY).
* or
* - External clock source is configured using the function
* RCC_I2SCLKConfig(RCC_I2S2CLKSource_Ext) and after setting correctly the define constant
* I2S_EXTERNAL_CLOCK_VAL in the stm32f4xx_conf.h file.
-----------------------------------------------------------------------------------------------------------------------
Is there anyone that can help with the proper initialization and use according to the purpose I explained?
Links:
STM32F407xx Datasheet:
http://www.st.com/content/ccc/resou...df/jcr:content/translations/en.DM00037051.pdf
W25Q64FVSSIG Datasheet:
http://www.winbond.com/resource-files/w25q64fv revq 06142016.pdf
stm32f4xx_spi.c library file:
http://github.com/dbridges/stm32f4-discovery-lib/blob/master/StdPeriph/src/stm32f4xx_spi.c
Tags: STM32F4, SPI Flash, SPI Serial Flash, ARM Cortex M4, W25Q64FVSSIG