SPMA085 June   2022 TM4C1230C3PM , TM4C1230C3PM , TM4C1230D5PM , TM4C1230D5PM , TM4C1230E6PM , TM4C1230E6PM , TM4C1230H6PM , TM4C1230H6PM , TM4C1231C3PM , TM4C1231C3PM , TM4C1231D5PM , TM4C1231D5PM , TM4C1231D5PZ , TM4C1231D5PZ , TM4C1231E6PM , TM4C1231E6PM , TM4C1231E6PZ , TM4C1231E6PZ , TM4C1231H6PGE , TM4C1231H6PGE , TM4C1231H6PM , TM4C1231H6PM , TM4C1231H6PZ , TM4C1231H6PZ , TM4C1232C3PM , TM4C1232C3PM , TM4C1232D5PM , TM4C1232D5PM , TM4C1232E6PM , TM4C1232E6PM , TM4C1232H6PM , TM4C1232H6PM , TM4C1233C3PM , TM4C1233C3PM , TM4C1233D5PM , TM4C1233D5PM , TM4C1233D5PZ , TM4C1233D5PZ , TM4C1233E6PM , TM4C1233E6PM , TM4C1233E6PZ , TM4C1233E6PZ , TM4C1233H6PGE , TM4C1233H6PGE , TM4C1233H6PM , TM4C1233H6PM , TM4C1233H6PZ , TM4C1233H6PZ , TM4C1236D5PM , TM4C1236D5PM , TM4C1236E6PM , TM4C1236E6PM , TM4C1236H6PM , TM4C1236H6PM , TM4C1237D5PM , TM4C1237D5PM , TM4C1237D5PZ , TM4C1237D5PZ , TM4C1237E6PM , TM4C1237E6PM , TM4C1237E6PZ , TM4C1237E6PZ , TM4C1237H6PGE , TM4C1237H6PGE , TM4C1237H6PM , TM4C1237H6PM , TM4C1237H6PZ , TM4C1237H6PZ , TM4C123AE6PM , TM4C123AE6PM , TM4C123AH6PM , TM4C123AH6PM , TM4C123BE6PM , TM4C123BE6PM , TM4C123BE6PZ , TM4C123BE6PZ , TM4C123BH6PGE , TM4C123BH6PGE , TM4C123BH6PM , TM4C123BH6PM , TM4C123BH6PZ , TM4C123BH6PZ , TM4C123FE6PM , TM4C123FE6PM , TM4C123FH6PM , TM4C123FH6PM , TM4C123GE6PM , TM4C123GE6PM , TM4C123GE6PZ , TM4C123GE6PZ , TM4C123GH6PGE , TM4C123GH6PGE , TM4C123GH6PM , TM4C123GH6PM , TM4C123GH6PZ , TM4C123GH6PZ , TM4C123GH6ZXR , TM4C123GH6ZXR , TM4C1290NCPDT , TM4C1290NCPDT , TM4C1290NCZAD , TM4C1290NCZAD , TM4C1292NCPDT , TM4C1292NCPDT , TM4C1292NCZAD , TM4C1292NCZAD , TM4C1294KCPDT , TM4C1294KCPDT , TM4C1294NCPDT , TM4C1294NCPDT , TM4C1294NCZAD , TM4C1294NCZAD , TM4C1297NCZAD , TM4C1297NCZAD , TM4C1299KCZAD , TM4C1299KCZAD , TM4C1299NCZAD , TM4C1299NCZAD , TM4C129CNCPDT , TM4C129CNCPDT , TM4C129CNCZAD , TM4C129CNCZAD , TM4C129DNCPDT , TM4C129DNCPDT , TM4C129DNCZAD , TM4C129DNCZAD , TM4C129EKCPDT , TM4C129EKCPDT , TM4C129ENCPDT , TM4C129ENCPDT , TM4C129ENCZAD , TM4C129ENCZAD , TM4C129LNCZAD , TM4C129LNCZAD , TM4C129XKCZAD , TM4C129XKCZAD , TM4C129XNCZAD , TM4C129XNCZAD

 

  1.   Abstract
  2.   Trademarks
  3. 1Introduction
  4. 2How to Install
    1. 2.1 Update the FreeRTOS Version in the TivaWare Directory
    2. 2.2 Adding FreeRTOS Hardware Driver Files for TM4C LaunchPads
  5. 3Architecture for TM4C FreeRTOS Examples
    1. 3.1 Proper Clock Configuration
    2. 3.2 How to use Hardware Interrupts Alongside the FreeRTOS Kernel
  6. 4Example Project Walkthroughs
    1. 4.1 Download and Import the Examples
    2. 4.2 Kernel Examples
      1. 4.2.1 Example: hello
      2. 4.2.2 Example: notify_example
      3. 4.2.3 Example: queue_example
      4. 4.2.4 Example: semaphore_example
      5. 4.2.5 Example: blinky_queue
      6. 4.2.6 Software Timer Examples
        1. 4.2.6.1 Example: timer_sw_oneshot
        2. 4.2.6.2 Example: timer_sw_periodic
        3. 4.2.6.3 Example: timer_sw_led_counter/timer_sw_rgb
    3. 4.3 ADC Examples
      1. 4.3.1 Example: adc_multi_channel
      2. 4.3.2 Example: adc_timer_trigger
    4. 4.4 Hardware Timer Examples
      1. 4.4.1 Example: timer_hw_oneshot
      2. 4.4.2 Example: timer_hw_periodic
      3. 4.4.3 Example: timer_hw_pwm
    5. 4.5 UART Example
      1. 4.5.1 Example: uart_thread_safe
    6. 4.6 Watchdog Example
      1. 4.6.1 Example: watchdog

