cancel
Showing results for 
Search instead for 
Did you mean: 

BUG: STM32Cube FW_L4 V1.13.0 typo in stm32l4s9xx.h regarding SDMMC_POWER registers

RMaja
Associate

In **STM32Cube FW_L4 V1.13.0**,

the HAL Library's SD driver has a typo in the register macro definitions for the SDMMC's power register.

Specifically in the file `stm32;4s9xx.h`, lines *18127* -> *18141* the HAL library generates:

``` C

/****************** Bit definition for SDMMC_POWER register ******************/

#define SDMMC_POWER_PWRCTRL_Pos (0U)

#define SDMMC_POWER_PWRCTRL_Msk (0x3UL << SDMMC_POWER_PWRCTRL_Pos) /*!< 0x00000003 */

#define SDMMC_POWER_PWRCTRL SDMMC_POWER_PWRCTRL_Msk /*!

#define SDMMC_POWER_PWRCTRL_0 (0x1UL << SDMMC_POWER_PWRCTRL_Pos) /*!< 0x00000001 */

#define SDMMC_POWER_PWRCTRL_1 (0x2UL << SDMMC_POWER_PWRCTRL_Pos) /*!< 0x00000002 */

#define SDMMC_POWER_VSWITCH_Pos (2U)

#define SDMMC_POWER_VSWITCH_Msk (0x1UL << SDMMC_POWER_VSWITCH_Pos) /*!< 0x00000004 */

#define SDMMC_POWER_VSWITCH SDMMC_POWER_VSWITCH_Pos /*!

#define SDMMC_POWER_VSWITCHEN_Pos (3U)

#define SDMMC_POWER_VSWITCHEN_Msk (0x1UL << SDMMC_POWER_VSWITCHEN_Pos) /*!< 0x00000008 */

#define SDMMC_POWER_VSWITCHEN SDMMC_POWER_VSWITCHEN_Pos /*!

#define SDMMC_POWER_DIRPOL_Pos (4U)

#define SDMMC_POWER_DIRPOL_Msk (0x1UL << SDMMC_POWER_DIRPOL_Pos) /*!< 0x00000010 */

#define SDMMC_POWER_DIRPOL SDMMC_POWER_DIRPOL_Pos /*!

```

 

you need to replace it with

 

``` C

/****************** Bit definition for SDMMC_POWER register ******************/

#define SDMMC_POWER_PWRCTRL_Pos (0U)

#define SDMMC_POWER_PWRCTRL_Msk (0x3UL << SDMMC_POWER_PWRCTRL_Pos) /*!< 0x00000003 */

#define SDMMC_POWER_PWRCTRL SDMMC_POWER_PWRCTRL_Msk /*!

#define SDMMC_POWER_PWRCTRL_0 (0x1UL << SDMMC_POWER_PWRCTRL_Pos) /*!< 0x00000001 */

#define SDMMC_POWER_PWRCTRL_1 (0x2UL << SDMMC_POWER_PWRCTRL_Pos) /*!< 0x00000002 */

#define SDMMC_POWER_VSWITCH_Pos (2U)

#define SDMMC_POWER_VSWITCH_Msk (0x1UL << SDMMC_POWER_VSWITCH_Pos) /*!< 0x00000004 */

#define SDMMC_POWER_VSWITCH SDMMC_POWER_VSWITCH_Msk /*!

#define SDMMC_POWER_VSWITCHEN_Pos (3U)

#define SDMMC_POWER_VSWITCHEN_Msk (0x1UL << SDMMC_POWER_VSWITCHEN_Pos) /*!< 0x00000008 */

#define SDMMC_POWER_VSWITCHEN SDMMC_POWER_VSWITCHEN_Msk /*!

#define SDMMC_POWER_DIRPOL_Pos (4U)

#define SDMMC_POWER_DIRPOL_Msk (0x1UL << SDMMC_POWER_DIRPOL_Pos) /*!< 0x00000010 */

#define SDMMC_POWER_DIRPOL SDMMC_POWER_DIRPOL_Msk /*!

```

 

The main thing to notice is the incorrect definitions `SDMMC_POWER_VSWITCH`, `SDMMC_POWER_VSWITCHEN`, `SDMMC_POWER_DIRPOL` which should

be defined to their respective masks ****_Msk* and not ****_Pos*.

 

Everytime you regenerate the codebase with CubeMX, you'll need to go back in and fix this typo!

 

#### Effects of this bug

 

It breaks the SD driver when using an SD Card level shifter (transceiver). The STM32 won't be able to communicate with the SD Card as it misconfures the power register.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Imen.D
ST Employee

Hello @RMaja​ ,

This issue is fixed in the STM32CubeL4 V1.14.0 firmware package.

Please update the STM32CubeL4 package and use the latest release.

All your feedback and comments are welcome.

Best Regards,

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

View solution in original post

3 REPLIES 3
Imen.D
ST Employee

Hello @RMaja​ ,

This issue is fixed in the STM32CubeL4 V1.14.0 firmware package.

Please update the STM32CubeL4 package and use the latest release.

All your feedback and comments are welcome.

Best Regards,

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

Hello, @Imen DAHMEN​ !

Btw, how about not ignoring and fixing these series of more than a decade old documentation errors?

https://community.st.com/s/question/0D50X0000B2AG7FSQW/ethernet-send-complete-interrupt-not-triggered-in-stm32f7

Hello Piranda,

Thank you for reporting this issue and bringing this to my attention.

I will take in charge to check and raise it internally.

Thanks and Best Regards,

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen