[riot-notifications] [RIOT-OS/RIOT] cpu/qn908x: Initial minimal support for NXP QN908x CPUs. (#13855)

iosabi notifications at github.com
Sun Nov 29 18:14:36 CET 2020


@iosabi commented on this pull request.



> +void clocks_init(void)
+{
+    /* Set up clock selectors - Attach clocks to the peripheries */
+
+    /* Switch XTAL_CLK to 32M */
+    CLOCK_AttachClk(k32M_to_XTAL_CLK);
+    /* Switch 32K_CLK to XTAL32K */
+    CLOCK_AttachClk(kXTAL32K_to_32K_CLK);
+    /* Switch SYS_CLK to XTAL */
+    CLOCK_AttachClk(kXTAL_to_SYS_CLK);
+    /* Switch WDT_CLK to APB */
+    CLOCK_AttachClk(kAPB_to_WDT_CLK);
+
+    /* Set up dividers */
+
+    /* Set OSC32M_DIV divider to value 2 */
+    CLOCK_SetClkDiv(kCLOCK_DivOsc32mClk, 1U);
+    /* Set XTAL_DIV divider to value 2 */
+    CLOCK_SetClkDiv(kCLOCK_DivXtalClk, 1U);
+    /* Set AHB_DIV divider to value 2 */
+    CLOCK_SetClkDiv(kCLOCK_DivAhbClk, 1U);
+    /* Set FRG_MULT1 to value 0, Set FRG_DIV1 to value 255 */
+    CLOCK_SetClkDiv(kCLOCK_DivFrg1, 0U);
+    /* Set FRG_MULT0 to value 0, Set FRG_DIV0 to value 255 */
+    CLOCK_SetClkDiv(kCLOCK_DivFrg0, 0U);
+    /* Set APB_DIV divider to value 1 */
+    CLOCK_SetClkDiv(kCLOCK_DivApbClk, 0U);
+}

ok, the thinking here is that whether you have an external XTAL for 32 MHz (or 16 MHz) and another external xtal for the 32.768 KHz depends on the board wiring, you can have a design that uses only the internal ones (32MHz and 32.768 KHz), then based on this you would have different clock setup for the board which also changes how do you configure the APB bus clock for the peripherals.

Should all of this be done using macros in `cpu_conf.h` that the board can override, but the code lives in cpu_init() (or a function called from there)?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/13855#discussion_r532238610
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20201129/84a584e0/attachment.htm>


More information about the notifications mailing list