[riot-notifications] [RIOT-OS/RIOT] cpu/rp2040: port RIOT to the Raspberry Pi RP2040 MCU (#16609)

Marian Buschsieweke notifications at github.com
Mon Jul 5 13:38:36 CEST 2021


@maribu commented on this pull request.



> +#include "vendor/RP2040.h"
+#include "io_reg.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief   System core clock speed is fixed to 125MHz
+ */
+#define CLOCK_CORECLOCK     (125000000U)
+
+/**
+ * @brief   Clock for UART0 and UART1 peripherals
+ */
+#define CLOCK_CLKPERI       CLOCK_CORECLOCK

> Or is CLKPERI the name from the data sheet?

Yes, exactly. But I really like `CLOCK_PERIPH` better.

> Should it be possible to overwrite this if e.g. a board wants to clock the UART from a low power clock?

There are indeed quite a few options:

```C
/* ==========================================  CLOCKS CLK_PERI_CTRL AUXSRC [5..7]  =========================================== */
typedef enum {                                  /*!< CLOCKS_CLK_PERI_CTRL_AUXSRC                                               */
  CLOCKS_CLK_PERI_CTRL_AUXSRC_clk_sys  = 0,     /*!< clk_sys : clk_sys                                                         */
  CLOCKS_CLK_PERI_CTRL_AUXSRC_clksrc_pll_sys = 1,/*!< clksrc_pll_sys : clksrc_pll_sys                                          */
  CLOCKS_CLK_PERI_CTRL_AUXSRC_clksrc_pll_usb = 2,/*!< clksrc_pll_usb : clksrc_pll_usb                                          */
  CLOCKS_CLK_PERI_CTRL_AUXSRC_rosc_clksrc_ph = 3,/*!< rosc_clksrc_ph : rosc_clksrc_ph                                          */
  CLOCKS_CLK_PERI_CTRL_AUXSRC_xosc_clksrc = 4,  /*!< xosc_clksrc : xosc_clksrc                                                 */
  CLOCKS_CLK_PERI_CTRL_AUXSRC_clksrc_gpin0 = 5, /*!< clksrc_gpin0 : clksrc_gpin0                                               */
  CLOCKS_CLK_PERI_CTRL_AUXSRC_clksrc_gpin1 = 6, /*!< clksrc_gpin1 : clksrc_gpin1                                               */
} CLOCKS_CLK_PERI_CTRL_AUXSRC_Enum;
```

I changed the code to allow changing both source and clock speed with a define.

-- 
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/16609#discussion_r663863040
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210705/7c88fce2/attachment-0001.htm>


More information about the notifications mailing list