CubeMX STM32L433CC SPI bug?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2017-02-13 7:02 AM
Hi
CubeMX 4.19 with STM32L433CCx selected generates the following code for SPI2
void HAL_SPI_MspInit(SPI_HandleTypeDef* spiHandle)
{
GPIO_InitTypeDef GPIO_InitStruct;
if(spiHandle->Instance==SPI2)
{
/* USER CODE BEGIN SPI2_MspInit 0 */
/* USER CODE END SPI2_MspInit 0 */
/* Peripheral clock enable */
__HAL_RCC_SPI2_CLK_ENABLE();
/**SPI2 GPIO Configuration
PB13 ------> SPI2_SCK
PB14 ------> SPI2_MISO
PB15 ------> SPI2_MOSI
*/
GPIO_InitStruct.Pin = GPIO_PIN_13|GPIO_PIN_14|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_AF5_SPI2;
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
/* USER CODE BEGIN SPI2_MspInit 1 */
/* USER CODE END SPI2_MspInit 1 */
}
}
�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?
Because PB14 is MISO, GPIO_MODE_AF_PP is wrong. This the default.
When trying to correct this in 'Configuration' the only choice is this setting. Input Mode for MISO is not offered in drop down box. Further more when touching this drop down box the setting becomes marked as modified.
Dieter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2017-02-13 7:50 AM
Hi
Br_ggemann.Dieter
,Please refer to
pin definitions on
your related datasheet.Also I recommend you to have a look to SPI examples under the STM32L4 package to have idea about SPI pins configuration :
STM32Cube_FW_L4_V1.5.0\Projects\STM32L432KC-Nucleo\Examples\SPI
-Nesrine-
