STMicroelectronics / STM32CubeL0

STM32Cube MCU Full Package for the STM32L0 series - (HAL + LL Drivers, CMSIS Core, CMSIS Device, MW libraries plus a set of Projects running on all boards provided by ST (Nucleo, Evaluation and Discovery Kits))
Other
103 stars 57 forks source link

RCC->CRRCR register accesses should have RCC_HSI48_SUPPORT compilation guard #15

Closed ricehornet closed 3 years ago

ricehornet commented 3 years ago

In the STM32L0 example projects' system_stm32l0xx modules there is a reconfiguration of the RCC->CRRCR register in the default clock config, but only MCUs with an HSI48 include this register. For example, I was using this project with a STM32L071CB MCU which does not include the RCC->CRRCR register:

https://github.com/STMicroelectronics/STM32CubeL0/blob/master/Projects/NUCLEO-L073RZ/Examples/PWR/PWR_STOP/Src/system_stm32l0xx.c#L146-L147

I think it should be:

#if defined(RCC_HSI48_SUPPORT)
/*!< Reset HSI48ON  bit */
  RCC->CRRCR &= (uint32_t)0xFFFFFFFEU;
#endif

While this didn't appear to cause any problems for me, I was confused when using the example because I couldn't find this register in my MCU's reference manual. Hoping that it can help others who are going through the code line-by-line.

RKOUSTM commented 3 years ago

Hi @ricehornet,

Thank you for your contribution. Actually, the reported point and the other point raised in #16 have already been resolved. In fact, we have discussed them internally and we are working on aligning all STM32CubeL0 projects with the system_stm32l0xx.c file. A fix will be made available in the frame of a future release.

Please allow me then to close this one and to consider the other. Stay tuned and thank you once more for your contribution.

With regards,

RKOUSTM commented 3 years ago

ST Internal Reference: 104564

RKOUSTM commented 3 years ago

Duplicate of #16.