This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C129系统时钟频率问题



TM4C129能否像TM4C123一样 使用 SysCtlClockGet() 获取时钟频率,TM4C129使用哪一个函数获取系统主频?

  • TM4C129x和TM4C123x的时钟系统有所不同。

    TM4C129x的时钟频率配置使用函数MAP_SysCtlClockFreqSet来实现,这个函数的返回值就是当前的时钟频率。例如:

    g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000);

    这个函数就是配置主频为120MHz,返回值g_ui32SysClock为获取到的真实时钟频率。

  • 补充一下

    SysCtlClockGet() 函数只能用于TM4C123X系列的芯片。

  • 初学tivaware,这些系统函数之类的有没有技术手册,在TI官网上没有找到介绍这些函数的,例程的函数库里也没有找到,不知道能不能帮下忙

  • TivaWare安装目录下的doc文件夹中有详细的文档。

    针对外设驱动库,文档是SW-TM4C-DRL-UG-***.pdf *为版本号

  • 恩恩,谢谢啦,下午找到了,不过我在程序库函数里找没找到,我再研究研究

  • 你好,最近在学习TM4C1294_LAUNCHPAD,刚好在调一个超声波模块的时候想要调用SysCtlClockGet()这个函数,然而却一直有错,debug仿真返回值是0X00001098;后来看到库文件里写的TM4C13  ONLY.想请问一下如果我想要调用这个函数1294有替代的吗?

  • SysCtlClockFreqSet()用这个函数

  • SysCtlClockFreqSet
    Configures the system clock.
    Prototype:
    uint32_t
    SysCtlClockFreqSet(uint32_t ui32Config,
    uint32_t ui32SysClock)
    Parameters:
    ui32Config is the required configuration of the device clocking.
    ui32SysClock is the requested processor frequency.
    Description:
    This function configures the main system clocking for the device. The input frequency, oscillator
    source, whether or not to enable the PLL, and the system clock divider are all configured with
    this function. This function configures the system frequency to the closest available divisor of
    one of the fixed PLL VCO settings provided in the ui32Config parameter. The caller sets the
    ui32SysClock parameter to request the system clock frequency, and this function then attempts
    to match this using the values provided in the ui32Config parameter. If this function cannot
    exactly match the requested frequency, it picks the closest frequency that is lower than the
    requested frequency. The ui32Config parameter provides the remaining configuration options
    using a set of defines that are a logical OR of several different values, many of which are
    grouped into sets where only one of the set can be chosen. This function returns the current
    system frequency which may not match the requested frequency.
    The oscillator source is chosen with one of the following values:
    SYSCTL_OSC_MAIN to use an external crystal or oscillator.
    SYSCTL_OSC_INT to use the 16-MHz precision internal oscillator.
    SYSCTL_OSC_INT30 to use the internal low frequency oscillator.
    SYSCTL_OSC_EXT32 to use the hibernate modules 32.786-kHz oscillator. This option is
    only available on devices that include the hibernation module.
    The system clock source is chosen with one of the following values:
    SYSCTL_USE_PLL is used to select the PLL output as the system clock.
    SYSCTL_USE_OSC is used to choose one of the oscillators as the system clock.
    The PLL VCO frequency is chosen with one of the the following values:
    SYSCTL_CFG_VCO_480 to set the PLL VCO output to 480-MHz
    SYSCTL_CFG_VCO_320 to set the PLL VCO output to 320-MHz
    Example: Configure the system clocking to be 40 MHz with a 320-MHz PLL setting using the
    16-MHz internal oscillator.
    SysCtlClockFreqSet(SYSCTL_OSC_INT | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_320,
    40000000);
    Note:
    This function cannot be used with TM4C123 devices. For TM4C123 devices use the SysCtlClockSet() function.
    Returns:
    The actual configured system clock frequency in Hz or zero if the value could not be changed
    due to a parameter error or PLL lock failure.


    使用这个函数的返回值就好了。