Proper Clock Configuration

To ensure that the FreeRTOS kernel is operating at the correct tick rate, care must be taken to assign the correct system clock frequency of the TM4C microcontroller to the FreeRTOS kernel. The configCPU_CLOCK_HZ variable in FreeRTOSConfig.h holds the value of the system clock frequency. This variable must be updated accordingly for any system clock frequency changes. All examples provided are using the maximum supported clock speed for the target microcontroller which is 80 MHz for TM4C123x devices and 120 MHz for TM4C129x devices.

The device-specific data sheets for each TM4C microcontroller provides information about the valid clock speed options under the Clock Control section. There are limitations to how precise a frequency can be set based on the clock dividers. If a frequency that cannot be supported is input in a TivaWare clock configuration function, typically the next closest frequency will be configured. Improper clock configurations in terms of not accurately reflecting external crystals or which oscillator should be used can also lock a device until reset to factory condition. Lastly, certain peripherals have requirements for minimum system clock frequencies to be able to operate to specification including the ADC (for high speed sampling), USB, and Ethernet (TM4C129x family only) peripherals.

There are differences in how to handle the clock configuration between the two TM4C device families.

For TM4C123x devices, the system clock frequency is set with the SysCtlClockSet API and is determined only by the divider that is passed with the function call. The actual rate of the system clock can be then acquired with the SysCtlClockGet API. However, since the FreeRTOSConfig.h file requires hardcoded definitions of the clock rate, any changes to the system clock frequency will need to be validated without the kernel running before plugging in the new value for configCPU_CLOCK_HZ.

For TM4C129x devices, the system clock frequency is set with the SysCtlClockFreqSet API, which requires an input for the desired system clock frequency. It then returns the actual system clock frequency that was set based on what is the closest setting to the requested value. In each example provided, that value is stored in g_ui32SysClock, which can be used to verify that the correct frequency has been set. The clock frequency input provided to SysCtlClockFreqSet is the configCPU_CLOCK_HZ variable. Therefore, as long as a valid TM4C129x clock frequency is defined, only one change is needed for the project.