cancel
Showing results for 
Search instead for 
Did you mean: 

When setting up pins to communicate using SPI on a sensortile I changed the Pins so one is the C and one the B GPIO, how would I set this up, I haeve only seen one somewhat related thread that wasn't comparable, thanks!

AMell.1
Associate III

GPIO_InitTypeDef GPIO_InitStruct;

 /* USER CODE BEGIN SPI2_MspInit 0 */

 /* USER CODE END SPI2_MspInit 0 */

  /* Enable Peripheral clock */

  __HAL_RCC_SPI2_CLK_ENABLE();

  __HAL_RCC_GPIOB_CLK_ENABLE();

  

  /**SPI2 GPIO Configuration   

  PB15   ------> SPI2_MOSI

  PB13   ------> SPI2_SCK 

  */

  GPIO_InitStruct.Pin = GPIO_PIN_15|GPIO_PIN_13;

  GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

  GPIO_InitStruct.Pull = GPIO_PULLUP;

  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;

  GPIO_InitStruct.Alternate = GPIO_AF5_SPI2;

  HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

is there a way to set this up to communicate as having

  PB15   ------> SPI2_MOSI

  PC8   ------> SPI2_SCK 

is it possible to communicate on different C and B arrays of pins

thanks so much for any help!

1 REPLY 1
TDK
Guru

PC8 is not a valid option for SPI2_SCK. There are a limited number of pins you can select for each peripheral. STM32CubeMX is a good tool to use when designing the pinouts for all the peripherals.

If you feel a post has answered your question, please click "Accept as Solution".