Page 1 of 1

Incorrect SDMMC defines for STM32L4xx chips

Posted: Wed Jul 13, 2016 9:12 pm
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

Re: Incorrect SDMMC defines for STM32L4xx chips

Posted: Thu Jul 14, 2016 9:24 pm
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.

Re: Incorrect SDMMC defines for STM32L4xx chips

Posted: Thu Jul 14, 2016 9:29 pm
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

Re: Incorrect SDMMC defines for STM32L4xx chips

Posted: Fri Jul 15, 2016 7:33 am
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.

Re: Incorrect SDMMC defines for STM32L4xx chips

Posted: Fri Jul 15, 2016 8:31 am
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