AnsweredAssumed Answered

CubeMX STM32L433CC SPI bug?

Question asked by Br_ggemann.Dieter on Feb 13, 2017
Latest reply on Feb 13, 2017 by Nesrine M

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

Outcomes