2020-06-03 08:41 AM
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!
2020-06-03 03:08 PM
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.