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

Report here problems in any of ChibiOS components. This forum is NOT for support.
User avatar
FXCoder
Posts: 186
Joined: Sun Jun 12, 2016 4:10 am
Location: Sydney, Australia
Has thanked: 68 times
Been thanked: 53 times

hal_lld for F413 change to enable select of PLLI2S for CK48

Postby FXCoder » Mon Jan 07, 2019 12:02 pm

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.
  */


User avatar
Giovanni
Site Admin
Posts: 12098
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 549 times
Been thanked: 469 times
Contact:

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

Postby Giovanni » Fri Jan 11, 2019 12:07 pm

Hi,

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

Giovanni

User avatar
FXCoder
Posts: 186
Joined: Sun Jun 12, 2016 4:10 am
Location: Sydney, Australia
Has thanked: 68 times
Been thanked: 53 times

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

Postby FXCoder » Fri Jan 11, 2019 2:14 pm

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

User avatar
FXCoder
Posts: 186
Joined: Sun Jun 12, 2016 4:10 am
Location: Sydney, Australia
Has thanked: 68 times
Been thanked: 53 times

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

Postby FXCoder » Sun Jun 30, 2019 1:42 pm

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.
  */

User avatar
Giovanni
Site Admin
Posts: 12098
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 549 times
Been thanked: 469 times
Contact:

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

Postby Giovanni » Sun Jun 30, 2019 2:06 pm

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

User avatar
FXCoder
Posts: 186
Joined: Sun Jun 12, 2016 4:10 am
Location: Sydney, Australia
Has thanked: 68 times
Been thanked: 53 times

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

Postby FXCoder » Sun Jun 30, 2019 2:09 pm

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

User avatar
FXCoder
Posts: 186
Joined: Sun Jun 12, 2016 4:10 am
Location: Sydney, Australia
Has thanked: 68 times
Been thanked: 53 times

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

Postby FXCoder » Thu Sep 12, 2019 2:03 pm

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.
  */


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 3 guests