boards/arduino-zero/include/periph_conf.h

Configuration of CPU peripherals for Arduino Zero board.

CLOCK_USE_PLL

External oscillator and clock configuration.

1
(1)

For selection of the used CORECLOCK, we have implemented two choices:

  • usage of the PLL fed by the internal 8MHz oscillator divided by 8
  • usage of the internal 8MHz oscillator directly, divided by N if needed

The PLL option allows for the usage of a wider frequency range and a more stable clock with less jitter. This is why we use this option as default.

The target frequency is computed from the PLL multiplier and the PLL divisor. Use the following formula to compute your values:

CORECLOCK = ((PLL_MUL + 1) * 1MHz) / PLL_DIV

NOTE: The PLL circuit does not run with less than 32MHz while the maximum PLL frequency is 96MHz. So PLL_MULL must be between 31 and 95!

The internal Oscillator used directly can lead to a slightly better power efficiency to the cost of a less stable clock. Use this option when you know what you are doing! The actual core frequency is adjusted as follows:

CORECLOCK = 8MHz / DIV

NOTE: A core clock frequency below 1MHz is not recommended

CLOCK_PLL_MUL
1
(47U)               /* must be >= 31 & <= 95 */
CLOCK_PLL_DIV
1
(1U)                /* adjust to your needs */
CLOCK_CORECLOCK
1
(((CLOCK_PLL_MUL + 1) * 1000000U) / CLOCK_PLL_DIV)
TIMER_NUMOF
1
(2U)
TIMER_0_EN
1
1
TIMER_1_EN
1
1
TIMER_0_DEV
1
TC3->COUNT16
TIMER_0_CHANNELS
1
2
TIMER_0_MAX_VALUE
1
(0xffff)
TIMER_0_ISR
1
isr_tc3
TIMER_1_DEV
1
TC4->COUNT32
TIMER_1_CHANNELS
1
2
TIMER_1_MAX_VALUE
1
(0xffffffff)
TIMER_1_ISR
1
isr_tc4
UART_0_ISR
1
isr_sercom5
UART_1_ISR
1
isr_sercom0
UART_NUMOF
1
(sizeof(uart_config) / sizeof(uart_config[0]))
const uart_conf_t uart_config()
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
= {
    {
        .dev      = &SERCOM5->USART,
        .rx_pin   = GPIO_PIN(PB,23),
        .tx_pin   = GPIO_PIN(PB,22),
        .mux      = GPIO_MUX_D,
        .rx_pad   = UART_PAD_RX_3,
        .tx_pad   = UART_PAD_TX_2,
        .flags    = UART_FLAG_NONE,
        .gclk_src = GCLK_CLKCTRL_GEN_GCLK0
    },
    {
        .dev      = &SERCOM0->USART,
        .rx_pin   = GPIO_PIN(PA,11),
        .tx_pin   = GPIO_PIN(PA,10),
        .mux      = GPIO_MUX_C,
        .rx_pad   = UART_PAD_RX_3,
        .tx_pad   = UART_PAD_TX_2,
        .flags    = UART_FLAG_NONE,
        .gclk_src = GCLK_CLKCTRL_GEN_GCLK0
    }
}
PWM_0_EN
1
1
PWM_1_EN
1
1
PWM_MAX_CHANNELS
1
2
PWM_0_CHANNELS
1
PWM_MAX_CHANNELS
PWM_1_CHANNELS
1
PWM_MAX_CHANNELS
PWM_NUMOF
1
(2U)
const pwm_conf_t pwm_config()
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
= {

    {TCC0, {
        
        { GPIO_PIN(PA, 8), GPIO_MUX_E,  0 },
        { GPIO_PIN(PA, 9), GPIO_MUX_E,  1 },
    }},


    {TCC1, {
        
        { GPIO_PIN(PA, 6), GPIO_MUX_E, 0 },
        { GPIO_PIN(PA, 7), GPIO_MUX_E, 1 },
    }},

}
ADC_NUMOF
1
(0)
SPI_NUMOF
1
(sizeof(spi_config) / sizeof(spi_config[0]))
const spi_conf_t spi_config()
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
= {
    {
        .dev      = &SERCOM4->SPI,
        .miso_pin = GPIO_PIN(PA, 12),
        .mosi_pin = GPIO_PIN(PB, 10),
        .clk_pin  = GPIO_PIN(PB, 11),
        .miso_mux = GPIO_MUX_D,
        .mosi_mux = GPIO_MUX_D,
        .clk_mux  = GPIO_MUX_D,
        .miso_pad = SPI_PAD_MISO_0,
        .mosi_pad = SPI_PAD_MOSI_2_SCK_3
    }
}
I2C_NUMOF
1
(sizeof(i2c_config) / sizeof(i2c_config[0]))
const i2c_conf_t i2c_config()
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
= {
    {
        .dev      = &(SERCOM3->I2CM),
        .speed    = I2C_SPEED_FAST,
        .scl_pin  = GPIO_PIN(PA, 23),
        .sda_pin  = GPIO_PIN(PA, 22),
        .mux      = GPIO_MUX_C,
        .gclk_src = GCLK_CLKCTRL_GEN_GCLK0,
        .flags    = I2C_FLAG_NONE
    }
}
RTC_NUMOF
1
(1U)
RTC_DEV
1
RTC->MODE2
RTT_NUMOF
1
(1U)
RTT_DEV
1
RTC->MODE0
RTT_IRQ
1
RTC_IRQn
RTT_IRQ_PRIO
1
10
RTT_ISR
1
isr_rtc
RTT_MAX_VALUE
1
(0xffffffff)
RTT_FREQUENCY
1
(32768U)    /* in Hz. For changes see `rtt.c` */
RTT_RUNSTDBY
1
(1)         /* Keep RTT running in sleep states */