cancel
Showing results for 
Search instead for 
Did you mean: 

Setting up SPI of stm32f205 for ads1118

Kolab
Senior

I am trying to set up SPI according to datasheet .

Here is the datasheet recomendation:

0693W00000BcJLDQA3.pngthe pin that is connected to DRDY is the SPI MISO pin. But on CubeMX I can not change the GPIO mode. There is available only one mode: Alternate Function Push Pull. How to solve this?

5 REPLIES 5

Which STM32?

A pin set to AF can still be used also as EXTI, it's just CubeMX which does not support this.

Program the pin as AF as usually, and then set directly in SYSCFG and EXTI registers as appropriate for the EXTI functionality.

JW

PS. This is a recurring question here, try searching; one of the hints is https://community.st.com/s/question/0D50X0000ADB3vsSQD/how-to-enable-external-interrupt

Kolab
Senior

stm32f205

Kolab
Senior

@Community member​  have you ever solved this before?

Yes, but I don't use CubeMX.

JW

Kolab
Senior

I gave a look at spi file after generation and I found this:

/**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 = 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);

I changed GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; to GPIO_MODE_AF_PP|GPIO_MODE_IT_FALLING|GPIO_MODE_AF_PP; to set up the mode of only pin c11 but it seems not working