here's a patch to enable the HSI48 in the stm32l4 port (BTW, I tried to attach a file, but I couldn't find a "valid" extension")
Index: os/hal/ports/STM32/STM32L4xx/hal_lld.c
===================================================================
--- os/hal/ports/STM32/STM32L4xx/hal_lld.c (revision 11116)
+++ os/hal/ports/STM32/STM32L4xx/hal_lld.c (working copy)
@@ -194,6 +194,14 @@
; /* Wait until HSI is stable. */
#endif
+#if STM32_HSI48_ENABLED
+ /* HSI48 activation.*/
+ RCC->CCIPR |= RCC_CCIPR_CLK48SEL;
+ RCC->CRRCR |= RCC_CRRCR_HSI48ON;
+ while (!(RCC->CRRCR & RCC_CRRCR_HSI48RDY))
+ ; /* Waits until HSI48 is stable. */
+#endif
+
#if STM32_HSE_ENABLED
#if defined(STM32_HSE_BYPASS)
/* HSE Bypass.*/
Index: os/hal/ports/STM32/STM32L4xx/hal_lld.h
===================================================================
--- os/hal/ports/STM32/STM32L4xx/hal_lld.h (revision 11116)
+++ os/hal/ports/STM32/STM32L4xx/hal_lld.h (working copy)
@@ -72,6 +72,7 @@
* @{
*/
#define STM32_HSI16CLK 16000000 /**< High speed internal clock. */
+#define STM32_HSI48CLK 48000000 /**< 48MHz speed internal clock.*/
#define STM32_LSICLK 32000 /**< Low speed internal clock. */
/** @} */
@@ -363,6 +364,13 @@
#endif
/**
+ * @brief Enables or disables the HSI48 clock source.
+ */
+#if !defined(STM32_HSI48_ENABLED) || defined(__DOXYGEN__)
+#define STM32_HSI48_ENABLED FALSE
+#endif
+
+/**
* @brief Enables or disables the LSI clock source.
*/
#if !defined(STM32_LSI_ENABLED) || defined(__DOXYGEN__)
@@ -2001,7 +2009,11 @@
* @brief 48MHz clock frequency.
*/
#if (STM32_CLK48SEL == STM32_CLK48SEL_NOCLK) || defined(__DOXYGEN__)
+#if (STM32_HSI48_ENABLED)
+#define STM32_48CLK STM32_HSI48CLK
+#else
#define STM32_48CLK 0
+#endif
#elif STM32_CLK48SEL == STM32_CLK48SEL_PLLSAI1
#define STM32_48CLK (STM32_PLLSAI1VCO / STM32_PLLSAI1Q_VALUE)
#elif STM32_CLK48SEL == STM32_CLK48SEL_PLL
support for HSI48 in stm32l4xx Topic is solved
-
- Posts: 87
- Joined: Thu May 07, 2015 9:47 pm
- Has thanked: 3 times
- Been thanked: 15 times
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: support for HSI48 in stm32l4xx
Thanks, I will review and merge this during weekend. I don't have HW for tests right now.
giovanni
giovanni
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: support for HSI48 in stm32l4xx
Hi,
Support for HSI48 has been added but not tested, the implementation is a bit different from the one proposed.
Giovanni
Support for HSI48 has been added but not tested, the implementation is a bit different from the one proposed.
Giovanni
-
- Posts: 87
- Joined: Thu May 07, 2015 9:47 pm
- Has thanked: 3 times
- Been thanked: 15 times
Re: support for HSI48 in stm32l4xx
I updated to the latest repo and tested a design with CRS and the latest HSI48 support. The changes work fine.
Thanks !
Geoffrey
Thanks !
Geoffrey
Return to “Small Change Requests”
Who is online
Users browsing this forum: No registered users and 10 guests