diff --git a/arch/arm/src/sama5/sam_timerisr.c b/arch/arm/src/sama5/sam_timerisr.c index 70da7b7bce..1e24702103 100644 --- a/arch/arm/src/sama5/sam_timerisr.c +++ b/arch/arm/src/sama5/sam_timerisr.c @@ -52,11 +52,16 @@ #include "chip/sam_pit.h" /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ -/* The PIT counter runs at a rate of the main clock (MCK) divided by 16 */ +/* The PIT counter runs at a rate of the main clock (MCK) divided by 16. + * + * On the SAMA5D4, the clocking to the PIC may be divided down from MCK. + * Perhaps because of H32MXDIV? We will let the board.h tell us the correct + * PIT include clock by defining BOARD_PIT_FREQUENCY. + */ -#define PIT_CLOCK (BOARD_MCK_FREQUENCY >> 4) +#define PIT_CLOCK (BOARD_PIT_FREQUENCY >> 4) /* The desired timer interrupt frequency is provided by the definition * CLK_TCK (see include/time.h). CLK_TCK defines the desired number of diff --git a/configs/sama5d3-xplained/include/board_384mhz.h b/configs/sama5d3-xplained/include/board_384mhz.h index e297568033..08a26999bc 100644 --- a/configs/sama5d3-xplained/include/board_384mhz.h +++ b/configs/sama5d3-xplained/include/board_384mhz.h @@ -170,6 +170,7 @@ * but not for the SAMA5D3. */ +#define BOARD_PIT_FREQUENCY BOARD_MCK_FREQUENCY #define BOARD_USART_FREQUENCY BOARD_MCK_FREQUENCY /* HSMCI clocking diff --git a/configs/sama5d3-xplained/include/board_396mhz.h b/configs/sama5d3-xplained/include/board_396mhz.h index f41e50f45c..ba76c021a0 100644 --- a/configs/sama5d3-xplained/include/board_396mhz.h +++ b/configs/sama5d3-xplained/include/board_396mhz.h @@ -128,6 +128,7 @@ * but not for the SAMA5D3. */ +#define BOARD_PIT_FREQUENCY BOARD_MCK_FREQUENCY #define BOARD_USART_FREQUENCY BOARD_MCK_FREQUENCY #if defined(CONFIG_SAMA5_EHCI) || defined(CONFIG_SAMA5_OHCI) || \ diff --git a/configs/sama5d3-xplained/include/board_528mhz.h b/configs/sama5d3-xplained/include/board_528mhz.h index 5d6d87a740..bc726b1c66 100644 --- a/configs/sama5d3-xplained/include/board_528mhz.h +++ b/configs/sama5d3-xplained/include/board_528mhz.h @@ -127,6 +127,7 @@ * but not for the SAMA5D3. */ +#define BOARD_PIT_FREQUENCY BOARD_MCK_FREQUENCY #define BOARD_USART_FREQUENCY BOARD_MCK_FREQUENCY #if defined(CONFIG_SAMA5_EHCI) || defined(CONFIG_SAMA5_OHCI) || \ diff --git a/configs/sama5d3-xplained/include/board_sdram.h b/configs/sama5d3-xplained/include/board_sdram.h index 42d3d1314a..4d7a63f261 100644 --- a/configs/sama5d3-xplained/include/board_sdram.h +++ b/configs/sama5d3-xplained/include/board_sdram.h @@ -66,6 +66,7 @@ * but not for the SAMA5D3. */ +#define BOARD_PIT_FREQUENCY BOARD_MCK_FREQUENCY #define BOARD_USART_FREQUENCY BOARD_MCK_FREQUENCY #if defined(CONFIG_SAMA5_EHCI) || defined(CONFIG_SAMA5_OHCI) || \ diff --git a/configs/sama5d3x-ek/include/board_384mhz.h b/configs/sama5d3x-ek/include/board_384mhz.h index d1bcbc40b4..057746fc1c 100644 --- a/configs/sama5d3x-ek/include/board_384mhz.h +++ b/configs/sama5d3x-ek/include/board_384mhz.h @@ -170,6 +170,7 @@ * but not for the SAMA5D3. */ +#define BOARD_PIT_FREQUENCY BOARD_MCK_FREQUENCY #define BOARD_USART_FREQUENCY BOARD_MCK_FREQUENCY /* HSMCI clocking diff --git a/configs/sama5d3x-ek/include/board_396mhz.h b/configs/sama5d3x-ek/include/board_396mhz.h index f1dcd05fa7..f8e5309a5d 100644 --- a/configs/sama5d3x-ek/include/board_396mhz.h +++ b/configs/sama5d3x-ek/include/board_396mhz.h @@ -128,6 +128,7 @@ * but not for the SAMA5D3. */ +#define BOARD_PIT_FREQUENCY BOARD_MCK_FREQUENCY #define BOARD_USART_FREQUENCY BOARD_MCK_FREQUENCY #if defined(CONFIG_SAMA5_EHCI) || defined(CONFIG_SAMA5_OHCI) || \ diff --git a/configs/sama5d3x-ek/include/board_528mhz.h b/configs/sama5d3x-ek/include/board_528mhz.h index a1ad192aa8..27b69c0d29 100644 --- a/configs/sama5d3x-ek/include/board_528mhz.h +++ b/configs/sama5d3x-ek/include/board_528mhz.h @@ -127,7 +127,9 @@ * but not for the SAMA5D3. */ +#define BOARD_PIT_FREQUENCY BOARD_MCK_FREQUENCY #define BOARD_USART_FREQUENCY BOARD_MCK_FREQUENCY + #if defined(CONFIG_SAMA5_EHCI) || defined(CONFIG_SAMA5_OHCI) || \ defined(CONFIG_SAMA5_UDPHS) diff --git a/configs/sama5d3x-ek/include/board_sdram.h b/configs/sama5d3x-ek/include/board_sdram.h index 561d9084b9..019005680f 100644 --- a/configs/sama5d3x-ek/include/board_sdram.h +++ b/configs/sama5d3x-ek/include/board_sdram.h @@ -66,6 +66,7 @@ * but not for the SAMA5D3. */ +#define BOARD_PIT_FREQUENCY BOARD_MCK_FREQUENCY #define BOARD_USART_FREQUENCY BOARD_MCK_FREQUENCY #if defined(CONFIG_SAMA5_EHCI) || defined(CONFIG_SAMA5_OHCI) || \ diff --git a/configs/sama5d4-ek/include/board_384mhz.h b/configs/sama5d4-ek/include/board_384mhz.h index 48df412b98..d1797e393b 100644 --- a/configs/sama5d4-ek/include/board_384mhz.h +++ b/configs/sama5d4-ek/include/board_384mhz.h @@ -169,6 +169,7 @@ * REVISIT: I am not sure why this is. Perhaps because of H32MXDIV? */ +#define BOARD_PIT_FREQUENCY (BOARD_MCK_FREQUENCY >> 1) #define BOARD_USART_FREQUENCY (BOARD_MCK_FREQUENCY >> 1) /* HSMCI clocking diff --git a/configs/sama5d4-ek/include/board_396mhz.h b/configs/sama5d4-ek/include/board_396mhz.h index 978d88ebf7..58895ae328 100644 --- a/configs/sama5d4-ek/include/board_396mhz.h +++ b/configs/sama5d4-ek/include/board_396mhz.h @@ -127,6 +127,7 @@ * REVISIT: I am not sure why this is. Perhaps because of H32MXDIV? */ +#define BOARD_PIT_FREQUENCY (BOARD_MCK_FREQUENCY >> 1) #define BOARD_USART_FREQUENCY (BOARD_MCK_FREQUENCY >> 1) #if defined(CONFIG_SAMA5_EHCI) || defined(CONFIG_SAMA5_OHCI) || \ diff --git a/configs/sama5d4-ek/include/board_528mhz.h b/configs/sama5d4-ek/include/board_528mhz.h index 74c63cf599..31b05e36e9 100644 --- a/configs/sama5d4-ek/include/board_528mhz.h +++ b/configs/sama5d4-ek/include/board_528mhz.h @@ -126,6 +126,7 @@ * REVISIT: I am not sure why this is. Perhaps because of H32MXDIV? */ +#define BOARD_PIT_FREQUENCY (BOARD_MCK_FREQUENCY >> 1) #define BOARD_USART_FREQUENCY (BOARD_MCK_FREQUENCY >> 1) #if defined(CONFIG_SAMA5_EHCI) || defined(CONFIG_SAMA5_OHCI) || \ diff --git a/configs/sama5d4-ek/include/board_sdram.h b/configs/sama5d4-ek/include/board_sdram.h index 496cd52025..535bc91961 100644 --- a/configs/sama5d4-ek/include/board_sdram.h +++ b/configs/sama5d4-ek/include/board_sdram.h @@ -67,6 +67,7 @@ * REVISIT: I am not sure why this is. Perhaps because of H32MXDIV? */ +#define BOARD_PIT_FREQUENCY (BOARD_MCK_FREQUENCY >> 1) #define BOARD_USART_FREQUENCY (BOARD_MCK_FREQUENCY >> 1) #if defined(CONFIG_SAMA5_EHCI) || defined(CONFIG_SAMA5_OHCI) || \