ARM中的时钟

来源:互联网 发布:php接口的用途 编辑:程序博客网 时间:2024/06/10 16:40

The Clock control logic in S3C2410A can generate the required clock signals including FCLK for CPU, HCLK for the AHB bus peripherals, and PCLK for the APB bus peripherals. The S3C2410A has two Phase Locked Loops (PLLs): one(MPLL) for FCLK, HCLK, and PCLK, and the other(UPLL) dedicated for USB block (48Mhz).

  1. PLL(锁相环)
    为了降低电磁干扰和降低板间布线要求,芯片外接的晶振频率通常很低(通常8MHz或12MHz等),通过时钟控制逻辑的PLL提高系统使时钟。锁相环起到的是倍频的作用,锁相环的使用有锁定和连接的过程。
    以S3C2410为例,其内部有两个锁相环: MPLL、UPLL,分别为MCU和USB控制器产生时钟信号,其中MPLL未连接之前MCU直接使用震荡源作时钟信号,连接后则改用MPLL倍频后的震荡源作时钟信号;而UPLL因为是为USB设备提供时钟信号,所以规定必须是48MHz或96MHz。
  2. 分频器
    S3C2410有四种时钟信号(从UPLL分出来的UCLK,从MPLL分出来的FCLK/HCLK/PCLK)。UCLK(比为48MHz)是供给USB的,FCLK是供给arm920t的,HCLK供给AHB,PCLK供给APB。
    FCLK 与MPLL的频率一样。我们所说的S3C2410的CPU主频为200MHz,就是指的这个时钟信号,相应的,1/FCLK即为CPU时钟周期。
    HCLK 可以设置为FCLK或FCLK/2 ,即通过设置相应的寄存器CLKDIVN中的对应位HDIVN即可,其中HDIVN为0时对应FCLK,为1时对应FCLK/2
    PCLK可以设置为HCLK或HCLK/2 ,即通过设置相应得寄存器CLKDIVN中的对应位PDIVN即可,其中PDIVN为0时对应HCLK,为1时对应HCLK/2
  3. AHB/APB
    AHB:advanced high-performance bus;
    APB: advanced peripherals bus。
    AHB总线连接高速外设,低速外设则通过APB总线互连。显然,对不同总线上的外设,应该使用不同的时钟信号,AHB总线对应HCLK,APB总线对应PCLK。弄清楚每条总线对应的外设,在设置好时钟信号后,对应外设的初始化的值依此而确定。
    HCLK is used for AHB bus, which is used by the ARM920T, the memory controller, the interrupt controller, the LCD controller, the DMA and USB host block.
    PCLK is used for APB bus, which is used by the peripherals such as WDT, IIS, I2C, PWM timer, MMC interface, ADC, UART, GPIO, RTC and SPI.
  4. Fin
    指CPU外围接的晶振本身的频率,通常为12MHz。由用户手册中的一段话:
    Although the MPLL starts just after a reset, the MPLL output (Mpll) is not used as the system clock until the software writes valid settings to the MPLLCON register. Before this valid setting, the clock from external crystal or EXTCLK source will be used as the system clock directly. Even if the user does not want to change the default value of MPLLCON register, the user should write the same value into MPLLCON register.
    可以看到,复位后,MPLL虽然默认启动,但是如果不向MPLLCON中写入value,那么外部晶振将直接作为系统时钟。
    即使不想改变MPLLCON寄存器的值,也要重新赋值一下。
0 0
原创粉丝点击