4.13. GPT

4.13.1. About This Document

Document Title

User Guide of MCAL GPT Driver

Document Version

Version 1.6

Company

Texas Instruments

Document Name

GPT User Guide

4.13.2. Revision History

Version

Date

Revision History

Status

Version 1.0

26 April 2022

Initial Release

Approved

Version 1.1

05 Aug 2022

Updated AM263 to AM263x

Approved

Version 1.2

23 Dec 2022

GPT Example application testing procedure is added

Approved

Version 1.3

8 May 2023

GPT Example application testing procedure updated

Approved

Version 1.4

12 Jun 2023

Updated as per HTML format.

Approved

Version 1.5

25 Aug 2023

Document release version column removed

Approved

Version 1.6

1 Feb 2024

Parameter descriptions updated

Approved

4.13.3. Table of contents

  1. Acronyms and Definitions

  2. Functional Overview

  3. Deviations to requirements (Requirement Traceability)

  4. Integration Details

  5. API Description

  6. Configuration Description

  7. Memory Mapping

  8. Memory footprint

  9. Performance

  10. Example Usage

  11. FAQ’s

  12. Test Report

  13. References

  14. TI Disclaimer

4.13.4. Acronyms and Definitions

Acronyms and Definitions Used are presented in below table.

Acronyms

Descriptions

BSW

Basic Software

DET

Default Error Tracer

GPT

General Purpose Timer

MCU

Micro Controller Unit

OS

Operating System

Definitions

Descriptions

Timer channel

Represents a logical timer entity assigned to a timer hardware

Target Time

Something as per requirement occurs once this time value reached.

Ticks

Defines the timer resolution, the duration of a timer increment

4.13.5. Functional Overview

4.13.5.1. Brief Overview

This document describes the functionality, API and configuration of the AUTOSAR BSW module GPT.

Supported AUTOSAR Release

4.3.1

Supported Configuration Variants

Pre-Compile, Post-build

Vendor ID

GPT_VENDOR_ID (44)

Module ID

GPT_MODULE_ID (100)

Supported Platform

AM263x

The GPT module initializes and controls the internal General Purpose Timer(s) (GPT) of the microcontroller. The GPT driver provides services and configuration parameters for

  1. Starting and stopping hardware timers

  2. Getting timer values

  3. Controlling time triggered interrupt notifications

Note that the conversion between timer ticks provided by GPT and actual time value is not done by GPT. User software must take care of it. The tick duration of a timer channel depends on channel specific settings (part of GPT driver) as well as on system clock and settings of the clock tree controlled by the MCU module. The brief overview on GPT module is given below:

4.13.5.1.1. GPT Driver Architecture

The following figure shows where the GPT is in the AUTOSAR architecture.

../_images/gpt_image2.jpg

fig1: GPT in AUTOSAR architecture.

4.13.5.1.2. Initialization

The driver GPT is initialized by calling Gpt_Init(), with parameter ConfigPtr referencing a runtime configuration set. After de-initializing the module, that is calling Gpt_DeInit(), it can be initialized again.

4.13.5.1.3. States

Each GPT channel has up to five different states, depending on its configuration and running state as described below

  1. GPT_UNINITIALIZED: GPT channel is not initialized and not counting.

  2. GPT_INITIALIZED: GPT channel is initialized with Gpt_Init() and not counting.

  3. GPT_RUNNING: GPT channel is initialized and running (counting).

  4. GPT_STOPPED: GPT channel is initialized but not counting (stopped).

  5. GPT_EXPIRED: GPT channel is expired (timer overflowed). This state will be applicable in timer one shot mode where after encountering overflow timer stops.

The figure below taken from the AUTOSAR specification shows the state transitions for different function calls and events:

../_images/gpt_image3.jpg

fig2: GPT channel states and state transitions

4.13.5.1.4. GPT channel modes

The GPT channel can be configured in “one-shot mode” or in “continuous mode”.

  1. One-shot mode: In one-shot mode timer stops counting after overflow (when timer value matches to target value set by Gpt_StartTimer).

  2. Continuous mode: In continuous mode if the timer has reached the target time (timer value = target time), the timer will continue running with the value “0” at next timer tick.

GPT channel mode can be selected through configuration structure Gpt_ConfigType.

4.13.5.1.5. GPT operating modes

The GPT channels can be configured in normal mode. In this mode, GPT channel will be initialized with Gpt_Init(). In this mode, interrupt notifications will be allowed if enabled through configuration.

../_images/gpt_image4.jpg

fig3: GPT driver modes

4.13.5.1.6. GPT starting/stopping channel counting and reading count

