Incorrect SDMMC defines for STM32L4xx chips

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
wgreiman
Posts: 33
Joined: Sun Oct 23, 2011 3:21 pm
Been thanked: 2 times

Incorrect SDMMC defines for STM32L4xx chips

Post by wgreiman »

SDMMC_DCTRL_DBLOCKSIZE_2 and SDMMC_DCTRL_DBLOCKSIZE_3 are incorrect in a number of files.

Code: Select all

#define SDMMC_DCTRL_DBLOCKSIZE_2             (0x3U << SDMMC_DCTRL_DBLOCKSIZE_Pos) /*!< 0x00000040 */
#define SDMMC_DCTRL_DBLOCKSIZE_3             (0x4U << SDMMC_DCTRL_DBLOCKSIZE_Pos) /*!< 0x00000080 */

Should be:

Code: Select all

#define SDMMC_DCTRL_DBLOCKSIZE_2             (0x4U << SDMMC_DCTRL_DBLOCKSIZE_Pos) /*!< 0x00000040 */
#define SDMMC_DCTRL_DBLOCKSIZE_3             (0x8U << SDMMC_DCTRL_DBLOCKSIZE_Pos) /*!< 0x00000080 */


Here is a list problem files.
common/ext/CMSIS/ST/STM32L4xx/stm32l431xx.h
common/ext/CMSIS/ST/STM32L4xx/stm32l433xx.h
common/ext/CMSIS/ST/STM32L4xx/stm32l443xx.h
common/ext/CMSIS/ST/STM32L4xx/stm32l471xx.h
common/ext/CMSIS/ST/STM32L4xx/stm32l475xx.h
common/ext/CMSIS/ST/STM32L4xx/stm32l476xx.h
common/ext/CMSIS/ST/STM32L4xx/stm32l485xx.h
common/ext/CMSIS/ST/STM32L4xx/stm32l486xx.h
rew
Posts: 383
Joined: Sat Jul 19, 2014 12:59 pm
Has thanked: 2 times
Been thanked: 14 times

Re: Incorrect SDMMC defines for STM32L4xx chips

Post by rew »

Those files are from ST themselves.... but reading the comments... it is blindingly obvious that you are right and that the defines are wrong.
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Incorrect SDMMC defines for STM32L4xx chips

Post by Giovanni »

rew wrote:Those files are from ST themselves.... but reading the comments... it is blindingly obvious that you are right and that the defines are wrong.


It is not like they cannot do errors :)

Giovanni
rew
Posts: 383
Joined: Sat Jul 19, 2014 12:59 pm
Has thanked: 2 times
Been thanked: 14 times

Re: Incorrect SDMMC defines for STM32L4xx chips

Post by rew »

At first i mis-read the licence at the top so I thought that modification and redistribution was NOT allowed. But "chibios" can ship "fixed" files.

Anyway, because the files do not originate at chibios, informing ST would be the proper way to handle it. I've tried a few times but don't get any indication that it's working. From Atmel I usually get a reaction: "internally reported, will be fixed in the next revision".

That said: Naming the bits like that is good for in a datasheet, but not for coding. Who is going to do

(((datasize-1)&8)>>3) * SPI_CR2_DS3 | (((datasize-1)&4)>>2) * SPI_CR2_DS2 | (((datasize-1)&2)>>1) * SPI_CR2_DS1 | ((datasize-1)&1) * SPI_CR2_DS0

? That is just the kind of mess that promotes typos like we see here.
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Incorrect SDMMC defines for STM32L4xx chips

Post by Giovanni »

Fun thing is that I work in ST but in another division (automotive), I am not related to STM32 developments, I don't know how or to who report this...

I used to post problems in the forum but with no acknowledge or apparent reaction.

Anyway, I will fix those in our distribution.

Giovanni
Post Reply