Page 1 of 1

hal_lld for F413 change to enable select of PLLI2S for CK48

Posted: Mon Jan 07, 2019 12:02 pm
by FXCoder
Hi,
#1 Different naming of select for STM32_CK48MSEL_PLLI2S in F413 .h file versus common .h file causes compile fail.
Suggested change #define STM32_CK48MSEL_PLLALT STM32_CK48MSEL_PLLI2S for case where PLLI2S is activated.

#2 F413 does not have PLLI2SP which results in a compile error in .c for hal.
Suggested change #define STM32_PLLI2SP 0 in F413 lld .h file.

--
Bob

Code: Select all

Index: hal_lld_type2.h
===================================================================
--- hal_lld_type2.h   (revision 12537)
+++ hal_lld_type2.h   (working copy)
@@ -1077,6 +1077,7 @@
  * @brief   PLLI2S activation flag.
  */
 #define STM32_ACTIVATE_PLLI2S       TRUE
+#define STM32_CK48MSEL_PLLALT       STM32_CK48MSEL_PLLI2S
 #else
 #define STM32_ACTIVATE_PLLI2S       FALSE
 #endif
@@ -1170,6 +1171,12 @@
 #define STM32_PLLI2S_R_CLKOUT       (STM32_PLLI2SVCO / STM32_PLLI2SR_VALUE)
 
 /**
+ * @brief   PLLI2SP enable bit.
+ * @note    Always 0, there is no PLLI2SP.
+ */
+#define STM32_PLLI2SP               0
+
+/**
  * @brief   PLLSAI activation flag.
  * @note    Always FALSE, there is no PLLSAI.
  */


Re: hal_lld for F413 change to enable select of PLLI2S for CK48

Posted: Fri Jan 11, 2019 12:07 pm
by Giovanni
Hi,

Wouldn't be better to make both files use the same name for consistency? (ALT, I suppose)

Giovanni

Re: hal_lld for F413 change to enable select of PLLI2S for CK48

Posted: Fri Jan 11, 2019 2:14 pm
by FXCoder
Hi,
Using STM32_CK48MSEL_PLLI2S in mcuconf.h makes it quite clear as to which PLL is being selected.
However, STM32_CK48MSEL_PLLALT is more generalised and I've no problem with going that direction.

--
Bob

Re: hal_lld for F413 change to enable select of PLLI2S for CK48

Posted: Sun Jun 30, 2019 1:42 pm
by FXCoder
Hi,
Finishing this one off.
What I did was allow either STM32_CK48MSEL_PLLALT or STM32_CK48MSEL_PLLI2S as selectors in hal_lld.h.
This seemed a reasonable option to me.
--
Bob

Code: Select all

Index: hal_lld.h
===================================================================
--- hal_lld.h   (revision 12862)
+++ hal_lld.h   (working copy)
@@ -182,7 +182,8 @@
 #if STM32_HAS_RCC_CK48MSEL || defined(__DOXYGEN__)
 #if (STM32_CK48MSEL == STM32_CK48MSEL_PLL) || defined(__DOXYGEN__)
 #define STM32_PLL48CLK              (STM32_PLLVCO / STM32_PLLQ_VALUE)
-#elif STM32_CK48MSEL == STM32_CK48MSEL_PLLALT
+#elif (STM32_CK48MSEL == STM32_CK48MSEL_PLLALT) ||                          \
+      (STM32_CK48MSEL == STM32_CK48MSEL_PLLI2S)
 #if STM32_RCC_CK48MSEL_USES_I2S
 #define STM32_PLL48CLK              STM32_PLLI2S_Q_CLKOUT
 #else
Index: hal_lld_type2.h
===================================================================
--- hal_lld_type2.h   (revision 12862)
+++ hal_lld_type2.h   (working copy)
@@ -1075,6 +1075,7 @@
  * @brief   PLLI2S activation flag.
  */
 #define STM32_ACTIVATE_PLLI2S       TRUE
+#define STM32_CK48MSEL_PLLALT       STM32_CK48MSEL_PLLI2S
 #else
 #define STM32_ACTIVATE_PLLI2S       FALSE
 #endif
@@ -1168,6 +1169,12 @@
 #define STM32_PLLI2S_R_CLKOUT       (STM32_PLLI2SVCO / STM32_PLLI2SR_VALUE)
 
 /**
+ * @brief   PLLI2SP enable bit.
+ * @note    Always 0, there is no PLLI2SP.
+ */
+#define STM32_PLLI2SP               0
+
+/**
  * @brief   PLLSAI activation flag.
  * @note    Always FALSE, there is no PLLSAI.
  */

Re: hal_lld for F413 change to enable select of PLLI2S for CK48

Posted: Sun Jun 30, 2019 2:06 pm
by Giovanni
The problem is that one of STM32_CK48MSEL_PLLALT or STM32_CK48MSEL_PLLI2S is undefined.

I committed a different fix, "ALT" is a common alias of the correctly named setting. If it is acceptable I will back-port this.

Giovanni

Re: hal_lld for F413 change to enable select of PLLI2S for CK48  Topic is solved

Posted: Sun Jun 30, 2019 2:09 pm
by FXCoder
Yes.
I neglected to include the additional change in hal_lld_type2.h in the transfer from my F413 project to trunk...
I just fixed it in the post but you beat me to it.
Whatever works is good for me.
--
Bob

Re: hal_lld for F413 change to enable select of PLLI2S for CK48

Posted: Thu Sep 12, 2019 2:03 pm
by FXCoder
Hi,
Finally got back to check this on an F413 project.
Below fixes to:
1. Handle specfifying STM32_CK48MSEL_PLLI2S in mcuconf.h clock setting
2. Handle that F413 has no PLLI2SP bit.
--
Bob

Code: Select all

### Eclipse Workspace Patch 1.0
#P chibios_trunk
Index: os/hal/ports/STM32/STM32F4xx/hal_lld.h
===================================================================
--- os/hal/ports/STM32/STM32F4xx/hal_lld.h   (revision 12966)
+++ os/hal/ports/STM32/STM32F4xx/hal_lld.h   (working copy)
@@ -182,7 +182,8 @@
 #if STM32_HAS_RCC_CK48MSEL || defined(__DOXYGEN__)
 #if (STM32_CK48MSEL == STM32_CK48MSEL_PLL) || defined(__DOXYGEN__)
 #define STM32_PLL48CLK              (STM32_PLLVCO / STM32_PLLQ_VALUE)
-#elif STM32_CK48MSEL == STM32_CK48MSEL_PLLALT
+#elif STM32_CK48MSEL == STM32_CK48MSEL_PLLALT ||                            \
+      STM32_CK48MSEL == STM32_CK48MSEL_PLLI2S
 #if STM32_RCC_CK48MSEL_USES_I2S
 #define STM32_PLL48CLK              STM32_PLLI2S_Q_CLKOUT
 #else
Index: os/hal/ports/STM32/STM32F4xx/hal_lld_type2.h
===================================================================
--- os/hal/ports/STM32/STM32F4xx/hal_lld_type2.h   (revision 12966)
+++ os/hal/ports/STM32/STM32F4xx/hal_lld_type2.h   (working copy)
@@ -1169,6 +1169,12 @@
 #define STM32_PLLI2S_R_CLKOUT       (STM32_PLLI2SVCO / STM32_PLLI2SR_VALUE)
 
 /**
+ * @brief   PLLI2SP enable bit.
+ * @note    Always 0, there is no PLLI2SP.
+ */
+#define STM32_PLLI2SP               0
+
+/**
  * @brief   PLLSAI activation flag.
  * @note    Always FALSE, there is no PLLSAI.
  */