The GPT channel starts counting after calling Gpt_Init() . The count value (target time in ticks) is passed to Gpt_StartTimer() function. GPT channel will start counting till target time is reached. Depending on channel mode it will stop (one-shot mode) or roll over (continuous mode) after target time is reached. GPT channel can be explicitly stopped by calling function Gpt_StopTimer(). This will stop channel from counting and disable all its interrupts notifications.

To read channel count when channel is running functions Gpt_GetTimeElapsed() and Gpt_GetTimeRemaining() can be used. As name suggests these give time elapsed after starting timer and time remaining to reach target time respectively. Below snapshot from GPT MCAL spec shows working of these two functions.

Please note that general-purpose timers doesn’t keep track on amount of time that has overflowed by above two functions and the time overflow is always considered absolute and not relative.

../_images/gpt_image5.jpg

fig4: Time Elapsed and Time remaining for a timer channel

4.13.5.1.7. GPT interrupt notifications

GPT driver supports enabling and disabling interrupt notifications for GPT channels through Gpt_EnableNotification() and Gpt_DisableNotification() functions. For getting notification from channel, a pointer to notification function should be passed through configuration structure during initialization. In case notification function not available Gpt_EnableNotification() will return an error. Also, it is important to note that interrupt notifications are only enabled when device is in normal mode. In sleep mode interrupt notifications are disabled if they are not wakeup capable (and not enabled for wakeup).

Once interrupt notifications are enabled GPT channel after counting till target time will generate interrupt and channel ISR will be called. This ISR will determine whether to call notification function or wakeup function depending on which one is enabled beforehand. It is responsibility of user software to register these ISR with MCU before starting channel.

4.13.5.2. Supported and Not Supported Features

IP Supported Features

AUTOSAR Supported Features

Not Supported Features

Free running 32 bit up counter

Initialization and de-initialization of all GPT channels.

Predefined timers are not supported.

Auto reload mode (can be used for continuous counter operation)

Starting and stopping of counting for individual channels.

Sleep and wakeup is not supported.

Support dynamic Start / Stop counter operation

Getting elapsed and remaining counter value

Programmable clock dividers (2n, where n = [0-8])

Enabling/disabling counter triggered interrupt notifications.

2 timers modules could be operated in cascaded mode to provide 64bit counter

One shot and continuous mode.

Programmable interrupt generation on overflow, compare and capture

Programmable clock source

Supports 3 basic functional modes Timer mode, Capture mode & Compare mode

4.13.5.3. Assumptions

None

4.13.5.4. Limitations

None

4.13.5.5. Design overview

Please refer SITARA MCU MCAL Architecture Document and MCAL: GPT Detailed Design Document provided as part of CSP.

4.13.5.6. File Structure

Description of static files is provided below:

Static source and header files

Description

Gpt.h

Contains the API’s of the GPT driver to be used by upper layers

Gpt_Priv.h

Contains data structures and Internal function declarations

Gpt_Irq.h

Contains ISR function declaration

Gpt.c

Implementation of the API’s for GPT driver

Gpt_Priv.c

Contains Internal Functions Definitions

Gpt_Irq.c

Contains ISR function definitions

Description of generated files is provided below:

Plugin Files

Descriptions

Gpt_Cfg.h

Contains the base addresses, Precompile switches, Macros for channels, counters etc.

Gpt_PBcfg.c

Contains all channels Post-Build Configuration parameters

Gpt_Cfg.c

Contains all channels Pre-Compile Configuration parameters

The below diagram shows the files structure for the GPT driver.

../_images/gpt_image6.jpg

fig5 :GPT header file include structure

4.13.6. Deviations to requirements (Requirement Traceability)

4.13.6.1. Module Requirements

Please refer Software Product Specification document provided as part of CSP.

4.13.6.2. Deviation of requirements against AUTOSAR specification requirements

Will be updated in future release

4.13.7. Integration Details

4.13.7.1. Dependency on Other Software Modules

4.13.7.1.1. MCU

The module MCU powers up the microcontroller’s peripherals at startup time and initializes the PLL as well as the internal clock domains which is connected to the GPT unit. The GPT module also supports an internal divider which can be changed at configuration time using the ‘prescale’ member of Gpt_ChannelConfigType structure to configure the actual GPT functional clock.

Note that Module GPT will not take care of settings which configure the clock and PLL for channels in its init function. This must be done by the MCU module.

4.13.7.1.2. Port

The GPT module does not require any PORT configuration. Hence there is no dependency on PORT module.

4.13.7.1.3. OS

An operating system can be used for task scheduling, interrupt handling, global suspend and restore of interrupts and creating of the Interrupt Vector Table.The GPT module may use AUTOSAR OS to suspend and restore global interrupts.

4.13.7.1.4. Error Handling module

4.13.7.1.4.1. DET

