stm32cubeMx generate LL init function void MX_SPI2_Init(void) but th e function is not correct in slave mode.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-09-04 12:15 AM
first line in function MX_SPI2_Init()
LL_SPI_InitTypeDef SPI_InitStruct; is not filled with zero's
and baudrate is not set for slave mode.
But in in funtion LL_SPI_Init baurate is filled in an the destruct SPI CR1 register.
I have there fore init the struct to zero and then there is no moer problem
LL_SPI_InitTypeDef SPI_InitStruct = {0};
- Labels:
-
SPI
-
STM32Cube MCU Packages
-
STM32CubeMX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-09-04 12:17 AM
See in question ther is an answer for the problem.
I hope the Stm32cubeMx will look to the problem en generate in a new version
a better code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-09-04 9:52 AM
Hi @Jos Poelmans​ ,
I am using STM32CubeMX 4.26.1 with STM32L052R6Hx, and I see baudrate field initiated as following in MX_SPI2_Init:
SPI_InitStruct.BaudRate = LL_SPI_BAUDRATEPRESCALER_DIV2;
This is the default configuration when enabling SPI2.
Are we using different CubeMX versions? Which device did you selected? May be if you can share a .ioc file.
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
