AnsweredAssumed Answered

STM32F103 SPI3 remap does not work

Question asked by dmitri.calugari.001 on Sep 11, 2015
Latest reply on Sep 18, 2015 by dmitri.calugari.001
Hello everybody,

I have a problem in initialization of SPI3 in STM32f103.
I know that the pins of SPI3 are together with JTAG pins, and i've found on the internet how to disable the JTAG pins, but it still does not work.
Here is the code:
void W5500_SPI_LowLevel_Init(void)
  GPIO_InitTypeDef GPIO_InitStructure;
  SPI_InitTypeDef  SPI_InitStructure;
  GPIO_PinRemapConfig(GPIO_Remap_SWJ_NoJTRST, ENABLE);   
  GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE);  
       and W5500_SPI_SCK_GPIO Periph clock enable */
  /*!< W5500_SPI Periph clock enable */
  RCC_APB1PeriphClockCmd(W5500_SPI_CLK, ENABLE);
  /*!< Configure W5500_SPI pins: SCK */
  GPIO_InitStructure.GPIO_Pin = W5500_SPI_SCK_PIN;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
  GPIO_Init(W5500_SPI_SCK_GPIO_PORT, &GPIO_InitStructure);
  /*!< Configure W5500_SPI pins: MOSI */
  GPIO_InitStructure.GPIO_Pin = W5500_SPI_MOSI_PIN;
  GPIO_Init(W5500_SPI_MOSI_GPIO_PORT, &GPIO_InitStructure);
  /*!< Configure W5500_SPI pins: MISO */
  GPIO_InitStructure.GPIO_Pin = W5500_SPI_MISO_PIN;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
  GPIO_Init(W5500_SPI_MISO_GPIO_PORT, &GPIO_InitStructure);
  /*!< SPI configuration */
  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;
  // ## NEEEEEEEEEEEEEEEEEEEEED SPI init code modified for SD Card Recognize (SPI mode 0)
  //SPI_InitStructure.SPI_CPOL = SPI_CPOL_Low;
  //SPI_InitStructure.SPI_CPHA = SPI_CPHA_1Edge;
  SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;
  SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_2;
  SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;
  SPI_InitStructure.SPI_CRCPolynomial = 7;
  SPI_Init(W5500_SPI, &SPI_InitStructure);
  /*!< Enable the W5500_SPI  */
  SPI_Cmd(W5500_SPI, ENABLE);

Please tell me what's wrong in my code.
Thank you in advance.