cancel
Showing results for 
Search instead for 
Did you mean: 

[STM32L151] STM32CUBEIDE 1.9.0, FW_L1 V1.10.3 SPI1 and SPI2 are missing options to set Clock Polarity (CPOL) and Clock Phase (CPHA)

Alec Davis 2021
Associate III

0693W00000NpjEqQAJ.png 

I was able to resolve by adding to SPI2_Init

 /* USER CODE BEGIN SPI2_Init 1 */

 hspi2.Init.CLKPolarity = SPI_POLARITY_HIGH;

 hspi2.Init.CLKPhase = SPI_PHASE_2EDGE;

But STM32CubeIDE 1.8.0 with same version FW_L1 V1.10.3 does have the options as below

0693W00000NpjhnQAB.png 

This is concerning, as upgrading to 1.9.0 then regenerating the project would change the auto generated SPI2_Init back to the default CPOL and CPHA

Alec Davis

1 ACCEPTED SOLUTION

Accepted Solutions
Sara BEN HADJ YAHYA
ST Employee

Hello @Community member​ ,

Thanks for sharing your finding, It is indeed a CubeMX issue, CPOL and CPHA are missing from SPI configuration.

Your way to resolve this issue is correct and that is the only workaround available at the moment. CPOL and CPHA config should be added manually within the user section in SPIx_init function.

 /* USER CODE BEGIN SPI2_Init 1 */
 
 hspi2.Init.CLKPolarity = SPI_POLARITY_HIGH;
 hspi2.Init.CLKPhase = SPI_PHASE_2EDGE;
 
 /* USER CODE END SPI2_Init 1 */

With this being said, I raised a ticket to the dev team to solve this issue. I will keep you posted.

Internal ticket number: 127964 (This is an internal tracking number and is not accessible or usable by customers).

If your issue is solved, please close this post by clicking the "Select as Best" button. This will help other members of the community find this response more quickly 🙂

Sara.

View solution in original post

2 REPLIES 2
Sara BEN HADJ YAHYA
ST Employee

Hello @Community member​ ,

Thanks for sharing your finding, It is indeed a CubeMX issue, CPOL and CPHA are missing from SPI configuration.

Your way to resolve this issue is correct and that is the only workaround available at the moment. CPOL and CPHA config should be added manually within the user section in SPIx_init function.

 /* USER CODE BEGIN SPI2_Init 1 */
 
 hspi2.Init.CLKPolarity = SPI_POLARITY_HIGH;
 hspi2.Init.CLKPhase = SPI_PHASE_2EDGE;
 
 /* USER CODE END SPI2_Init 1 */

With this being said, I raised a ticket to the dev team to solve this issue. I will keep you posted.

Internal ticket number: 127964 (This is an internal tracking number and is not accessible or usable by customers).

If your issue is solved, please close this post by clicking the "Select as Best" button. This will help other members of the community find this response more quickly 🙂

Sara.

Sara BEN HADJ YAHYA
ST Employee

Hello @Community member 2021,

This issue is fixed in STM32CubeMX latest release.

V6.6.0 is now available under this Link.

Thanks for your contribution.

Sara.