The module GPT depends on the DET (by default) to report development errors. Detection and reporting of development errors can be enabled or disabled by the switch “Enable Development Error Detection” on the tab “General Settings” within the module GPT. The DET can be replaced optionally by an equivalent component which is responsible to recognize development errors, if no DET component is available.

AUTOSAR requires that API functions shall check the validity of their respective parameters. These checks are for development error reporting and can be enabled or disabled.

Type of Error

Relevance

Related Error Code

Value

API service called without module initialization

Development

GPT_E_UNINIT

0x0A

API service is called when timer channel is still busy

Development

GPT_E_BUSY

0x0B

API service for initialization is called when already initialized

Development

GPT_E_ALREADY_INITIALIZED

0x0D

API parameter checking: invalid channel

Development

GPT_E_PARAM_CHANNEL

0x14

API parameter checking: invalid value

Development

GPT_E_PARAM_VALUE

0x15

API parameter checking: invalid pointer

Development

GPT_E_PARAM_POINTER

0x16

API parameter checking: invalid mode

Development

GPT_E_PARAM_MODE

0x1F

4.13.7.1.4.2. Runtime Errors

Type of Error

Relevance

Related Error Code

Value

API service called when timer channel is still busy (running)

Development

GPT_E_BUSY

0x0B

API service called when driver is in wrong mode

Development

GPT_E_MODE

0x0C

4.13.7.1.4.3. DEM

By default, production code related errors are reported to the DEM using the service DEM_ReportErrorStatus().

The errors reported to DEM are described in the following table:

Error Code

Description

Assigned by DEM

GPT_E_HARDWARE_ERROR

This error is raised when issued when GPT Timer register reset fails.

4.13.7.1.5. Callback Notification

This section describes notification functions which are passed to GPT driver as a target function. The target function is usually a call-back function. The names of these functions are not fixed and can be changed. At its configurable interfaces the GPT defines notifications that can be mapped to callback functions to respective channels. Function pointer to callback function (for non-wakeup notification) should be defined in Gpt.h with Gpt_NotifyType datatype. There should be separate notification call back function for each timer channel which is configured as Gpt_Channel_Notify<channelnumber>. Example: Gpt_Channel_Notify5 for channel 5

4.13.7.2. Hardware - Software - API name mapping

For interrupt notification and wakeup, ISR are provided in GPT driver. There is one ISR for each timer channel. Depending on mode of timer it will call notify function. The interrupt service routines shall be mapped to the interrupt sources of the respective GPT unit interrupt. The supported ISR’s are part of the Gpt_Irq.h file.

Following are timer modules with its respective ISRs and counter blocks for each channel in AM263x:

Timer

ISR

Counter Blocks

GptChannelTickFrequency(Prescaler value)

RTI0

Gpt_Ch0Isr()

GPT_RTI_COUNTER0

GptModule0CounterBlk0Frequency

RTI0

Gpt_Ch1Isr()

GPT_RTI_COUNTER0

GptModule0CounterBlk0Frequency

RTI0

Gpt_Ch2Isr()

GPT_RTI_COUNTER1

GptModule0CounterBlk1Frequency

RTI0

Gpt_Ch3Isr()

GPT_RTI_COUNTER1

GptModule0CounterBlk1Frequency

RTI1

Gpt_Ch4Isr()

GPT_RTI_COUNTER0

GptModule1CounterBlk0Frequency

RTI1

Gpt_Ch5Isr()

GPT_RTI_COUNTER0

GptModule1CounterBlk0Frequency

RTI1

Gpt_Ch6Isr()

GPT_RTI_COUNTER1

GptModule1CounterBlk1Frequency

RTI1

Gpt_Ch7Isr()

GPT_RTI_COUNTER1

GptModule1CounterBlk1Frequency

RTI2

Gpt_Ch8Isr()

GPT_RTI_COUNTER0

GptModule2CounterBlk0Frequency

RTI2

Gpt_Ch9Isr()

GPT_RTI_COUNTER0

GptModule2CounterBlk0Frequency

RTI2

Gpt_Ch10Isr()

GPT_RTI_COUNTER1

GptModule2CounterBlk1Frequency

RTI2

Gpt_Ch11Isr()

GPT_RTI_COUNTER1

GptModule2CounterBlk1Frequency

RTI3

Gpt_Ch12Isr()

GPT_RTI_COUNTER0

GptModule3CounterBlk0Frequency

RTI3

Gpt_Ch13Isr()

GPT_RTI_COUNTER0

GptModule3CounterBlk0Frequency

RTI3

Gpt_Ch14Isr()

GPT_RTI_COUNTER1

GptModule3CounterBlk1Frequency

RTI3

Gpt_Ch15Isr()

GPT_RTI_COUNTER1

GptModule3CounterBlk1Frequency

