AnsweredAssumed Answered

SPI last bit spoilage

Question asked by fridman.oscar on Dec 25, 2011
Latest reply on Jun 17, 2016 by stepanov.rosti
Hello

I'm using stm32f103 controller and via SPI trying to read data from EEPROM Microchip 25LC080B.

The problem I deal with, is last bit corrupting when reading from eeprom, sometimes 0->1 and sometime 1->0, I've verified with scope. I assune writing to eeprom is OK becasue i got a response.

Thats how I'm initializing SPI port
{
  SPI_InitTypeDef SPI_InitStructure;
  SPI_StructInit(&SPI_InitStructure);
  SPI_Cmd(SPIx, DISABLE);  
  SPI_I2S_DeInit(SPIx);
  /* SPIy Config */
  SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex;
  SPI_InitStructure.SPI_Mode = SPI_Mode_Master;
  SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b;
  SPI_InitStructure.SPI_CPOL = SPI_CPOL_High;
  SPI_InitStructure.SPI_CPHA = SPI_CPHA_2Edge;
  SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;
  SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;
  SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_256; 
  /* Configure SPI */
  SPI_Init(SPIx, &SPI_InitStructure);
  /* SPI enable */
  SPI_Cmd(SPIx, ENABLE); 
}

Thanks

Outcomes