Setting up SPI of stm32f205 for ads1118
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-29 4: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?
- Labels:
-
SPI
-
STM32CubeMX
-
STM32F2 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-29 5: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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-29 5:37 AM
stm32f205
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-29 7:21 AM
@Community member​ have you ever solved this before?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-29 8:39 AM
Yes, but I don't use CubeMX.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-06-29 2: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