Gpt-channel tick frequency is considered to be as prescaler value.It needs to be configured under GptDriverConfiguration container of configuration file. It is defined as GptModule<module_number>CounterBlk0Frequency and GptModule<module_number>CounterBlk1Frequency. Here “module_number” defines the rti register number.

There are 2 counter blocks GPT_RTI_COUNTER0 and GPT_RTI_COUNTER1 which can be mapped as shown above. Detailed description on the above parameters are explained in ‘Parameter Description’ section.

For example,if we are configuring 5th channel,then channel id shall be 4 and it belongs to RTI1 timer section and counter block is GPT_RTI_COUNTER0. So the respective prescaler value,i.e.,GptChannelTickFrequency shall be “GptModule1CounterBlk0Frequency” in configuration file.Here ‘Module1’ defined for RTI1 timer and ‘CounterBlk0’ defined for GPT_RTI_COUNTER0 counter block.

4.13.7.3. Scheduling Strategy

4.13.7.3.1. SchM

Beside the OS the BSW Scheduler provides functions that module GPT calls at begin and end of critical sections.

4.13.7.3.2. Critical Sections

There is only one kind of critical sections in this driver. Within these sections all read /modify/write accesses to internal GPT status variables must be protected. Therefore, switching to tasks that also access GPT must be avoided and all GPT interrupts must be suspended.

4.13.8. API Description

4.13.8.1. Description of the API’s

Please refer MCAL_AM263_ApiGuide.CHM document provided as part of CSP.

4.13.8.2. API’s with Service ID

The following table presents the service IDs and the related services:

Service ID

Service

0x00

Gpt_GetVersionInfo

0x01

Gpt_Init

0x02

Gpt_DeInit

0x03

Gpt_GetTimeElapsed

0x04

Gpt_GetTimeRemaining

0x05

Gpt_StartTimer

0x06

Gpt_StopTimer

0x07

Gpt_EnableNotification

0x08

Gpt_DisableNotification

4.13.8.3. Description on Non Standard API’s

Gpt_RegisterReadback API–This function is non-autosar based and is used to read the data in the registers of GPT if we keep GPT_REGISTER_READBACK_API Macro as ON.

4.13.9. Configuration Description

4.13.9.1. Configuration Variants

The GPT can be configured as Post-Build or Pre-Compile variant, using EB tresos tool.

Variants

Generated Files

PostBuild

Gpt_PBcfg.c , Gpt_Cfg.h

Pre-Compile

Gpt_Cfg.c , Gpt_Cfg.h

4.13.9.2. Parameter Description

4.13.9.2.1. Standard Configuration

Standard Parameters

Description

Default Value

Range

Unit/Datatype

GptChannelId

Channel Id of the GPT channel. This value will be assigned to the symbolic name derived of the GptChannelConfiguration container short name.

0

0 .. 15

Integer

GptChannelMode

Specifies the behavior of the timer channel after the target time is reached

GPT_CH_MODE_CONTINUOUS- After reaching the target time, the timer continues running with the value “zero” again.

GPT_CH_MODE_ONESHOT- After reaching the target time, the timer stops automatically (timer expired).

GPT_CH_MODE_CONTINUOUS

GPT_CH_MODE_CONTINUOUS(0) GPT_CH_MODE_ONESHOT(1)

Enumeration

GptChannelTickFrequency

Specifies the tick frequency of the timer channel in Hz.

1

0..infinite

Hertz

GptChannelTickValueMax

Maximum value in ticks, the timer channel is able to count. With the next tick, the timer rolls over to zero

0

0..4294967295

Integer

GptEnableWakeup

Enables wakeup capability of MCU for a channel.

FALSE

TRUE/ FALSE

Boolean

GptNotification

Function pointer to callback function (for non-wakeup notification)

null_ptr

Function

GptDeinitApi

Enables/ Disables the service Gpt_DeInit() from the code.

TRUE

TRUE / FALSE

Boolean

GptEnableDisableNotificationApi

Enables/ Disables the services Gpt_EnableNotification() and Gpt_DisableNotification from the code

TRUE

TRUE / FALSE

Boolean

GptTimeElapsedApi

Enables/ Disables the service Gpt_GetTimeElapsed() from the code

TRUE

TRUE / FALSE

Boolean

GptTimeRemainingApi

Enables/ Disables the service Gpt_GetTimeRemaining() from the code.

TRUE

TRUE / FALSE

Boolean

GptVersionInfoApi

Enables/ Disables the service Gpt_GetVersionInfo() from the code

TRUE

TRUE / FALSE

Boolean

GptWakeupFunctionalityApi

Enables/ Disables the services Gpt_SetMode(), Gpt_EnableWakeup() Gpt_DisableWakeup() and Gpt_CheckWakeup() from the code.

FALSE

TRUE / FALSE

Boolean

GptDevErrorDetect

