cancel
Showing results for 
Search instead for 
Did you mean: 

Configure SPI on stm32f205

Kolab
Senior

Hello!

How can I configure only the MISO pin in the mode falling edge triggered interrupt input? It's not possible to do it on CubeMX. I tried to change the spi.c file like follows:

/**SPI3 GPIO Configuration

  PA15   ------> SPI3_NSS

  PC10   ------> SPI3_SCK

  PC11   ------> SPI3_MISO

  PC12   ------> SPI3_MOSI

  */

  GPIO_InitStruct.Pin = GPIO_PIN_15;

  GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

  GPIO_InitStruct.Pull = GPIO_NOPULL;

  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;

  GPIO_InitStruct.Alternate = GPIO_AF6_SPI3;

  HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

  GPIO_InitStruct.Pin = GPIO_PIN_10|GPIO_PIN_11|GPIO_PIN_12;

GPIO_InitStruct.Mode = I replaced GPIO_MODE_AF_PP; by GPIO_MODE_AF_PP|GPIO_MODE_IT_FALLING|GPIO_MODE_AF_PP;

  GPIO_InitStruct.Pull = GPIO_NOPULL;

  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;

  GPIO_InitStruct.Alternate = GPIO_AF6_SPI3;

  HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);

But it doesn't work. Any help, please?

10 REPLIES 10
Kolab
Senior

thank you all for your help so far. I realized that only setting on Cube a pin as Alternate Function Push Pull is enough to allow you to use this pin as falling edge triggered interrupt input (as this was need for the ADC ads1118). The problem was actually with the spi3 configuration on Cube: I misconfigured the CPAH. This was the key to solve the issue!