AnsweredAssumed Answered

SPI3 in stm32f10x problem

Question asked by mohamadi.parisa on Mar 2, 2017
Latest reply on Mar 7, 2017 by Clive One


Sorry I take the forum user's time for my simple questions.

Here is my code for spi3 in stm32f10x for PB3 and PB4 output/input.


    SPI_InitTypeDef SPI_INS;
      GPIO_InitTypeDef GPIOS


  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4| GPIO_Pin_5|GPIO_Pin_3;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_Init(GPIOB, &GPIO_InitStructure);

 SPI_INS.SPI_Direction =SPI_Direction_2Lines_FullDuplex;
 SPI_INS.SPI_Mode = SPI_Mode_Master;
 SPI_INS.SPI_DataSize = SPI_DataSize_8b;
 SPI_INS.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_128;
 SPI_INS.SPI_FirstBit = SPI_FirstBit_MSB;
 SPI_INS.SPI_CRCPolynomial = 7;
  SPI_Init(SPI3, &SPI_InitStructure);


However I can't see any clock signal in PB3 pin when I start sending ff value with SPI_I2S_SendData(SPI3, 0xff); function.

in STM32cubemx something is more strange:

According to datasheet we understand that for SPI3 without any remap PORT B can play SPI role.

However in STM32cubemx when I enable SPI3 and see it's configuration it just enables port c SPI section and it doesn't config anything such as remap.In addition when I change SPI3 for Port B it only change clock source.


STM32CubeMX output:

(REMAP)(PORTC) GPIO configuration

static void MX_GPIO_Init(void)


  /* GPIO Ports Clock Enable */



and (without REMAP)(PORTB) GPIO configuration

static void MX_GPIO_Init(void)


  /* GPIO Ports Clock Enable */