Enables/Disables development error detection

TRUE

TRUE / FALSE

Boolean

GptPredefTimer100us32bitEnable

Enables/disables the GPT Predef Timer 100us32bit

FALSE

TRUE / FALSE

Boolean

GptPredefTimer1usEnablingGrade

Specifies the grade of enabling the GPT Predef Timers with 1us tick duration

GPT_PREDEF_UNDEFINED

GPT_PREDEF_UNDEFINED,

GPT_PREDEF_TIMER_1US_16BIT,

GPT_PREDEF_TIMER_1US_24BIT,

GPT_PREDEF_TIMER_1US_32BIT,

GPT_PREDEF_TIMER_100US_32BIT

Enumeration

GptReportWakeupSource

Enables/Disables wakeup source reporting

TRUE

TRUE/ FALSE

Boolean

4.13.9.2.2. IP Specific Configuration

Standard Parameters

Description

Default Value

Range

Unit/Datatype

GptCounterBlkId

This is the Counter block ID for the RTI modules. Each RTI module has 2 counter blocks that are defined in this configuration parameter.

GPT_RTI_COUNTER1

GPT_RTI_COUNTER0 GPT_RTI_COUNTER1

Enumeration

GptRegisterReadback

Adds / removes the service Gpt_ConfigRegReadBack() from the code

FALSE

TRUE/FALSE

Boolean

GptTypeofInterruptFunction

Type of ISR function

GPT_ISR_CAT1

GPT_ISR_VOID GPT_ISR_CAT1 GPT_ISR_CAT2

Enumeration

GptPrescaler

Prescaler value defined to get the desired frequency.Preload value acts as prescaler. The preload value(GptChannelTickFrequency) set in EB prescales the RTI clock. If it is equal to 0 then,frequency = RTICLK/ [2^32]. If it is not equal to 0 then , frequency = RTICLK/[GptChannelTickFrequency+ 1]

0

0..4294967295

Integer

GptModule0CounterBlk0Frequency

Specifies the tick frequency of the timer channel in Hz.Here ‘Module0’ refers to RTI0 timer.

0

0..4294967295

Integer

GptModule0CounterBlk1Frequency

Specifies the tick frequency of the timer channel in Hz.Here ‘Module0’ refers to RTI0 timer.

0

0..4294967295

Integer

GptModule1CounterBlk0Frequency

Specifies the tick frequency of the timer channel in Hz.Here ‘Module1’ refers to RTI1 timer.

0

0..4294967295

Integer

GptModule1CounterBlk1Frequency

Specifies the tick frequency of the timer channel in Hz.Here ‘Module1’ refers to RTI1 timer.

0

0..4294967295

Integer

GptModule2CounterBlk0Frequency

Specifies the tick frequency of the timer channel in Hz.Here ‘Module2’ refers to RTI2 timer.

0

0..4294967295

Integer

GptModule2CounterBlk1Frequency

Specifies the tick frequency of the timer channel in Hz.Here ‘Module2’ refers to RTI2 timer.

0

0..4294967295

Integer

GptModule3CounterBlk0Frequency

Specifies the tick frequency of the timer channel in Hz.Here ‘Module3’ refers to RTI3 timer.

0

0..4294967295

Integer

GptModule3CounterBlk1Frequency

Specifies the tick frequency of the timer channel in Hz.Here ‘Module3’ refers to RTI3 timer.

0

0..4294967295

Integer

GptDefaultOSCounterId

Default Os Counter Id if node reference to OsCounter ref GptOsCounterRef is not set

0

0..16

Integer

GptTimeoutDuration

GPT timeout - used in GPT busy wait

32000

1..4294967295

Seconds

GptDeviceVariant

Select SOC variant

AM263x

AM263x

Enumeration

4.13.9.3. Symbolic Names deviations

None.

4.13.9.4. Configuration rules and constraints to enable plausibility checks

Will be updated in future release

4.13.10. Memory Mapping

Memory Mapping Sections

GPT_CODE

GPT_VAR

GPT_VAR_NOINIT | GPT_CONST

GPT_APPL_CODE

GPT_PBCFG

GPT_START_SEC_VAR_INIT_UNSPECIFIED (.data)

x


GPT_STOP_SEC_VAR_INIT_UNSPECIFIED

x

GPT_START_SEC_CODE (.text)

x

GPT_STOP_SEC_CODE

x

GPT_START_SEC_VAR_NO_INIT_UNSPECIFIED (.bss)

x

GPT_STOP_SEC_VAR_NO_INIT_UNSPECIFIED

x

GPT_START_SEC_CONST_UNSPECIFIED(.rodata)

x

GPT_STOP_SEC_CONST_UNSPECIFIED

x

GPT_START_SEC_ISR_CODE (.text)

x

