2021-06-29 04:56 AM
I am trying to set up SPI according to datasheet .
Here is the datasheet recomendation:
the 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?
2021-06-29 05:30 AM
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
2021-06-29 05:37 AM
stm32f205
2021-06-29 07:21 AM
@Community member have you ever solved this before?
2021-06-29 08:39 AM
Yes, but I don't use CubeMX.
JW
2021-06-29 02:41 PM
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