/** * \brief Initialize SAM4E_XPRO board for low power test. */ void init_specific_board(void) { /* Disable all Extra functions in matrix except for SWD CLK/IO */ matrix_set_system_io(0x00001C30); /* Configure all PIOs as inputs to save power */ pio_set_input(PIOA, 0xFFFFFFFF, PIO_PULLUP); pio_set_input(PIOB, 0xFFFFFFFF, PIO_PULLUP); pio_set_input(PIOC, 0xFFFFFFFF, PIO_PULLUP); pio_set_input(PIOD, 0xFFFFFFFF, PIO_PULLUP); pio_set_input(PIOE, 0xFFFFFFFF, PIO_PULLUP); /* Disable USB Clock */ pmc_disable_udpck(); /* Disable pull-up on PHY */ pio_pull_up(PIOD, PIO_PD0 | PIO_PD4 | PIO_PD5 | PIO_PD6 | PIO_PD7, 0); /* Hold PHY in reset to avoid the clock output switching */ pio_set_output(PIOD, PIO_PD31, 0, 0, 0); /* Disable pull-up on VBUS */ pio_pull_up(PIOE, PIO_PE2, 0); /* Disable PIO pull-up for PB10(USB_DDM), PB11(USB_DDP) */ pio_pull_up(PIOB, PIO_PB10 | PIO_PB11, 0); /* Enable the PMC clocks of push button for wakeup */ pmc_enable_periph_clk(ID_PIOE); pio_handler_set_priority(PIOE, PIOE_IRQn, IRQ_PRIOR_PIO); }
WEAK void platform_init_system_clocks( void ) { sysclk_init(); /* Switch Slow Clock source to external 32K crystal */ pmc_switch_sclk_to_32kxtal( 0 ); while( pmc_osc_is_ready_32kxtal( ) == 0 ) { } pmc_disable_udpck( ); }
/** * \brief Initialize SAM4E_EK board for low power test. */ void init_specific_board(void) { /* Configure all PIOs as inputs to save power */ pio_set_input(PIOA, 0xFFFFFFFF, PIO_PULLUP); pio_set_input(PIOB, 0xFFFFFFFF, PIO_PULLUP); pio_set_input(PIOC, 0xFFFFFFFF, PIO_PULLUP); /* Disable USB Clock */ pmc_disable_udpck(); /* Disable PIO pull-up for PB10(USB_DDM), PB11(USB_DDP) */ pio_pull_up(PIOB, (0x3 << 10), 0); /* Disable PIO pull-up for PC21(USB_CNX) */ pio_pull_up(PIOC, (0x1 << 21), 0); /* Enable the PMC clocks of push button for wakeup */ pmc_enable_periph_clk(ID_PIOA); pio_handler_set_priority(PIOA, PIOA_IRQn, IRQ_PRIOR_PIO); }
/** * \brief Initialize SAM3N_EK board for low power test. */ void init_specific_board(void) { /* Configure all PIOs as inputs to save power */ pio_set_input(PIOA, 0xFFFFFFFF, PIO_PULLUP); pio_set_input(PIOB, 0x0FFFFFFF, PIO_PULLUP); /* Exclude JTAG pins */ pio_set_input(PIOC, 0xFFFFFFFF, PIO_PULLUP); pio_set_input(PIOD, 0x7FFFFFFF, PIO_PULLUP); pio_set_input(PIOE, 0xFFFFFFFF, PIO_PULLUP); pio_set_input(PIOF, 0x3F, PIO_PULLUP); /* Disable USB Clock */ pmc_disable_udpck(); pmc_disable_upll_clock(); /* Disable PIO pull-up for PB4, PB5, PB6, PB7 */ pio_pull_up(PIOB, (0xF << 4), 0); /* Initialize ADC pin as ADC input mode to save power */ adc_enable_channel(ADC, ADC_CHANNEL_1); /* Enable the PMC clocks of push button for wakeup */ pmc_enable_periph_clk(ID_PIOB); pio_handler_set_priority(PIOB, PIOB_IRQn, IRQ_PRIOR_PIO); }
/** * \brief Disable full speed USB clock. * * \note This implementation does not switch off the PLL, it just turns off the USB clock. */ void sysclk_disable_usb(void) { pmc_disable_udpck(); }