diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-08-11 14:29:43 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-08-11 14:29:43 -0600 |
commit | c3d48a6b4f7b1b340876d4460a77e58e3fa5e5c5 (patch) | |
tree | 34548c82d1e28ee44f0738985eef5ad5494dc748 | |
parent | 65a029c74614adbfaba41ef0192c7e03d993ff30 (diff) | |
download | nuttx-c3d48a6b4f7b1b340876d4460a77e58e3fa5e5c5.tar.gz nuttx-c3d48a6b4f7b1b340876d4460a77e58e3fa5e5c5.tar.bz2 nuttx-c3d48a6b4f7b1b340876d4460a77e58e3fa5e5c5.zip |
SAMA5: Enable the 32.768 crystal if SCHED_TICKLESS is selected
-rw-r--r-- | nuttx/configs/sama5d3-xplained/Kconfig | 5 | ||||
-rw-r--r-- | nuttx/configs/sama5d3-xplained/README.txt | 3 | ||||
-rw-r--r-- | nuttx/configs/sama5d3-xplained/src/sam_boot.c | 7 | ||||
-rw-r--r-- | nuttx/configs/sama5d3x-ek/Kconfig | 6 | ||||
-rw-r--r-- | nuttx/configs/sama5d3x-ek/README.txt | 3 | ||||
-rw-r--r-- | nuttx/configs/sama5d3x-ek/src/sam_boot.c | 9 | ||||
-rw-r--r-- | nuttx/configs/sama5d3x-ek/src/sam_wm8904.c | 6 | ||||
-rw-r--r-- | nuttx/configs/sama5d4-ek/Kconfig | 6 | ||||
-rw-r--r-- | nuttx/configs/sama5d4-ek/README.txt | 9 | ||||
-rw-r--r-- | nuttx/configs/sama5d4-ek/src/sam_boot.c | 9 | ||||
-rw-r--r-- | nuttx/configs/sama5d4-ek/src/sam_wm8904.c | 6 |
11 files changed, 58 insertions, 11 deletions
diff --git a/nuttx/configs/sama5d3-xplained/Kconfig b/nuttx/configs/sama5d3-xplained/Kconfig index 27139b53e..25d97d6fb 100644 --- a/nuttx/configs/sama5d3-xplained/Kconfig +++ b/nuttx/configs/sama5d3-xplained/Kconfig @@ -20,6 +20,11 @@ config SAMA5D3XPLAINED_528MHZ endchoice # CPU Frequency +config SAMA5D3XPLAINED_SLOWCLOCK + bool + default y if SCHED_TICKLESS + default n if !SCHED_TICKLESS + choice prompt "SAMA5D3-Xplained DRAM Type" default SAMA5D3XPLAINED_MT47H128M16RT diff --git a/nuttx/configs/sama5d3-xplained/README.txt b/nuttx/configs/sama5d3-xplained/README.txt index c9d855141..85342306d 100644 --- a/nuttx/configs/sama5d3-xplained/README.txt +++ b/nuttx/configs/sama5d3-xplained/README.txt @@ -2392,7 +2392,8 @@ Tickless OS NOTE: In most cases, the slow clock will be used as the timer/counter input. You should enable the 32.768KHz crystal for the slow clock by calling sam_sckc_enable(). Otherwise, you will be doing all system - timing using the RC clock! + timing using the RC clock! UPDATE: This will now be selected by default + when you configure for TICKLESS support. SAMA5 Timer Usage ----------------- diff --git a/nuttx/configs/sama5d3-xplained/src/sam_boot.c b/nuttx/configs/sama5d3-xplained/src/sam_boot.c index fd651bf27..34d0a1593 100644 --- a/nuttx/configs/sama5d3-xplained/src/sam_boot.c +++ b/nuttx/configs/sama5d3-xplained/src/sam_boot.c @@ -41,6 +41,7 @@ #include <debug.h> +#include "sam_sckc.h" #include "sama5d3-xplained.h" /************************************************************************************ @@ -67,6 +68,12 @@ void sam_boardinitialize(void) { +#ifdef CONFIG_SAMA5D3XPLAINED_SLOWCLOCK + /* Enable the external slow clock */ + + sam_sckc_enable(true); +#endif + /* Configure SPI chip selects if 1) SPI is enable, and 2) the weak function * sam_spiinitialize() has been brought into the link. */ diff --git a/nuttx/configs/sama5d3x-ek/Kconfig b/nuttx/configs/sama5d3x-ek/Kconfig index 8c7bcb84e..5444cd2d5 100644 --- a/nuttx/configs/sama5d3x-ek/Kconfig +++ b/nuttx/configs/sama5d3x-ek/Kconfig @@ -248,6 +248,11 @@ config SAMA5D3xEK_OV2640_DEMO endif # VIDEO_OV2640 +config SAMA5D3xEK_SLOWCLOCK + bool + default y if SCHED_TICKLESS + default n if !SCHED_TICKLESS + if AUDIO_WM8904 config SAMA5D3xEK_WM8904_I2CFREQUENCY @@ -266,6 +271,7 @@ choice config SAMA5D3xEK_WM8904_SRCMAIN bool "Main Clock (12MHz)" + select SAMA5D3xEK_SLOWCLOCK config SAMA5D3xEK_WM8904_SRCSCK bool "Slow XTAL (32.768KHz)" diff --git a/nuttx/configs/sama5d3x-ek/README.txt b/nuttx/configs/sama5d3x-ek/README.txt index f3c6fa7d1..3b4de458f 100644 --- a/nuttx/configs/sama5d3x-ek/README.txt +++ b/nuttx/configs/sama5d3x-ek/README.txt @@ -2708,7 +2708,8 @@ Tickless OS NOTE: In most cases, the slow clock will be used as the timer/counter input. You should enable the 32.768KHz crystal for the slow clock by calling sam_sckc_enable(). Otherwise, you will be doing all system - timing using the RC clock! + timing using the RC clock! UPDATE: This will now be selected by default + when you configure for TICKLESS support. SAMA5 Timer Usage ----------------- diff --git a/nuttx/configs/sama5d3x-ek/src/sam_boot.c b/nuttx/configs/sama5d3x-ek/src/sam_boot.c index fc28ecd53..42e2f9012 100644 --- a/nuttx/configs/sama5d3x-ek/src/sam_boot.c +++ b/nuttx/configs/sama5d3x-ek/src/sam_boot.c @@ -41,6 +41,7 @@ #include <debug.h> +#include "sam_sckc.h" #include "sama5d3x-ek.h" /************************************************************************************ @@ -60,13 +61,19 @@ * * Description: * All SAMA5 architectures must provide the following entry point. This entry - * point is called early in the intitialization -- after all memory has been + * point is called early in the initialization -- after all memory has been * configured and mapped but before any devices have been initialized. * ************************************************************************************/ void sam_boardinitialize(void) { +#ifdef CONFIG_SAMA5D3xEK_SLOWCLOCK + /* Enable the external slow clock */ + + sam_sckc_enable(true); +#endif + /* Configure SPI chip selects if 1) SPI is enable, and 2) the weak function * sam_spiinitialize() has been brought into the link. */ diff --git a/nuttx/configs/sama5d3x-ek/src/sam_wm8904.c b/nuttx/configs/sama5d3x-ek/src/sam_wm8904.c index 919e96089..d81e891fa 100644 --- a/nuttx/configs/sama5d3x-ek/src/sam_wm8904.c +++ b/nuttx/configs/sama5d3x-ek/src/sam_wm8904.c @@ -56,7 +56,6 @@ #include "sam_pio.h" #include "sam_twi.h" #include "sam_ssc.h" -#include "sam_sckc.h" #include "sam_pck.h" #include "sama5d3x-ek.h" @@ -293,9 +292,10 @@ int sam_wm8904_initialize(int minor) */ #ifdef CONFIG_SAMA5D3xEK_WM8904_SRCSCK - /* Drive the DAC with the slow clock (32.768 KHz) */ + /* Drive the DAC with the slow clock (32.768 KHz). The slow clock was + * enabled in sam_boot.c if needed. + */ - sam_sckc_enable(true); (void)sam_pck_configure(PCK0, PCKSRC_SCK, BOARD_SLOWCLK_FREQUENCY); #else /* Drive the DAC with the main clock (12 MHz) */ diff --git a/nuttx/configs/sama5d4-ek/Kconfig b/nuttx/configs/sama5d4-ek/Kconfig index 99d63a79f..fee373bee 100644 --- a/nuttx/configs/sama5d4-ek/Kconfig +++ b/nuttx/configs/sama5d4-ek/Kconfig @@ -268,6 +268,11 @@ config SAMA5D4EK_CHANNEL Selects the PWM channel number that will be used to perform the PWM test. See apps/examples/pwm. +config SAMA5D4EK_SLOWCLOCK + bool + default y if SCHED_TICKLESS + default n if !SCHED_TICKLESS + if AUDIO_WM8904 config SAMA5D4EK_WM8904_I2CFREQUENCY @@ -289,6 +294,7 @@ config SAMA5D4EK_WM8904_SRCMAIN config SAMA5D4EK_WM8904_SRCSCK bool "Slow XTAL (32.768KHz)" + select SAMA5D4EK_SLOWCLOCK endchoice # WM8904 MCLK source endif # AUDIO_WM8904 diff --git a/nuttx/configs/sama5d4-ek/README.txt b/nuttx/configs/sama5d4-ek/README.txt index 07d9036ba..2ee7d8b7b 100644 --- a/nuttx/configs/sama5d4-ek/README.txt +++ b/nuttx/configs/sama5d4-ek/README.txt @@ -3172,7 +3172,14 @@ Tickless OS NOTE: In most cases, the slow clock will be used as the timer/counter input. You should enable the 32.768KHz crystal for the slow clock by calling sam_sckc_enable(). Otherwise, you will be doing all system - timing using the RC clock! + timing using the RC clock! UPDATE: This will now be selected by default + when you configure for TICKLESS support. + + UPDATE: As of this writing (2014-8-11), the Tickless support is + functional. However, the timing for all delays appears to be half the + duration that it should be. I don't see anything wrong with the setup + and I am suspecting that there may be something I don't understand about + the counting frequency. SAMA5 Timer Usage ----------------- diff --git a/nuttx/configs/sama5d4-ek/src/sam_boot.c b/nuttx/configs/sama5d4-ek/src/sam_boot.c index d1ea4a500..fb6f32cfe 100644 --- a/nuttx/configs/sama5d4-ek/src/sam_boot.c +++ b/nuttx/configs/sama5d4-ek/src/sam_boot.c @@ -41,6 +41,7 @@ #include <debug.h> +#include "sam_sckc.h" #include "sama5d4-ek.h" /************************************************************************************ @@ -60,13 +61,19 @@ * * Description: * All SAMA5 architectures must provide the following entry point. This entry - * point is called early in the intitialization -- after all memory has been + * point is called early in the initialization -- after all memory has been * configured and mapped but before any devices have been initialized. * ************************************************************************************/ void sam_boardinitialize(void) { +#ifdef CONFIG_SAMA5D4EK_SLOWCLOCK + /* Enable the external slow clock */ + + sam_sckc_enable(true); +#endif + /* Configure SPI chip selects if 1) SPI is enable, and 2) the weak function * sam_spiinitialize() has been brought into the link. */ diff --git a/nuttx/configs/sama5d4-ek/src/sam_wm8904.c b/nuttx/configs/sama5d4-ek/src/sam_wm8904.c index c11eb1457..b42498353 100644 --- a/nuttx/configs/sama5d4-ek/src/sam_wm8904.c +++ b/nuttx/configs/sama5d4-ek/src/sam_wm8904.c @@ -56,7 +56,6 @@ #include "sam_pio.h" #include "sam_twi.h" #include "sam_ssc.h" -#include "sam_sckc.h" #include "sam_pck.h" #include "sama5d4-ek.h" @@ -293,9 +292,10 @@ int sam_wm8904_initialize(int minor) */ #ifdef CONFIG_SAMA5D4EK_WM8904_SRCSCK - /* Drive the DAC with the slow clock (32.768 KHz) */ + /* Drive the DAC with the slow clock (32.768 KHz). The slow clock was + * enabled in sam_boot.c if needed. + */ - sam_sckc_enable(true); (void)sam_pck_configure(PCK2, PCKSRC_SCK, BOARD_SLOWCLK_FREQUENCY); #else /* Drive the DAC with the main clock (12 MHz) */ |