MB9D560 Series Setting Clock System 32-Bit Microcontroller Spansion® TraveoTM Family APPLICATION NOTE Publication Number MB9D560_AN708-00008 CONFIDENTIAL Revision 1.0 Issue Date July 16, 2015 v1.1 A P P L I C A T I O N N O T E Products Products of what is described in this operation manual are as follows. Series MB9D560 2 CONFIDENTIAL Breed type rating (package suffix except) MB9DF564MAE/F565MAE/F566MAE MB9DF564MGE/F565MGE/F566MGE MB9D560_AN708-00008-1v0-E, July 16, 2015 v1.1 A P P L I C A T I O N N O T E Table of Contents 1. 2. 3. 4. 5. Introduction ..................................................................................................................................... 6 1.1 About this Document ........................................................................................................... 6 1.2 Environment of Development .............................................................................................. 6 Clock System.................................................................................................................................. 7 System Clock Change Operating ................................................................................................... 8 3.1 The Wait Cycle Count of TCFLASH .................................................................................... 9 3.1.1 Advance Preparation of Wait Cycle Configuration ............................................ 10 3.1.2 The Wait Cycle Count Calculation .................................................................... 12 3.2 System Clock Setting ........................................................................................................ 13 3.2.1 Source Clock Timer .......................................................................................... 13 3.2.2 Clock Supervisor .............................................................................................. 14 3.2.3 Clock Gear ....................................................................................................... 17 3.2.4 Clock Domain of RUN Mode ............................................................................ 18 3.2.5 RUN Profile Settings Update ............................................................................ 22 Reference ..................................................................................................................................... 23 Major Changes ............................................................................................................................. 24 July 16, 2015, MB9D560_AN708-00008-1v0-E CONFIDENTIAL 3 V1.1 A P P L I C A T I O N N O T E Figures Figure 2-1 Clock System Block Diagram .................................................................................................... 7 Figure 3-1 System Clock Change Procedure ............................................................................................. 8 Figure 3-2 TCFLASH Wait Cycle Count Change Procedure ...................................................................... 9 Figure 3-3 Configuration Example of TCFLASH Wait Cycle Count (CPU0) .............................................. 11 Figure 3-4 Configuration Example of TCFLASH Wait Cycle Count (CPU1) .............................................. 11 Figure 3-5 Clock Supervisor Setting Procedure ....................................................................................... 14 4 CONFIDENTIAL MB9D560_AN708-00008-1v0-E, July 16, 2015 v1.1 A P P L I C A T I O N N O T E Tables Table 1-1 Environment of Development ..................................................................................................... 6 Table 3-1 Example of Source Clock Timer Setting (PLL clock 200MHz when used) ................................ 13 Table 3-2 Clock Supervisor Setting Example (Main clock/PLL clock when used) ..................................... 15 Table 3-3 Clock Gear Setting Example..................................................................................................... 17 Table 3-4 Source Clock Oscillation Enabled Setting Example .................................................................. 18 Table 3-5 PLL Clock Divider Setting Example .......................................................................................... 18 Table 3-6 Clock Domain 0 Source Clock Setting Example ....................................................................... 19 Table 3-7 Example of Setting Internal Clock Oscillation Enable ............................................................... 20 Table 3-8 Maximum Operating Frequencies of Internal Operating Clock ................................................. 21 Table 3-9 Internal Clock Divider Setting Example..................................................................................... 21 July 16, 2015, MB9D560_AN708-00008-1v0-E CONFIDENTIAL 5 V1.1 A P P L I C A T I O N N O T E 1. Introduction 1.1 About this Document This application note is intended for persons who are considering the use of Traveo family MB9D560. It is necessary to use a specific procedure to set the clock system of MB9D560. This application note describes how to set up the clock system when it operated at maximum frequency (200MHz) to MB9D560. 1.2 Environment of Development Contents is described in this application note has been developed in the environment shown in Table 1-1. Table 1-1 Environment of Development 6 CONFIDENTIAL Microcomputer MB9DF566MGB Integrated Development Environments MULTI v6.1.4 Evaluation Board MB2198-770-02-E0 Optimization Optimize for Speed MB9D560_AN708-00008-1v0-E, July 16, 2015 v1.1 A P P L I C A T I O N N O T E 2. Clock System The clock system supplies the clocks for MCU operation. The external/built-in oscillating clocks of the MCU are generically called source clocks. A source clock is a clock used to generate an internal operating clock for MCU operation. The clock system generates the following source clocks. Fast-CR clock Slow-CR clock Main clock/Main clock divided by 2 PLL clock External/built-in oscillation circuits generate a Fast-CR clock, Slow-CR clock and Main clock. A Main clock divided by 2 is generated by the division of the main clock. And the main clock and the built-in PLL oscillation circuits generate a PLL clock. When using the main clock and PLL clock can monitor clock by clock supervisor. An area that uses internal operating clocks generated from the same source clock is called a clock domain. A clock domain contains 1 or more internal operating clocks. The clock system supplies clocks to the following clock domains. Clock domain 0 (system area) Clock domain 4 (external output clock area) The source clock used in each clock domain can be selected. In each clock domain, the selected source clock is divided, and the resulting clocks are distributed within the MCU as internal operating clocks. Figure 2-1 Clock System Block Diagram July 16, 2015, MB9D560_AN708-00008-1v0-E CONFIDENTIAL 7 V1.1 A P P L I C A T I O N N O T E 3. System Clock Change Operating This is the procedure to change the system clock of RUN mode in Figure 3-1. If it makes a change of system clock, it must be synchronized between the cores. See the application note of caution of 2CPU mode. Figure 3-1 System Clock Change Procedure [CPU0] [CPU1] START START Setting wait cycle count of TCFLASH Setting wait cycle count of TCFLASH TCFLASH wait cycle count of CPU1 setting completion? Yes Setting completion notification Wait cycle count setting completion notification of TCFLASH No Setting source clock timer Setting clock supervisor (Main clock, PLL clock) Setting clock gear Setting to clock domain in the RUN state RUN profile settings apply (RUN profile Update) Yes Reflection of RUN profile settings is complete? No Clock gear operation start Yes Clock gear operation is complete? No The notification of the completion for the clock setting to the other core Setting completion notification Clock setting of CPU0 was complete? Yes No END END : Operate at Fast-CR clock : Operate at PLL clock during the clock gear up operation : Operate at PLL clock set in RUN profile 8 CONFIDENTIAL MB9D560_AN708-00008-1v0-E, July 16, 2015 v1.1 A P P L I C A T I O N 3.1 N O T E The Wait Cycle Count of TCFLASH If the operating frequency of the system is higher than the maximum operating frequency of the flash memory (80MHz), it is necessary to insert wait cycles when accessing the flash memory. Wait cycles can be inserted by setting an appropriate value in FAWC [1:0] in the TCFCFGn_FCFGR register. The procedure is described in Figure 3-2. Two TCFLASH is equipped in this microcomputer, it is necessary to set wait cycle count of TCFLASH connected with each core. It is necessary to set wait cycle count before the change of system clock. Figure 3-2 TCFLASH Wait Cycle Count Change Procedure START TCFLASH configuration protection key register ← 0xCF61F1A5 Copy the wait cycle count setting process to RAM Flash wait control bit ← wait cycle count The wait cycle count setting process Reads the register of TCFLASH (Dummy read) END DMB instruction execution (Prefetch prevention) Release of write protection to the TCFLASH configuration register (TCFCFGn_FCFGR). Wait to be reflected after setting wait cycle count. Reads the register of TCFLASH (Dummy read) : Processing which is operated in the ROM : Processing which is operated in the RAM July 16, 2015, MB9D560_AN708-00008-1v0-E CONFIDENTIAL DMB instruction execution (Prefetch prevention) 9 V1.1 A P P L I C A T I O N 3.1.1 N O T E Advance Preparation of Wait Cycle Configuration Access to TCFLASH (Data readout or program execution) is prohibited during setting wait cycle count. Therefore, the wait cycle count setting process is necessary to operate in RAM. It is describes the procedure to operate wait cycle count setting process in RAM in the following. 1. 2. 3. 4. Prepare a section of wait cycle count setting process in ROM and RAM. Implement the wait cycle count setting process while specifying the sections (RAM) that was created in step 1. Implement the process of copying the data of the section (ROM) that was created in step 1 to section that you created in step 1 (RAM). Implement a process to run the copied wait cycle count setting process in section that you created in step 1 (RAM) after executing the processes that have been implemented in step 3. The example is described in Figure 3-3, Figure 3-4. 10 CONFIDENTIAL MB9D560_AN708-00008-1v0-E, July 16, 2015 v1.1 A P P L I C A T I O N N O T E Figure 3-3 Configuration Example of TCFLASH Wait Cycle Count (CPU0) [ CPU0 ] sample.ld MEMORY { tcmram_tcm tcflash_bsect_tcm tcflash_ssectb_tcm tcflash_ssecta_tcm eam tcflash_bsect_cpu0 tcflash_ssectb_cpu0 tcflash_ssecta_cpu0 : ORIGIN = 0x00000000, LENGTH = 0x020000 : ORIGIN = 0x00800000, LENGTH = 0x100000 : ORIGIN = 0x00FE0000, LENGTH = 0x010000 : ORIGIN = 0x00FF0000, LENGTH = 0x010000 : ORIGIN = 0x02800000, LENGTH = 0x001000 : ORIGIN = 0x05000000, LENGTH = 0x100000 : ORIGIN = 0x05FE0000, LENGTH = 0x010000 : ORIGIN = 0x05FF0000, LENGTH = 0x010000} sample.c Procedure 1 If another section is present in the same sector of the ROM, it must be define as the section of the end. #define TCFLASH_KEY_UNLOCK #define TCFLASH_WAIT #define MCU_SECT_START_ADDRESS(sect) #define MCU_SECT_END_ADDRESS(sect) #define MCU_FLASH_ADDRESS_AXI2TCM(addr) (0xCF61F1A5) (2) (uint32_t)&__ghsstart_##sect (uint32_t)&__ghsend_##sect (0x00800000 + (((uint32_t)(addr)) - 0x05000000)) extern void *__ghsstart_FLASHWAITSET; extern void *__ghsend_FLASHWAITSET; extern void *__ghsstart_ROM_FLASHWAITSET; extern void *__ghsend_ROM_FLASHWAITSET; void Start_PreInit(void); void CopyTcflashConfigureFunction(void); void ConfigureMemoriesTcflash(void); SECTIONS { .ROM.FLASHWAITSET ROM_NOCOPY(.FLASHWAITSET) ALIGN(32) .FLASHWAITSET ALIGN(32) : > tcflash_bsect_cpu0 : > tcmram_tcm __ghsstart_FLASHWAITSET = ADDR(.FLASHWAITSET); __ghsend_FLASHWAITSET = ENDADDR(.FLASHWAITSET); __ghsstart_ROM_FLASHWAITSET = ADDR(.ROM.FLASHWAITSET); __ghsend_ROM_FLASHWAITSET = ENDADDR(.ROM.FLASHWAITSET);} void Start_PreInit(void) { CopyTcflashConfigureFunction(); ConfigureMemoriesTcflash(); } Procedure 4 Procedure 3 void CopyTcflashConfigureFunction(void) { volatile uint32_t *pu32RamStart; volatile uint32_t *pu32RomEnd; volatile uint32_t *pu32RomAddr; Definition for refer to the address of each section from a .c file. pu32RamStart = (uint32_t*)MCU_SECT_START_ADDRESS(FLASHWAITSET); pu32RomEnd pu32RomAddr = (uint32_t*)MCU_FLASH_ADDRESS_AXI2TCM(MCU_SECT_END_ADDRESS(ROM_FLASHWAITSET)); = (uint32_t*)MCU_FLASH_ADDRESS_AXI2TCM(MCU_SECT_START_ADDRESS(ROM_FLASHWAITSET)); for ( ; pu32RomAddr < pu32RomEnd; pu32RomAddr++) { // Copy from ROM to RAM *pu32RamStart = *pu32RomAddr;pu32 RamStart++;} } Address that are defined in .ld file is the address for writing via AXI. So, it is converted to an address for reading via TCM. } #pragma ghs section text=".FLASHWAITSET" void ConfigureMemoriesTcflash(void) { uint32_t u32Dummy; Procedure 2 TCFCFG0_FCPROTKEY = TCFLASH_KEY_UNLOCK; TCFCFG0_FCFGR_FAWC = TCFLASH_WAIT; u32Dummy = TCFCFG0_FCFGR; __asm("DMB"); u32Dummy = TCFCFG0_FCFGR; __asm("DMB"); } #pragma ghs section text=default Figure 3-4 Configuration Example of TCFLASH Wait Cycle Count (CPU1) [ CPU1 ] sample.ld MEMORY { tcmram_tcm tcflash_bsect_tcm tcflash_ssectb_tcm tcflash_ssecta_tcm eam tcflash_bsect_cpu1 tcflash_ssectb_cpu1 tcflash_ssecta_cpu1 } : : : : : : : : ORIGIN = 0x00000000, LENGTH = 0x020000 ORIGIN = 0x00800000, LENGTH = 0x100000 ORIGIN = 0x00FE0000, LENGTH = 0x010000 ORIGIN = 0x00FF0000, LENGTH = 0x010000 ORIGIN = 0x02800000, LENGTH = 0x001000 ORIGIN = 0x07000000, LENGTH = 0x100000 ORIGIN = 0x07FE0000, LENGTH = 0x010000 ORIGIN = 0x07FF0000, LENGTH = 0x010000 SECTIONS { .ROM.FLASHWAITSET ROM_NOCOPY(.FLASHWAITSET) .FLASHWAITSET sample.c Procedure 1 If another section is present in the same sector of the ROM, it must be define as the section of the end. #define TCFLASH_KEY_UNLOCK #define TCFLASH_WAIT #define MCU_SECT_START_ADDRESS(sect) #define MCU_SECT_END_ADDRESS(sect) #define MCU_FLASH_ADDRESS_AXI2TCM(addr) (0xCF61F1A5) (2) (uint32_t)&__ghsstart_##sect (uint32_t)&__ghsend_##sect (0x00800000 + (((uint32_t)(addr)) - 0x07000000)) extern void *__ghsstart_FLASHWAITSET; extern void *__ghsend_FLASHWAITSET; extern void *__ghsstart_ROM_FLASHWAITSET; extern void *__ghsend_ROM_FLASHWAITSET; void Start_PreInit(void); void CopyTcflashConfigureFunction(void); void ConfigureMemoriesTcflash(void); ALIGN(32) : > tcflash_bsect_cpu1 ALIGN(32) : > tcmram_tcm void Start_PreInit(void) { CopyTcflashConfigureFunction(); Procedure 4 Procedure 3 __ghsstart_FLASHWAITSET = ADDR(.FLASHWAITSET); __ghsend_FLASHWAITSET = ENDADDR(.FLASHWAITSET); __ghsstart_ROM_FLASHWAITSET = ADDR(.ROM.FLASHWAITSET); __ghsend_ROM_FLASHWAITSET = ENDADDR(.ROM.FLASHWAITSET); } ConfigureMemoriesTcflash(); } void CopyTcflashConfigureFunction(void) { volatile uint32_t *pu32RamStart; volatile uint32_t *pu32RomEnd; volatile uint32_t *pu32RomAddr; pu32RamStart = (uint32_t*)MCU_SECT_START_ADDRESS(FLASHWAITSET); Definition for refer to the address of each section from a .c file. pu32RomEnd = (uint32_t*)MCU_FLASH_ADDRESS_AXI2TCM(MCU_SECT_END_ADDRESS(ROM_FLASHWAITSET)); pu32RomAddr = (uint32_t*)MCU_FLASH_ADDRESS_AXI2TCM(MCU_SECT_START_ADDRESS(ROM_FLASHWAITSET)); for ( ; pu32RomAddr < pu32RomEnd; pu32RomAddr++) { // Copy from ROM to RAM *pu32RamStart = *pu32RomAddr; pu32RamStart++; } Address that are defined in .ld file is the address for writing via AXI. So, it is converted to an address for reading via TCM. } #pragma ghs section text=".FLASHWAITSET" void ConfigureMemoriesTcflash(void) { uint32_t u32Dummy; Procedure 2 TCFCFG1_FCPROTKEY = TCFLASH_KEY_UNLOCK; TCFCFG1_FCFGR_FAWC = TCFLASH_WAIT; u32Dummy = TCFCFG1_FCFGR; __asm("DMB"); u32Dummy = TCFCFG1_FCFGR; __asm("DMB"); } #pragma ghs section text=default July 16, 2015, MB9D560_AN708-00008-1v0-E CONFIDENTIAL 11 V1.1 A P P L I C A T I O N 3.1.2 N O T E The Wait Cycle Count Calculation The wait cycle count is calculated from the following equation. (System operating frequency / Maximum operating frequency of TCFLASH) - 1 = Wait cycle count (*) * If the calculated result is a decimal, integer values are determined by rounding up the decimal part. Ex. ) System operating frequency: 200MHz, Maximum operating frequency of TCFLASH: 80MHz (System operating frequency / Maximum operating frequency of TCFLASH)- 1 = 200 / 80 - 1 =3-1 =2 12 CONFIDENTIAL MB9D560_AN708-00008-1v0-E, July 16, 2015 v1.1 A P P L I C A T I O N 3.2 N O T E System Clock Setting This microcontroller operates in the Fast-CR clock after power-on. It performs the setting mentioned in this chapter for changing frequency of the system clock. After that, it is necessary to reflect the setting to the RUN profile. After RUN profile settings, the frequency of the system clock change gradually over a number of steps that is set by operating the clock gear. All cores sets do not access the peripherals during the frequency change of the system clock. It may cause a malfunction. All registers that are described in this chapter is locked the writing. It is necessary to perform after unlock to write the unlock code (0x5CACCE55) to the protection key setting register (SYSC_PROTKEYR) when writing to the register. Every time unlock is required when performing the writing. 3.2.1 Source Clock Timer The source clock timer is for gating the clock output until the end of the clock oscillation stabilization wait time. In order to use the source clock timer, it is necessary to set Table 3-1 register. Example of this setting is described in Table 3-1 when changing the system clock to the PLL clock (200MHz) from the high-speed CR clock. Table 3-1 Example of Source Clock Timer Setting (PLL clock 200MHz when used) Register abbreviation Bit name PSCL SYSC_MOCTCPR SYSC_ MOCTTRGR *4 SYSC_PLLSTCNTR *1 clock timer. *1 CMPR Settings Select the division ratio of the input clock of the main *2 The compare value of the main clock timer. CGCPT PLLSTABS Change the timer settings / Start the timer counting. *5 PLL stabilization wait time selection. Value 0110(b) *3 1D4C(h) *3 1(b) 1111(b) Setting is reflected by writing a "1" to CGCPT of SYSC_MOCTTRGR. It is necessary to complete the setting before writing "1" to CGCPT of SYSC_MOCTTRGR. *2 It is prohibited to be changed during timer operation. *3 The main clock is the setting that assumes the 16MHz. *4 Bits which are not described are not required change. *5 Do not change setting after PLL clock oscillation is set to enable. July 16, 2015, MB9D560_AN708-00008-1v0-E CONFIDENTIAL 13 V1.1 A P P L I C A T I O N 3.2.2 N O T E Clock Supervisor If you use the clock supervisor, the clock supervisor can detect the stopped clocks and occurrences of frequency-range abnormalities. To detect the abnormal using the clocks of 2 systems are used: one clock becomes the monitoring target, and the other clock is a reference clock for measuring a certain time period. The clock supervisor is equipped with the following supervisors. Each of them is independent and can be separately set to enabled or disabled. Main clock supervisor PLL clock supervisor Sub-system PLL clock supervisor (Flex Ray/RDC PLL) This application note describes how to use main clock supervisor and PLL clock supervisor. It refers to the hardware manual when using sub-system PLL clock supervisor. Setting procedure is described in Figure 3-5 when using the Main clock supervisor and PLL clock supervisor. Clock supervisor start operating after the oscillation stabilization wait of clock to be monitored. Figure 3-5 Clock Supervisor Setting Procedure START User reset factor clear (Main Clock Supervisor) User reset factor clear (PLL Clock Supervisor) Since user reset factor register is not cleared by a reset other than power-on reset, there is a need to clear before clock supervisor use. If the clock that flag is set is set to clock domain, it becomes profile error. Setting main clock supervisor upper-limit threshold and The lower-limit threshold Setting main clock supervisor reference period and the judgment selection Setting PLL clock supervisor upper-limit threshold and the lower-limit threshold Setting PLL clock supervisor reference period Setting clock supervisor enable (Main clock, PLL clock) ≈ Profile settings apply (Profile Update) END 14 CONFIDENTIAL MB9D560_AN708-00008-1v0-E, July 16, 2015 v1.1 A P P L I C A T I O N 3.2.2.1 N O T E Clock Supervisor Setting Example In order to use clock supervisor, it is necessary to set the register of Table 3-2. The example is described in Table 3-2 when using clock supervisor under the following conditions. It is not include setting at the time of PSS state in Table 3-2. The reference clock of the main clock supervisor at the time of PSS is possible to select the Slow-CR clock. Method of using Slow-CR clock as a reference clock refers to the hardware manual. Clock supervisor to be used:Main clock supervisor, PLL clock supervisor Main clock supervisor use conditions − Main clock frequency:16MHz − Fast-CR clock frequency:6~10MHz (typ:8MHz) − Acceptable main clock frequency range:4~20MHz − Reference clock count period:60 PLL clock supervisor use conditions − PLL clock frequency:200MHz − Main clock frequency:8MHz − Acceptable PLL clock frequency range:80~500MHz − Reference clock count period:12 Table 3-2 Clock Supervisor Setting Example (Main clock/PLL clock when used) Register abbreviation SYSC_ CSVMOCFGR00 *1、*2 SYSC_ CSVMOCFGR01 *1 Bit name UPTHR LOWTHR JDGSEL REFCLKWND SYSC_ CSVPLLCFGR0 *2、*5 SYSC_ CSVPLLCFGR1 *5 UPTHR LOWTHR REFCLKWND Settings Frequency range upper-limit threshold value of Main clock (Reference clock:Fast-CR clock) Frequency range lower-limit threshold value of Main clock (Reference clock:Fast-CR clock) Value (decimal) 200 *3 24 *3 0 *4 Selection of Operation at abnormal state detection of Main clock (Reference clock:Fast-CR clock) Reference clock count period of Main clock supervisor 60 (Reference clock:Fast-CR clock) Frequency range upper-limit threshold value of PLL clock (Reference clock:Main clock) Frequency range lower-limit threshold value of PLL clock (Reference clock:Main clock) 375 *3 60 *3 Reference clock count period of PLL clock supervisor (Reference clock:Main clock) 12 PLLCSVE Enable the PLL clock supervisor 1 MOCSVE Enable the main clock supervisor 1 SYSC_RUNCSVCFGR *1 This register must not be modified during operation of the main clock supervisor. *2 Set the upper-limit threshold value bit value to be greater than the lower-limit threshold value bit value. *3 Calculation method of the threshold value refer to “3.2.2.2Calculation of the Clock Supervisor Threshold Value”. *4 At the abnormal state detection, it generates a reset if the main clock is selected as clock domain 0 or the software watchdog timer. If this is not the case an interrupt is generated. *5 This register must not be modified during operation of the PLL clock supervisor. July 16, 2015, MB9D560_AN708-00008-1v0-E CONFIDENTIAL 15 V1.1 A P P L I C A T I O N 3.2.2.2 N O T E Calculation of the Clock Supervisor Threshold Value Threshold value to be set in the clock supervisor is calculated from the following equation. Acceptable the maximum value of monitoring target clock frequency / Minimum value of Reference clock frequency x Reference clock count period = Upper-limit threshold value Acceptable the minimum value of monitoring target clock frequency / Maximum value of Reference clock frequency x Reference clock count period = Lower-limit threshold value If it was used in the conditions in the “3.2.2.1Clock Supervisor Setting Example”, the setting is following. Upper-limit threshold value of main clock supervisor Acceptable the maximum value of main clock frequency / Minimum value of Fast-CR clock frequency x Reference clock count period = 20 / 6 x 60 = 200 Lower-limit threshold value of main clock supervisor Acceptable the minimum value of main clock frequency / Maximum value of Fast-CR clock frequency x Reference clock count period = 4 / 10 x 60 = 24 Upper-limit threshold value of PLL clock supervisor Acceptable the maximum value of PLL clock frequency /Minimum value of Main clock frequency x Reference clock count period = 500 / 16 x 12 = 375 Lower-limit threshold value of PLL clock supervisor Acceptable the minimum value of PLL clock frequency / Maximum value of Main clock frequency x Reference clock count period = 80 / 16 x 12 = 60 3.2.2.3 Notes of Clock Supervisor Profile settings are used to enable/disable the clock supervisor. Writing to the clock supervisor configuration register alone setting is not reflected. So it must be RUN update. If clock supervisor want stopped, it is necessary to stop the oscillation of the monitoring clock. There is a profile error, if the clock supervisor reset detection bit of the user reset factor register (SYSC_RSTCAUSEUR) is already set is selected as the clock monitor domain. User reset factor register (SYSC_RSTCAUSEUR) is not cleared except during power-on reset. It must clear the clock supervisor reset detection bit before starting clock supervisor operation. After a reset generated by the detection of a clock abnormality, the main clock supervisor reference clock returns to the fast-CR clock. 16 CONFIDENTIAL MB9D560_AN708-00008-1v0-E, July 16, 2015 v1.1 A P P L I C A T I O N 3.2.3 N O T E Clock Gear The frequency of the clock gear can be gradually changed by step-by-step output of the input clock to the clock gear circuit. The frequency fluctuates abruptly at the time of switching from the main clock to the PLL clock, so the power supply current also fluctuates considerably. A clock gear operation is necessary to prevent any possible occurrence of overshoot/undershoot of the power supply current at the clock switching time. In order to use the clock gear, it is necessary to set the register of Table 3-3. The example is described in Table 3-1 when using clock gear under the following conditions. Main clock frequency:16MHz PLL clock frequency:200MHz Loop count:256times Step width:1 Start step:0 Table 3-3 Clock Gear Setting Example Register abbreviation Bit name PLLCGLP SYSC_PLLCGCNTR Settings *1 Value Loop count per one step of PLL clock gear operation FF(h) 00(b) PLLCGSTP *1 Step width at the PLL clock gear-up/down PLLCGSSN *1 Step at the start of PLL clock gear operation 000000(b) Start gear operation 01(b) *2 PLLCGSTR PLLCGEN *1 Clock gear operation enabled *1 Do not change setting after PLL clock oscillation is set to enable. *2 It is necessary to set at the timing of operating the clock gear after application of the profile settings. 3.2.3.1 1(b) Procedure of Clock Gear Operation Start Clock gear starts the operation by performing the following steps after setting in Table 3-3 (Except PLLCGSTR). It is necessary to wait until the clock gear is completed after clock gear operation start. 1. 2. 3. 3.2.3.2 Select the PLL clock as the domain clock. Set "01" to PLLCGSTR of PLL clock gear control register (SYSC_PLLCGCNTR). Poll the value of the clock gear status flag (PLLCGCNTR.PLLCGSTS), and wait until the clock indicates the stop state. Notes of Clock Gear Setting of the clock gear control register (SYSC_PLLCGCNTR) must satisfy the condition of the “3.2.4.3Source Clock for the Clock Domain 0”. The smaller step width and the larger loops count, the more gradually the frequency changes. When clock gear operation is enabled, after the oscillation stabilization wait time of the clock gear input clock, the clock according to the setting of PLLCGSSN is output. But it does not gear up/gear-down until the clock gear operation start setting is performed. July 16, 2015, MB9D560_AN708-00008-1v0-E CONFIDENTIAL 17 V1.1 A P P L I C A T I O N 3.2.4 N O T E Clock Domain of RUN Mode 3.2.4.1 Enable Setting of the Source Clock A hardware reset results in the source clocks from the external/built-in oscillation circuits (fast-CR circuit clock, slow-CR clock and main clock/main clock divided by 2) entering the oscillation-enabled state. Conversely, the PLL clock enters the oscillation-disabled state. It is necessary to enable the oscillation of the PLL clock when changing the source clock of the system clock to the PLL clock (200MHz). To enable PLL oscillation, the oscillation for the main clock must already be enabled. If the oscillation for the main clock has not been enabled, a profile error occurs. It can be set to enable the oscillation of the corresponding clock during RUN by writing "1" to the bits of register shown in the Table 3-4. However, control for enabling/disabling the source clock oscillation is available only when the system is not using the source clock. The fast-CR clock/slow-CR clock oscillation cannot be disabled in RUN. The example is described in Table 3-4 when changing the source clock of the system clock to the PLL clock (200MHz). Table 3-4 Source Clock Oscillation Enabled Setting Example Register abbreviation Bit name Value (decimal) Settings PLLEN Enable PLL clock oscillation 1 MOSCEN Enable Main clock oscillation 1 SCROSCEN Enable Slow-CR clock oscillation 1 CROSCEN Enable Fast-CR clock oscillation 1 SYSC_RUNCKSRER 3.2.4.2 PLL Clock Divider The PLL clock is generated from the main clock. The example is described in Table 3-5 when generating a PLL clock 200MHz from the main clock 16MHz under the following conditions. N-multiplier : Multiply by 25 M-divider : Divided by 2 Input clock divider : No division Table 3-5 PLL Clock Divider Setting Example Register abbreviation SYSC_RUNPLLCNTR 18 CONFIDENTIAL Bit name Settings Value (decimal) PLLDIVN PLL clock N-multiplier setting 24 PLLDIVM PLL clock M-divider setting 1 PLLDIVL PLL input clock divider setting 0 MB9D560_AN708-00008-1v0-E, July 16, 2015 v1.1 A P P L I C A T I O N 3.2.4.3 N O T E Source Clock for the Clock Domain 0 Hardware reset results in the fast-CR clock being selected as the clock used in all clock domains. It is necessary to set the PLL clock to the source clock of clock domain 0 when changing the source clock of the system clock to the PLL clock (200MHz). Source clock of the system clock become the PLL clock by setting the source clock of clock domain 0 to PLL clock. Source clock of clock domain 0 during RUN state can be selected by setting the register of Table 3-6. The example is described in Table 3-6 when setting the source clock of clock domain 0 to PLL clock. When switching to PLL clock, be sure to use clock gear. Switch with 50MHz or less and activate gear-up operation. Table 3-6 Clock Domain 0 Source Clock Setting Example Register abbreviation SYSC_ RUNCKSELR0 July 16, 2015, MB9D560_AN708-00008-1v0-E CONFIDENTIAL Bit name CD0CSL Settings Clock domain 0 source clock selection Value (decimal) 4 19 V1.1 A P P L I C A T I O N 3.2.4.4 N O T E Internal Clock Oscillation Enable Setting internal clock oscillation enable during RUN state can be changed by setting the register of Table 3-7. However, there are restrictions on the following clock. SYSCPD1 internal operation clock: Oscillation disable cannot set. HPMPD2 internal operation clock: Oscillation disable cannot set. CPU1 internal operation clock: Oscillation disable cannot set. CPU0 internal operation clock: Oscillation disable cannot set. EXTBUS internal operation clock : Set this bit to "0" due to this microcomputer has no external bus I/F.(*) * Setting of EXTBUS internal operation clock become enabling by default. It is necessary to set the oscillation disable. The setting example is described in Table 3-7 when enabling other than EXTBUS internal operation clock. Table 3-7 Example of Setting Internal Clock Oscillation Enable Bit name Register abbreviation SYSC_RUNCKER 20 CONFIDENTIAL Settings Value (decimal) ENCLKPERI7 PERI7 internal operation clock oscillation enable 1 ENCLKPERI6 PERI6 internal operation clock oscillation enable 1 ENCLKPERI5 PERI5 internal operation clock oscillation enable 1 ENCLKPERI4 PERI4 internal operation clock oscillation enable 1 ENCLKPERI1 PERI1 internal operation clock oscillation enable 1 ENCLKPERI0 PERI0 internal operation clock oscillation enable 1 ENCLKSYSCPD1 SYSCPD1 internal operation clock oscillation enable 1 *1 ENCLKEXTBUS EXTBUS internal operation clock oscillation enable 0 *2 ENCLKMEMC MEMC internal operation clock oscillation enable ENCLKDMA DMA internal operation clock oscillation enable ENCLKHPMPD2 HPMPD2 internal operation clock oscillation enable ENCLKATB ATB internal operation clock oscillation enable 1 ENCLKDBG DBG internal operation clock oscillation enable 1 ENCLKCPU1 CPU1 internal operation clock oscillation enable 1 *1 ENCLKCPU0 CPU0 internal operation clock oscillation enable 1 *1 *1 "0" writing is invalid. *2 Since the initial value "1" is set, changing always "0". 1 1 1 *1 MB9D560_AN708-00008-1v0-E, July 16, 2015 v1.1 A P P L I C A T I O N 3.2.4.5 N O T E Internal Clock Divider Division ratio of the source clock of each internal operation clock during RUN state can be changed by setting the registers of Table 3-9. However, it is necessary to set the division ratio so that the supplied clock does not exceed the maximum operating frequency of any internal operating clock. The maximum operating frequency is described in Table 3-8. Table 3-8 Maximum Operating Frequencies of Internal Operating Clock Internal Operating Clock Maximum Operating Frequency CLK_HPMPD2 200MHz CLK_DMA 200MHz CLK_MEMC 200MHz TRC clock 100MHz CLK_ATB 100MHz DBG clock 50MHz System clock 200MHz SYSC_PD1 clock 100MHz EXTBUS clock 200MHz PERI7 clock 50MHz PERI6 clock 50MHz PERI5 clock 100MHz PERI4 clock 100MHz PERI1 clock 50MHz PERI0 clock 100MHz The setting example is described in Table 3-9 when operating at the maximum operating frequency. Source clock of the system clock is the PLL clock (200MHz). Table 3-9 Internal Clock Divider Setting Example Bit name Register abbreviation HPMDIV RUNCKDIVR0 Settings Value (decimal) Division ratio of the HPM clock, DMA clock and MEMC 0 clock from the system clock TRCDIV Division ratio of the TRC clock from the system clock 1 ATBDIV Division ratio of the ATB clock from the system clock 1 *1 DBGDIV Division ratio of the DBG clock from the ATB clock 1 *1 SYSDIV Division ratio of the system clock from the source clock 0 SYSCPD1DIV Division ratio of the SYSC_PD1 clock from the HPM clock 1 EXTBUSDIV Division ratio of the EXTBUS clock from the HPM clock PERI7DIV Division ratio of the PERI7 clock from the PERI5 clock 1 PERI6DIV Division ratio of the PERI6 clock from the PERI4 clock 1 PERI5DIV Division ratio of the PERI5 clock from the HPM clock 1 PERI4DIV Division ratio of the PERI4 clock from the HPM clock 1 PERI1DIV Division ratio of the PERI1 clock from the PERI0 clock 1 PERI0DIV Division ratio of the PERI0 clock from the HPM clock 1 RUNCKDIVR1 RUNCKDIVR2 *1 Write invalid *2 It is not affect to change the settings because this microcontroller not equipped EXTBUS. July 16, 2015, MB9D560_AN708-00008-1v0-E CONFIDENTIAL 1 *2 21 V1.1 A P P L I C A T I O N 3.2.5 N O T E RUN Profile Settings Update Setting is not reflected in the writing to the register when changing the settings of RUN / PSS profile setting parameters (*). It is necessary to do the following steps to reflect the setting of RUN profile. *See Hardware Manual. 1. 2. 3. 4. Write the settings to the register change the setting. Clear the RUN profile (main status control) update completion flag at system status flag and interrupt clear register (SYSC_SYSICLR). Write "0xAB" to the RUN profile update trigger register of the system controller (SYSC_TRGRUNCNTR). Poll the RUN profile update completion flag bit of System Status Register, and to wait until the profile update completed (RUNDF0 becomes "1"). If the contents of the new RUN profile do not present any problems, the control circuit will reflect the contents of the profile, as follows. 1. 2. 3. "1" is set in the system status register (SYSC_SYSSTSR: RUNSTS0). The contents of the RUN profile are copied to the APPLIED profile. Reflect the following setting in order − − − − − 4. 5. Clock oscillation enable/stop (including waiting for oscillation stabilization) Clock supervisor setting changes LVD setting changes Clock operation settings (source clock changes, division, and ON/OFF of each clock source) Clock stop settings (source clock stop) When RUN profile update is completed, the system status register (SYSC_SYSSTSR: RUNSTS0) is cleared to "0". "1" is set in the system status register (SYSC_SYSSTSR: RUNDF0). If present setting is problems, Profile error occurs, system error interrupt factor register 1 (SYSC_SYSERRIR1: RUNERRIF0) is set. The contents of the new profile are discarded, and the circuit operates with the contents of the profile currently in use. See the hardware manual, about the profile error. 3.2.5.1 Notes of RUN Profile Settings Profile Update is prohibited during the profile update. If the profile update again while profile is being updated, a system error interrupt (SYSC_SYSERRIR1: RUNTRGERRIF) will be generated, and the attempted update profile will be disabled. Before updating the RUN profile, it is necessary to confirm the flag of the profile status register (SYSC_SYSPROSTSR:RUNPSTS) is already cleared. When it is updated the RUN profile during a profile error status, an NMI interrupt will be generated, and the RUN profile settings will be discarded. During RUN profile update, it is prohibited to write access to RUN profile register group. A write access is made to the RUN profile register group during a RUN profile update. The write data will be disabled. 22 CONFIDENTIAL MB9D560_AN708-00008-1v0-E, July 16, 2015 v1.1 A P P L I C A T I O N 4. N O T E Reference [1]. 32-BIT MICROCONTROLLER Spansion Traveo Family MB9D560 HARDWARE MANUAL [2]. MB9D560 Series Application Notes (Dual CPU Operation) July 16, 2015, MB9D560_AN708-00008-1v0-E CONFIDENTIAL 23 V1.1 A P P L I C A T I O N N O T E 5. Major Changes Page Section - - Change Results Revision 1.0 24 CONFIDENTIAL Initial release MB9D560_AN708-00008-1v0-E, July 16, 2015 v1.1 A P P L I C A T I O N N O T E Colophon The products described in this document are designed, developed and manufactured as contemplated for general use, including without limitation, ordinary industrial use, general office use, personal use, and household use, but are not designed, developed and manufactured as contemplated (1) for any use that includes fatal risks or dangers that, unless extremely high safety is secured, could have a serious effect to the public, and could lead directly to death, personal injury, severe physical damage or other loss (i.e., nuclear reaction control in nuclear facility, aircraft flight control, air traffic control, mass transport control, medical life support system, missile launch control in weapon system), or (2) for any use where chance of failure is intolerable (i.e., submersible repeater and artificial satellite). Please note that Cypress will not be liable to you and/or any third party for any claims or damages arising in connection with above-mentioned uses of the products. Any semiconductor devices have an inherent chance of failure. You must protect against injury, damage or loss from such failures by incorporating safety design measures into your facility and equipment such as redundancy, fire protection, and prevention of over-current levels and other abnormal operating conditions. If any products described in this document represent goods or technologies subject to certain restrictions on export under the Foreign Exchange and Foreign Trade Law of Japan, the US Export Administration Regulations or the applicable laws of any other country, the prior authorization by the respective government entity will be required for export of those products. Trademarks and Notice The contents of this document are subject to change without notice. This document may contain information on a Cypress product under development by Cypress. Cypress reserves the right to change or discontinue work on any product without notice. The information in this document is provided as is without warranty or guarantee of any kind as to its accuracy, completeness, operability, fitness for particular purpose, merchantability, non-infringement of third-party rights, or any other warranty, express, implied, or statutory. Cypress assumes no liability for any damages of any kind arising out of the use of the information in this document. Copyright © 2015 Cypress Semiconductor Corp. All rights reserved. Cypress, Cypress logo, Spansion®, the Spansion logo, ® ® TM TM TM TM MirrorBit , MirrorBit Eclipse , ORNAND , Easy DesignSim , Traveo and combinations thereof, are trademarks and registered trademarks of Cypress Semiconductor Corp. in the United States and other countries. Other names used are for informational purposes only and may be trademarks of their respective owners. July 16, 2015, MB9D560_AN708-00008-1v0-E CONFIDENTIAL 25 V1.1