Why there are no signals on MOSI and SCK of SPI2 in my stm32f030c8?
I am trying to connect LCD (SPI interface) to my custom stm32f030c8 board, PB13 -> SCK, PB15 -> MOSI (Transmitt only mode).
I created a test project with cube configurator (attached a screenshot).
I did not change anything in the generated code, just added sending test:
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_ADC_Init();
MX_SPI2_Init();
MX_TIM1_Init();
MX_TIM14_Init();
MX_TIM16_Init();
MX_TIM17_Init();
MX_USART1_UART_Init();
/* USER CODE BEGIN 2 */
uint8_t testData[] = { 0x11, 0x22, 0x33, 0x44 };
HAL_SPI_Transmit(&hspi2, testData, 4, 5000);
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}I uses ST-Link to debug. All initializations pass so as the transmit subroutine, but there are no any signals on MOSI and SCK appears (I use oscilloscope with sync by signal front). I tried to change pins mode to general outputs and to toggle output levels manualy, and I got that levels on my oscilloscope, so there are no broken lines.
In SR register only TXE is set, in CR1 register SPE is set, all seems to fine.
So why there are no SPI signals?
I checked GPIOs config, looks right:
/* Peripheral clock enable */
__HAL_RCC_SPI2_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
/**SPI2 GPIO Configuration
PB13 ------> SPI2_SCK
PB15 ------> SPI2_MOSI
*/
GPIO_InitStruct.Pin = GPIO_PIN_13|GPIO_PIN_15;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
GPIO_InitStruct.Alternate = GPIO_AF0_SPI2;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