GPT_STOP_SEC_ISR_CODE

x

GPT_START_SEC_CONST_PTR (.rodata)

x

GPT_STOP_SEC_CONST_PTR

x

GPT_START_SEC_VAR_INIT_PTR (.data)

x

GPT_STOP_SEC_VAR_INIT_PTR

x

For application code used by GPT (like callback functions)

x

4.13.11. Memory footprint

Please refer Memory Footprint for more details.

4.13.12. Performance

Not Applicable

4.13.13. Example Usage

4.13.13.1. Steps to build and run example

  1. GPT example application demonstrates the MCAL GPT driver features, which is referred from folder <MCAL_ROOT>/examples/Gpt.

  2. This application can be built from the build folder by giving “gmake –s gpt_app PLATFORM=am263”.

  3. Once the build is completed we get a binary file,which is loaded in our controller and executed.

4.13.13.2. Document external set up Information

None

4.13.13.3. Flow of the example application

  1. After initialization of timer followed by starting of timer, a channel waits until the interrupt is received. Interrupt indicates that 2sec is completed for respective channel.

  2. After receiving interrupt notification, it stops the current channel and starts next channel to execute the same process.

  3. The provided example application of GPT is configured with a preload value of 1 which equates to around 10ns/tick for a 200 MHz RTI Clock input.

4.13.13.4. Configuration used to test this example

  1. In Example program,total 12 channels are configured in AM263x.

  2. Channels 5, 6, 9, 12, 13, 16 are configured in Continuous mode in AM263x

  3. Channels 7, 8, 10, 11, 14, 15 are configured in one-shot mode in AM263x

  4. Channels 1, 2, 3, 4 are not configured as RTI0 timer is being used for delay and OS counter purpose.

  5. Each channel is configured to run for 2sec.

Assuming Source Clock Signal input for RTI is 200MHz and the preload value is set as '1', to achieve the desired tick
frequency for the particular gpt channel, use the below mentioned formula:
Tick Frequency = RTI Clock Input/(1 + Preload Value)

Here as the RTI Clock Input = 200 MHz = 200 * (10^6) Hz

Hence the Tick frequency shall be,

Tick frequency = (200*10^6)/(1+1) = (200*10^6)/2 = 100 * 10^6

Tick frequency = 100MHz

Accordingly, the time Period shall be,

Time period = 1/Tick Frequency = 1/100Mhz =10ns

This defines that for every 10 ns time period, counter will increase by 1 tick.

In order to get 1 sec time period,the number of ticks can be defined in counter upto 1/10ns times, i.e., 100*10^6 ticks.

So,     100*10^6 = 0x05F5E100 shall be passed to Gpt_StartTimer in order to produce 1 sec delay.

4.13.13.5. Example Logs

AM263x

GPT_APP: Sample Application - STARTS !!!

GPT MCAL Version Info
---------------------
Vendor ID           : 44
Module ID           : 100
SW Major Version    : 9
SW Minor Version    : 1
SW Patch Version    : 0

----------------------------------------------------------------------------------
GPT_APP: GPTIMER Test Configuration
----------------------------------------------------------------------------------
Initializing channels
Post-Build variant is being used ..
------------------------------------------
GPT_APP: Running GPT Test for channel 4
------------------------------------------
GPT_APP: Starting timer for 2 s
GPT_APP: Time Elapsed Value = 4f
GPT_APP: Enable channel notification for this channel
GPT_APP: Wait for notification(approx. 2 seconds)
GPT_APP: GPT Test Notification Receiver channel 5 :)!!!

GPT_APP: Disable channel notification for this channel
GPT_APP: Wait till timer overflows, no notification should be received
GPT_APP: Time Elapsed Value = 0x27be4a
GPT_APP: Time Remaining Value = 0xba07231
Waiting for timer to overflow
Overflow happened no notification received
GPT_APP: Stop timer
GPT Test Passed for channel =4 !!!
------------------------------------------
GPT_APP: Running GPT Test for channel 5
------------------------------------------
GPT_APP: Starting timer for 2 s
GPT_APP: Time Elapsed Value = 23
GPT_APP: Enable channel notification for this channel
GPT_APP: Wait for notification(approx. 2 seconds)
GPT_APP: GPT Test Notification Receiver channel 6 :)!!!

GPT_APP: Disable channel notification for this channel
GPT_APP: Wait till timer overflows, no notification should be received
GPT_APP: Time Elapsed Value = 0x27be02
GPT_APP: Time Remaining Value = 0xba07287
Waiting for timer to overflow
Overflow happened no notification received
GPT_APP: Stop timer
GPT Test Passed for channel =5 !!!
------------------------------------------
GPT_APP: Running GPT Test for channel 6
------------------------------------------
GPT_APP: Starting timer for 2 s
GPT_APP: Time Elapsed Value = 23
GPT_APP: Enable channel notification for this channel
GPT_APP: Wait for notification(approx. 2 seconds)
GPT_APP: GPT Test Notification Receiver channel 7 :)!!!

