Incorrect SDMMC defines for STM32L4xx chips

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

Moderators: barthess, RoccoMarco

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

Incorrect SDMMC defines for STM32L4xx chips

Postby wgreiman » Wed Jul 13, 2016 9:12 pm

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: 273
Joined: Sat Jul 19, 2014 12:59 pm
Been thanked: 6 times

Re: Incorrect SDMMC defines for STM32L4xx chips

Postby rew » Thu Jul 14, 2016 9:24 pm

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: 12177
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 570 times
Been thanked: 487 times
Contact:

Re: Incorrect SDMMC defines for STM32L4xx chips

Postby Giovanni » Thu Jul 14, 2016 9:29 pm

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: 273
Joined: Sat Jul 19, 2014 12:59 pm
Been thanked: 6 times

Re: Incorrect SDMMC defines for STM32L4xx chips

Postby rew » Fri Jul 15, 2016 7:33 am

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: 12177
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 570 times
Been thanked: 487 times
Contact:

Re: Incorrect SDMMC defines for STM32L4xx chips

Postby Giovanni » Fri Jul 15, 2016 8:31 am

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


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 1 guest