Question
[bug] GPIO setting for SPIx_NSS pin
Posted on February 26, 2016 at 03:09
With STM32CubeMX v4.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);
NowSPI1_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.
#stmcubef0 #bug-stm32cubemx