GPT_APP: Disable channel notification for this channel
GPT_APP: Wait till timer overflows, no notification should be received
GPT_APP: Time Elapsed Value = 0xbebc200
GPT_APP: Time Remaining Value = 0x0
Waiting for timer to overflow
Overflow happened no notification received
GPT_APP: Stop timer
GPT Test Passed for channel =6 !!!
------------------------------------------
GPT_APP: Running GPT Test for channel 7
------------------------------------------
GPT_APP: Starting timer for 2 s
GPT_APP: Time Elapsed Value = 23
GPT_APP: Enable channel notification for this channel
GPT_APP: Wait for notification(approx. 2 seconds)
GPT_APP: GPT Test Notification Receiver channel 8 :)!!!

GPT_APP: Disable channel notification for this channel
GPT_APP: Wait till timer overflows, no notification should be received
GPT_APP: Time Elapsed Value = 0xbebc200
GPT_APP: Time Remaining Value = 0x0
Waiting for timer to overflow
Overflow happened no notification received
GPT_APP: Stop timer
GPT Test Passed for channel =7 !!!
------------------------------------------
GPT_APP: Running GPT Test for channel 8
------------------------------------------
GPT_APP: Starting timer for 2 s
GPT_APP: Time Elapsed Value = 23
GPT_APP: Enable channel notification for this channel
GPT_APP: Wait for notification(approx. 2 seconds)
GPT_APP: GPT Test Notification Receiver channel 9 :)!!!

GPT_APP: Disable channel notification for this channel
GPT_APP: Wait till timer overflows, no notification should be received
GPT_APP: Time Elapsed Value = 0x27bdfa
GPT_APP: Time Remaining Value = 0xba0728c
Waiting for timer to overflow
Overflow happened no notification received
GPT_APP: Stop timer
GPT Test Passed for channel =8 !!!
------------------------------------------
GPT_APP: Running GPT Test for channel 9
------------------------------------------
GPT_APP: Starting timer for 2 s
GPT_APP: Time Elapsed Value = 23
GPT_APP: Enable channel notification for this channel
GPT_APP: Wait for notification(approx. 2 seconds)
GPT_APP: GPT Test Notification Receiver channel 10 :)!!!

GPT_APP: Disable channel notification for this channel
GPT_APP: Wait till timer overflows, no notification should be received
GPT_APP: Time Elapsed Value = 0xbebc200
GPT_APP: Time Remaining Value = 0x0
Waiting for timer to overflow
Overflow happened no notification received
GPT_APP: Stop timer
GPT Test Passed for channel =9 !!!
------------------------------------------
GPT_APP: Running GPT Test for channel 10
------------------------------------------
GPT_APP: Starting timer for 2 s
GPT_APP: Time Elapsed Value = 23
GPT_APP: Enable channel notification for this channel
GPT_APP: Wait for notification(approx. 2 seconds)
GPT_APP: GPT Test Notification Receiver channel 11 :)!!!

GPT_APP: Disable channel notification for this channel
GPT_APP: Wait till timer overflows, no notification should be received
GPT_APP: Time Elapsed Value = 0xbebc200
GPT_APP: Time Remaining Value = 0x0
Waiting for timer to overflow
Overflow happened no notification received
GPT_APP: Stop timer
GPT Test Passed for channel =10 !!!
------------------------------------------
GPT_APP: Running GPT Test for channel 11
------------------------------------------
GPT_APP: Starting timer for 2 s
GPT_APP: Time Elapsed Value = 23
GPT_APP: Enable channel notification for this channel
GPT_APP: Wait for notification(approx. 2 seconds)
GPT_APP: GPT Test Notification Receiver channel 12 :)!!!

GPT_APP: Disable channel notification for this channel
GPT_APP: Wait till timer overflows, no notification should be received
GPT_APP: Time Elapsed Value = 0x27e00d
GPT_APP: Time Remaining Value = 0xba05080
Waiting for timer to overflow
Overflow happened no notification received
GPT_APP: Stop timer
GPT Test Passed for channel =11 !!!
------------------------------------------
GPT_APP: Running GPT Test for channel 12
------------------------------------------
GPT_APP: Starting timer for 2 s
GPT_APP: Time Elapsed Value = 23
GPT_APP: Enable channel notification for this channel
GPT_APP: Wait for notification(approx. 2 seconds)
GPT_APP: GPT Test Notification Receiver channel 13 :)!!!

