AnsweredAssumed Answered

spi 16 bit mode slave

Question asked by antonov.alexandr on Jul 9, 2012
Latest reply on Jul 11, 2012 by antonov.alexandr
I have a problem. I connected to spi stm32f103 and stm32f405. The data is transmitted, but only 8 bits. Initialization codes below. What is the problem?

Code for master (stm32f103):
SPI_InitStructure.SPI_Direction = SPI_Direction_1Line_Tx;
SPI_InitStructure.SPI_Mode = SPI_Mode_Master;
SPI_InitStructure.SPI_DataSize = SPI_DataSize_16b;
SPI_InitStructure.SPI_CPOL = SPI_CPOL_High;
SPI_InitStructure.SPI_CPHA = SPI_CPHA_2Edge;
SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;
SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_16;
SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;
SPI_InitStructure.SPI_CRCPolynomial = 15;
SPI_Init(SPI1, &SPI_InitStructure);
SPI_SSOutputCmd(SPI1, ENABLE);
SPI_Cmd(SPI1, ENABLE);

Code for slave (stm32f405):
SPI_InitStructure.SPI_Direction = SPI_Direction_1Line_Rx; //SPI_Direction_2Lines_FullDuplex;
SPI_InitStructure.SPI_DataSize = SPI_DataSize_16b;
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_CRCPolynomial = 15;
SPI_InitStructure.SPI_Mode = SPI_Mode_Slave;
SPI_Init(SPI1, &SPI_InitStructure);
SPI_I2S_DeInit(SPI1);
SPI_Cmd(SPI1, ENABLE);

Outcomes