AnsweredAssumed Answered

[bug] GPIO setting for SPIx_NSS pin

Question asked by Gronlie.Ryan on Feb 26, 2016
Latest reply on Mar 22, 2016 by STM32Cube-T
With STM32CubeMX v4.13.0 and STM32CubeF0 v1.5.0 the GPIO initialization for a hardware NSS pin has changed and doesn't match the information in the reference manual.

For example SPI1_NSS from STMCubeF0 v1.2.1 was initialized:
GPIO_InitStruct.Pin = GPIO_PIN_15;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_LOW;
GPIO_InitStruct.Alternate = GPIO_AF0_SPI1;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

Now SPI1_NSS from STMCubeF0 v1.5.0 is initialized:
GPIO_InitStruct.Pin = GPIO_PIN_15;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_PULLUP;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

Receiving data on SPI using DMA is working intermittently. I'm seeing weird issues like entire data blocks shifted by 1 bit. I've had to manually change the GPIO initialization code to get SPI transfers working properly again.

The reference manual indicates that NSS is an alternate function, so I'm not sure why it was changed to be initialized as a pure GPIO input.

Outcomes