GPT_APP: Disable channel notification for this channel
GPT_APP: Wait till timer overflows, no notification should be received
GPT_APP: Time Elapsed Value = 0x27e014
GPT_APP: Time Remaining Value = 0xba05075
Waiting for timer to overflow
Overflow happened no notification received
GPT_APP: Stop timer
GPT Test Passed for channel =12 !!!
------------------------------------------
GPT_APP: Running GPT Test for channel 13
------------------------------------------
GPT_APP: Starting timer for 2 s
GPT_APP: Time Elapsed Value = 23
GPT_APP: Enable channel notification for this channel
GPT_APP: Wait for notification(approx. 2 seconds)
GPT_APP: GPT Test Notification Receiver channel 14 :)!!!

GPT_APP: Disable channel notification for this channel
GPT_APP: Wait till timer overflows, no notification should be received
GPT_APP: Time Elapsed Value = 0xbebc200
GPT_APP: Time Remaining Value = 0x0
Waiting for timer to overflow
Overflow happened no notification received
GPT_APP: Stop timer
GPT Test Passed for channel =13 !!!
------------------------------------------
GPT_APP: Running GPT Test for channel 14
------------------------------------------
GPT_APP: Starting timer for 2 s
GPT_APP: Time Elapsed Value = 23
GPT_APP: Enable channel notification for this channel
GPT_APP: Wait for notification(approx. 2 seconds)
GPT_APP: GPT Test Notification Receiver channel 15 :)!!!

GPT_APP: Disable channel notification for this channel
GPT_APP: Wait till timer overflows, no notification should be received
GPT_APP: Time Elapsed Value = 0xbebc200
GPT_APP: Time Remaining Value = 0x0
Waiting for timer to overflow
Overflow happened no notification received
GPT_APP: Stop timer
GPT Test Passed for channel =14 !!!
------------------------------------------
GPT_APP: Running GPT Test for channel 15
------------------------------------------
GPT_APP: Starting timer for 2 s
GPT_APP: Time Elapsed Value = 23
GPT_APP: Enable channel notification for this channel
GPT_APP: Wait for notification(approx. 2 seconds)
GPT_APP: GPT Test Notification Receiver channel 16 :)!!!

GPT_APP: Disable channel notification for this channel
GPT_APP: Wait till timer overflows, no notification should be received
GPT_APP: Time Elapsed Value = 0x27e011
GPT_APP: Time Remaining Value = 0xba0507e
Waiting for timer to overflow
Overflow happened no notification received
GPT_APP: Stop timer
GPT Test Passed for channel =15 !!!
GPT Test Passed for configuration!!
GPT Test Completed, njoy life!!!
GPT_APP: Sample Application - DONE !!!
GPT Stack Usage: 832 bytes
GPT Test Passed!!!

4.13.14. FAQ’s

None

4.13.15. Test Report

Please refer AM26x GPT Driver Test Case Report provided as part of CSP.

4.13.16. References

4.13.17. TI Disclaimer

Texas Instruments and its subsidiaries (TI) reserve the right to make changes to their products or to discontinue any product or service without notice, and advise customers to obtain the latest version of relevant information to verify, before placing orders, that information being relied on is current and complete. All products are sold subject to the terms and conditions of sale supplied at the time of order acknowledgment, including those pertaining to warranty, patent infringement, and limitation of liability.

TI warrants performance of its products to the specifications applicable at the time of sale in accordance with TI’s standard warranty. Testing and other quality control techniques are utilized to the extent TI deems necessary to support this warranty. Specific testing of all parameters of each device is not necessarily performed, except those mandated by government requirements.

Customers are responsible for their applications using TI components. In order to minimize risks associated with the customer’s applications, adequate design and operating safeguards must be provided by the customer to minimize inherent or procedural hazards.

TI assumes no liability for applications assistance or customer product design. TI does not warrant or represent that any license, either express or implied, is granted under any patent right, copyright, mask work right, or other intellectual property right of TI covering or relating to any combination, machine, or process in which such products or services might be or are used. TI’s publication of information regarding any third party’s products or services does not constitute TI’s approval, license, warranty or endorsement thereof.

Reproduction of information in TI data books or data sheets is permissible only if reproduction is without alteration and is accompanied by all associated warranties, conditions, limitations and notices. Representation or reproduction o f this information with alteration voids all warranties provided for an associated TI product or service, is an unfair and deceptive business practice, and TI is not responsible nor liable for any such use.

Resale of TI’s products or services with statements different from or beyond the parameters stated by TI for that product or service voids all express and any implied warranties for the associated TI product or service, is an unfair and deceptive business practice, and TI is not responsible nor liable for any such use.

Also see: Standard Terms and Conditions of Sale for Semiconductor Products https://www.ti.com/sc/docs/stdterms.htm

Mailing Address: Texas Instruments, Post Office Box 655303, Dallas, Texas 75265