AnsweredAssumed Answered

STM32F105 SPI2 issue

Question asked by Nayani.Partha on Mar 13, 2015
Latest reply on Mar 14, 2015 by Nayani.Partha
Hello all,
I faced problems with SPI2. First I interfaced a graphic LCD on SPI bus and could not get to working properly, though it works well on an Atmel 8 bit controller. Spent more than 3 weeks without much luck. Now I interfaced Spansion flash memory. This chip supports reading manufacturer and device identification. When queried it must return 0x15. On STM32F105 returns 02, whereas 0x15 (correct value) is returned on 8 bit controller. Checked clock polarity. Here is my SPI initialization code. Any suggestions please? Thank you.

    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15;    
    GPIO_Init(GPIOB, &GPIO_InitStructure);
    SPI_InitStructure.SPI_Mode = SPI_Mode_Master;
    SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex;
    SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b;
    SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;
    SPI_InitStructure.SPI_CPOL = SPI_CPOL_High;
    SPI_InitStructure.SPI_CPHA = SPI_CPHA_2Edge;        //
    SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_64;
    SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;
    SPI_Init(SPI2, &SPI_InitStructure);    // currently used SPI on this board
    SPI_Cmd(SPI2, ENABLE);