Hi, I want to use the Zero for battery operation. In the data sheet, I have read that you can turn off unused peripherals. How do I do that? For example, I found this code snippet in this forum:
//Disable ADC ADC->CTRLA.bit.ENABLE = 0; AC->CTRLA.bit.ENABLE = 0; //Disable USB USB->DEVICE.CTRLA.reg &= ~USB_CTRLA_ENABLE; PM->AHBMASK.reg &= ~PM_AHBMASK_USB; PM->APBBMASK.reg &= ~PM_APBBMASK_USB; PM->CPUSEL.reg = PM_CPUSEL_CPUDIV(32); //CPU Clock speed 1,5 MHz PM->APBCMASK.reg |= PM_APBCMASK_TCC1;
Where and how do I find this register? e. G. CTRLA.bit.ENABLE or PM_AHBMASK_USB. For my project I need I2C SPI and ext. interrupts. I am interested in a general approach so that I can implement other projects.
I also want to run the controller CPU at 1 MHz. I also read in this forum that the startup.c must be adjusted. Is that correct? Where can I find the register for e. G.:
// Constants for Clock generators #define GENERIC_CLOCK_GENERATOR_MAIN (0u) #define GENERIC_CLOCK_GENERATOR_XOSC32K (1u) #define GENERIC_CLOCK_GENERATOR_OSC32K (1u) #define GENERIC_CLOCK_GENERATOR_OSCULP32K (2u) /* Initialized at reset for WDT */ #define GENERIC_CLOCK_GENERATOR_OSC8M (3u) // Constants for Clock multiplexers #define GENERIC_CLOCK_MULTIPLEXER_DFLL48M (0u)
I do not understand how this is the assignment to the register in the datasheet. Best regards. Thanks for your help