AnsweredAssumed Answered

SPI to communicate with an external flash memory

Question asked by aymoto.fabio on May 17, 2011
Latest reply on May 23, 2011 by aymoto.fabio
Hello;
I'm trying to communicate to an external flash memory (M25PE80) using SPI. I´m using the STM8SPI librarie but I´m not having success to write/read from memory. My doubt is about the configuration of pins. Are there any Option Byte that I must set to use the SPI alternate function? Does I need to use the GPIO_Init to configure the ports used for SPI (MISO, MOSI, CLK)? For the Chip Select pin, I´m using the PortG0 as GPIO_MODE_OUT_PP_LOW_FAST.

These are the code I´m using to init the SPI (Funtions from stm8s_spi.c):

SPI_DeInit();

SPI_Init(SPI_FIRSTBIT_MSB, SPI_BAUDRATEPRESCALER_64,SPI_MODE_MASTER,SPI_CLOCKPOLARITY_HIGH, SPI_CLOCKPHASE_2EDGE, SPI_DATADIRECTION_2LINES_FULLDUPLEX,SPI_NSS_SOFT, 0x07);

SPI_Cmd(ENABLE);



Regards

Outcomes