190 likes | 426 Views
Programming Microcontroller RTC – Real Time Clock Autumn term 2007. 64K or 96K Byte SRAM. Enet MAC. ARM966E. CORE. w/DSP. USB 2.0FS. 96 MHz. 256K or 512K Byte Burst Flash. PFQ BC. CAN 2.0B. DMA. INTR Cntl. CLK Cntl. 32K Byte Burst Flash. GPIO. OTP Mem. LVD BOD.
E N D
Programming Microcontroller RTC – Real Time Clock Autumn term 2007 64K or 96K Byte SRAM Enet MAC ARM966E CORE w/DSP USB 2.0FS 96 MHz 256K or 512K Byte Burst Flash PFQ BC CAN 2.0B DMA INTR Cntl CLK Cntl 32K Byte Burst Flash GPIO OTP Mem LVD BOD EXT. Bus JTAG ETM9 PLL RTC TIM ADC SPI I2C UART RTC - Real Time Clock STR912FW44
Self-isolation Mode RTC continues to operate After power down Supply voltage drops out Automatically switches to alternate voltage source connected to VBATT pin (e.g.battery) Isolated 32KHz osc. continues to operate Tamper Detect (Manipulation) RTC time recorded SRAM standby voltage source cut off to invalidate SRAM contents Millisecond counter, wake-up function RTC Specifics RTC - Real Time Clock
RTC structure RTC - Real Time Clock
RTC Block diagram (simplified) RTC - Real Time Clock Ref manual figure 26
RTC Register MAP RTC - Real Time Clock ? On which memory address can you see the seconds counting up?
RTC time registerRTC_TR RTC - Real Time Clock
RTC date registerRTC_DTR RTC - Real Time Clock
RTC Alarm time registerRTC_ATR RTC - Real Time Clock
RTC Milliseconds RegisterRTC_MILR RTC - Real Time Clock
RTC Control RegisterRTC_CR RTC - Real Time Clock
RTC Status RegisterRTC_SR RTC - Real Time Clock
RTC debug support in IDE RTC - Real Time Clock [Peripherals-I/O Ports] RTC support so far: => There might be loss of JTAG connection when using the millisecond timer
Take RTC out of reset and enable PCLK clock Set bits in SCU_PCGR1 and SCU_PRR1 registers Set W bit in RTC Control register Set the current Millisecond in Millisec Register Set the current second, minute, hour and date in Time Register Set Alarm Register if Alarm Interrupt is needed Clear W bit in Control Register, RTC starts running RTC Configuration Flow RTC - Real Time Clock
Peripheral Bridge 1 configuration"slow" peripherals RTC - Real Time Clock RTC enabled After Reset: ports disabled PCG1: Peripheral Clocking Gate Register 1: PRR1: Peripheral Reset Register 1:
Watchdog (WDG) RTC - Real Time Clock What is a watch dog in a microcontroller? A device that supervises correct functioning of the controller What can watch dog do? Just bark and say: "We ar not ok" or reset the controller
Watch Dog Timer RTC - Real Time Clock • Watch Dog Timer Features • 16-bit down Counter • 8-bit clock Prescaler • Two clock sources : PCLK or RTC clock • Watch Dog or Free-running Timer mode • Key Register to protect Timer from un-intended counter loading
Watch Dog Mode Once enabled, this mode cannot be cleared by software Generates Reset when the 16 bit down counter reaches 0 count Prevent WDG_reset by writing twice (A55A, 5AA5) to the Key Register. Counter is re-loaded after the write WDG Free running Timer Mode User can pre-load counter and control the counting start Can read counter values from Counter Register Generate interrupt when down counter reaches end of count Interrupt can be disabled, end of count flag is set in Status Register Watch Dog Timer Modes RTC - Real Time Clock