4.17. ICU Module
4.17.1. Acronyms and Definitions
Abbreviation/Term |
Explanation |
---|---|
AUTOSAR |
Automotive Open System Architecture |
BSW |
Basic Software |
MCAL |
Micro Controller Abstraction Layer |
API |
Application Programming Interface |
DET |
Default Error Tracer |
ICU |
Input Capture Unit |
ECAP |
Enhanced Capture |
MCU |
Micro Controller Unit |
4.17.2. Introduction
This document describes the functionality, API and configuration of the AUTOSAR BSW module Icu.
Supported AUTOSAR Release |
4.3.1 |
Supported Configuration Variants |
Pre-Compile & Post-Build |
Vendor ID |
ICU_VENDOR_ID (44) |
Module ID |
ICU_MODULE_ID (122) |
Supported Platform |
AM263Px |
4.17.3. Functional Overview
The ICU module initializes, configures and controls the internal hardware to realize ICU driver as detailed in AUTOSAR BSW ICU Driver Specification. The ICU functionality is realized through the ECAP IP available on the device. Following section highlights key aspects of this implementation, which would be of interest to an integrator.
4.17.3.1. Functional Description
The ICU driver uses ECAP module to capture events. In AM263Px we have a total of 10 instances of ICU. The ICU driver provides the following features:
Signal Measurements - High time, Low time, Period time, Duty cycle
Edge Detection - Provide notification for each edge detected
Edge Counting - Measure edge counts
Edge Timestamping - Measure the absolute time when edges occur
Clock Source to timers: Programming of clock source for the ICU module, is beyond the scope of this document. The driver expects that the user of this module has programmed required clock source. The example application demonstrates configuring clock sources for ECAP module
4.17.4. Hardware Features
4.17.4.1. AUTOSAR Supported Features
Signal edge notification
Periodic signal time measurement
Edge time stamping
Edge counting
4.17.4.2. Not supported Features
Wakeup functionality is not supported because of the limitation of the hardware.
4.17.5. Source files
Description of static files is provided below:
📦AM263Px
┣ 📂build
┣ 📂mcal
┃ ┣ 📂Icu
┃ ┃ ┣ 📂include
┃ ┃ ┃ ┣ 📜Icu.h : Contains the API’s of the ICU driver to be used by upper layers
┃ ┃ ┃ ┗ 📜Icu_Irq.h : Contains ISR function declaration
┃ ┃ ┣ 📂src
┃ ┃ ┃ ┣ 📜Icu.c : Contains the implementation of the API’s for ICU driver
┃ ┃ ┃ ┗ 📜Icu_Irq.c : Contains ISR function definitions
┃ ┃ ┣ 📂V0
┃ ┃ ┃ ┣ 📜ecap.h : Contains Internal functions declaration of ICU driver
┃ ┃ ┃ ┣ 📜ecap.c : Contains Internal Functions definitions
┃ ┃ ┃ ┣ 📜hw_icu.h : Contains Internal functions declaration of ICU driver
┃ ┃ ┃ ┣ 📜Icu_Priv.c : Contains Internal Functions definitions
┃ ┃ ┃ ┗ 📜Icu_Priv.h : Contains Internal Functions declaration
┃ ┃ ┗ 📜Makefile
┣ 📂mcal_config
┣ 📂mcal_docs
┗ 📜README.txt
Description of generated files is provided below:
Plugin Files |
Description |
---|---|
Icu_Cfg.h |
Contains static configuration of this module |
Icu_PBcfg.c |
Contain the generated configuration for post-build variant |
Icu_Cfg.c |
Contain the generated configuration for pre-compile variant |
4.17.6. Module requirements
Will be updated in future release:
4.17.6.1. Memory Mapping
Memory Mapping Sections |
ICU_CODE |
ICU_VAR_INIT |
ICU_VAR_NOINIT |
ICU_CONST |
ICU_CONFIG |
---|---|---|---|---|---|
ICU_START_SEC_VAR_INIT_UNSPECIFIED (.data) |
x |
||||
ICU_DATA_INIT_32_SECTION |
x |
||||
ICU_TEXT_SECTION |
x |
||||
ICU_DATA_NO_INIT_UNSPECIFIED_SECTION |
x |
||||
ICU_CONST_32_SECTION |
x |
||||
ICU_ISR_TEXT_SECTION |
x |
||||
ICU_CONFIG_SECTION |
x |
4.17.6.2. Cache
This driver implementation has been validated with cache enabled. For optimal performance it’s recommended to place memmap sections in cache enabled memory area.
4.17.6.3. Scheduling
There is no scheduling functions in Icu.
4.17.6.4. Error handling
4.17.6.4.1. Development Error Reporting
Development errors are reported to the DET using the service Det_ReportError().
4.17.6.5. Error codes
4.17.6.5.1. Development Errors
The errors reported to DET module are described in the following table:
Type of Error |
Related Error code |
Value (Hex) |
---|---|---|
API is called with invalid pointer |
ICU_E_PARAM_POINTER |
0x0A |
API service used with an invalid channel identifier or channel was not configured for the functionality of the called API |
ICU_E_PARAM_CHANNEL |
0x0B |
API service used with an invalid or not feasible activation |
ICU_E_PARAM_ACTIVATION |
0x0C |
Init Function Failed |
ICU_E_INIT_FAILED |
0x0D |
API service used with an invalid buffer size |
ICU_E_PARAM_BUFFER_SIZE |
0x0E |
API service Icu_SetMode used with an invalid mode |
ICU_E_PARAM_MODE |
0x0F |
API service used without module initialization |
ICU_E_UNINIT |
0x14 |
API service Icu_SetMode is called while in running operation |
ICU_E_BUSY_OPERATION |
0x16 |
API Icu_Init service is called and when the ICU driver and the Hardware are already initialized |
ICU_E_ALREADY_INITIALIZED |
0x17 |
API Icu_StartTimeStamp is called and the parameter NotifyInterval is Invalid |
ICU_E_PARAM_NOTIFY_INTERVAL |
0x18 |
API Icu_GetVersionInfo is called and the parameter versioninfo is invalid |
ICU_E_PARAM_VINFO |
0x19 |
4.17.6.5.2. Runtime Errors
Type of Error |
Related Error code |
Value (Hex) |
---|---|---|
API service Icu_StopTimestamp called on a channel which was not started or already stopped |
ICU_E_NOT_STARTED |
0x15 |
4.17.7. Used resources
4.17.7.1. Interrupt Handling
4.17.7.1.1. Interrupt Configuration
The Driver doesn’t register any interrupts handler (ISR), it’s expected that consumer of this driver registers the required interrupt handler.
For every Icu channel with notification enabled, an ISR requires to be registered. The Interrupt number associated with instance of the ECAP is detailed in TRM (also, please refer the demo application). Please refer IcuApp() in Icu demo application.
Some of the ICU interrupts are not routed/mapped to this core, these interrupts would require additional programming to route these to this core. Please refer IcuApp() in Icu demo application.
4.17.7.1.2. X-Bar Configuration
In AM263Px, we have X-Bar support which basically act as a mux and will be used to transmit output signal like of EPWM/GPIO to ECAP(ICU) input. Following steps need to be followed in order to configure Input X-Bar:
1.Input X-Bar for ICU is configured in MCU configuration.
2.In MCU configuration, McuInputXbarChannelTriggerConfiguration container is used to configure different X-Bar with different GPIO.

Fig. 4.77 Input X-Bar is configured for GPIO61 which will be used by ICU
3.Now in order to select a particular ECAP instance against that X-Bar which we have configured in MCU, their is a reference to the X-Bar in ICU.
4.XbarSelect parameter in ICU is the reference of the X-Bar which is configured in MCU.

Fig. 4.78 In ICU Input X-Bar is referenced from MCU configuration
5.NOTE: When a new X-Bar is configured in MCU then exactly same mapping to be selected for the reference XbarSelect parameter in ICU.
We have a support of Interrupt XBar which act as a mux for interrupts of the peripherals.So in order to provide flexibility to the user since their use cases will be different and our SOC has so many peripherals and a large amount of events like interrupts etc, interrupt XBar is used. Following steps need to be followed in order to configure Interrupt X-Bar:
Interrupt X-Bar for ICU is configured in MCU configuration.
In MCU configuration,
McuXbarChannelTriggerConfiguration
container is used to configure different X-Bar Interrupt with different peripheral.Now interrupt registration for the particular X-Bar interrupt, need to be done at the application side of the peripheral.
For example: For ICU, X-Bar Interrupt number 22 is configured in MCU and with the same Interrupt is registered in ICU application.
4.17.8. Integration description
4.17.8.1. Dependent modules
4.17.8.1.1. DET
This implementation depends on the DET in order to report development errors. The detection of development errors is configurable (ON / OFF).
4.17.8.1.2. SchM
If multiple AUTOSAR runnables have access to the same Data Store Memory block, the exported AUTOSAR specification enforces data consistency by using an AUTOSAR exclusive area. With this specification, the runnables have mutually exclusive access to the per-instance memory global data, which prevents data corruption. Beside the OS, the BSW Scheduler provides functions that ICU module calls at begin and end of critical sections. This implementation requires 1 level of exclusive access to guard critical sections.
The data consistency mechanism that has to be applied to an ExclusiveArea might be domain, ECU or even project specific. The decision which mechanism has to be applied by RTE / Basic Software Scheduler is taken during ECU integration by setting the Exclusive Area configuration parameter RteExclusiveAreaImplMechanism. This parameter is an input for RTE generator.
For ICU Module, data consistency and exclusive access to critical sections are required for the following sections as shown in the table below:
Exclusive Area Functions used |
ICU Function calling Exclusive Area |
Need for Exclusive Area |
Recommended Exclusive Area Mapping |
---|---|---|---|
ICU_EXCLUSIVE_AREA_0 |
Icu_DisableNotification |
To protect against multiple access for shared resources |
ALL_INTERRUPT_BLOCKING : All interrupts should be blocked as this API’s can be called in the interrupts |
4.17.8.2. Multi-core support
Not Supported
4.17.9. Configuration
4.17.9.1. IcuConfigSet
This container contains the configuration parameters and sub containers of the AUTOSAR Icu module.
4.17.9.1.1. IcuChannel
Configuration of an individual ICU channel.
4.17.9.1.1.1. IcuChannelId
Item |
|
---|---|
Name |
IcuChannelId |
Description |
Channel Id of the ICU channel. This value will be assigned to the symbolic name derived of the IcuChannel container short name. |
Origin |
AUTOSAR_ECUC |
Post-build-variant-multiplicity |
false |
Post-Build-Variant-Value |
false |
Value-Configuration-Class |
– |
Post-Build-Time |
VARIANT-POST-BUILD |
Pre-Compile-Time |
VARIANT-PRE-COMPILE |
Max-value |
16 |
Min-value |
0 |
4.17.9.1.1.2. IcuDefaultStartEdge
Item |
|
---|---|
Name |
IcuDefaultStartEdge |
Description |
Configures the capture event to enable interupt on that capture event or not |
Origin |
Texas Instruments |
Post-build-variant-multiplicity |
false |
Post-Build-Variant-Value |
true |
Value-Configuration-Class |
– |
Post-Build-Time |
VARIANT-POST-BUILD |
Pre-Compile-Time |
VARIANT-PRE-COMPILE |
Range |
ECAP_CEVT1_INT |
4.17.9.1.1.3. IcuMeasurementMode
Item |
|
---|---|
Name |
IcuMeasurementMode |
Description |
Configures the measurement mode of this channel. |
Origin |
AUTOSAR_ECUC |
Post-build-variant-multiplicity |
false |
Post-Build-Variant-Value |
true |
Value-Configuration-Class |
– |
Post-Build-Time |
VARIANT-POST-BUILD |
Pre-Compile-Time |
VARIANT-PRE-COMPILE |
Range |
ICU_MODE_EDGE_COUNTER |
4.17.9.1.1.4. IcuPrescaler
Item |
|
---|---|
Name |
IcuPrescaler |
Description |
Time-Base Clock Prescale Bits. Keep value as 0 to by-pass prescaler. |
Origin |
Texas Instruments |
Post-build-variant-multiplicity |
false |
Post-Build-Variant-Value |
false |
Value-Configuration-Class |
– |
Post-Build-Time |
VARIANT-POST-BUILD |
Pre-Compile-Time |
VARIANT-PRE-COMPILE |
Default-value |
0 |
Max-value |
62 |
Min-value |
0 |
4.17.9.1.1.5. IcuFunctionalClock
Item |
|
---|---|
Name |
IcuFunctionalClock |
Description |
Value of the System clock frequency in MHz Default frequency is 125MHz for ICU. |
Origin |
Texas Instruments |
Post-build-variant-multiplicity |
false |
Post-Build-Variant-Value |
true |
Value-Configuration-Class |
– |
Post-Build-Time |
VARIANT-POST-BUILD |
Pre-Compile-Time |
VARIANT-PRE-COMPILE |
Default-value |
200 |
4.17.9.1.1.6. IcuXbarSelect
Item |
|
---|---|
Name |
IcuXbarSelect |
Description |
Configures the input select xbar to be used in order to give icu the required input |
Origin |
Texas Instruments |
Post-build-variant-multiplicity |
false |
Post-Build-Variant-Value |
true |
Value-Configuration-Class |
– |
Post-Build-Time |
VARIANT-POST-BUILD |
Pre-Compile-Time |
VARIANT-PRE-COMPILE |
4.17.9.1.2. IcuSignalEdgeDetection
This container contains the configuration (parameters) in case the measurement mode is “IcuSignalEdgeDetection”
4.17.9.1.2.1. IcuSignalNotification
Item |
|
---|---|
Name |
IcuSignalNotification |
Description |
Notification function for signal notification. |
Multiplicity-Configuration-Class |
– |
Post-Build Time |
VARIANT-POST-BUILD |
Pre-Compile Time |
VARIANT-PRE-COMPILE |
Origin |
AUTOSAR_ECUC |
Post-build-variant-multiplicity |
true |
Post-Build-Variant-Value |
true |
Value-Configuration-Class |
– |
Post-Build-Time |
VARIANT-POST-BUILD |
Pre-Compile-Time |
VARIANT-PRE-COMPILE |
4.17.9.1.3. IcuSignalMeasurement
This container contains the configuration (parameters) in case the measurement mode is “IcuSignalMeasurement”
4.17.9.1.3.1. IcuSignalMeasurementProperty
Item |
|
---|---|
Name |
IcuSignalMeasurementProperty |
Description |
Configures the property that could be measured in case the mode is “IcuSignalMeasurement”. |
Origin |
AUTOSAR_ECUC |
Post-build-variant-multiplicity |
false |
Post-Build-Variant-Value |
true |
Value-Configuration-Class |
– |
Post-Build-Time |
VARIANT-POST-BUILD |
Pre-Compile-Time |
VARIANT-PRE-COMPILE |
Range |
ICU_DUTY_CYCLE |
4.17.9.1.4. IcuTimestampMeasurement
This container contains the configuration (parameters) in case the measurement mode is “IcuTimestamp”
4.17.9.1.4.1. IcuTimestampMeasurementProperty
Item |
|
---|---|
Name |
IcuTimestampMeasurementProperty |
Description |
Configures the handling of the buffer in case the mode is “Timestamp” |
Origin |
AUTOSAR_ECUC |
Post-build-variant-multiplicity |
false |
Post-Build-Variant-Value |
true |
Value-Configuration-Class |
– |
Post-Build-Time |
VARIANT-POST-BUILD |
Pre-Compile-Time |
VARIANT-PRE-COMPILE |
Range |
ICU_CIRCULAR_BUFFER |
4.17.9.1.4.2. IcuTimestampNotification
Item |
|
---|---|
Name |
IcuTimestampNotification |
Description |
Notification function if the number of requested timestamps |
Multiplicity-Configuration-Class |
– |
Post-Build Time |
VARIANT-POST-BUILD |
Pre-Compile Time |
VARIANT-PRE-COMPILE |
Origin |
AUTOSAR_ECUC |
Post-build-variant-multiplicity |
true |
Post-Build-Variant-Value |
true |
Value-Configuration-Class |
– |
Post-Build-Time |
VARIANT-POST-BUILD |
Pre-Compile-Time |
VARIANT-PRE-COMPILE |
4.17.9.1.5. IcuWakeup
This container contains the configuration (parameters) needed to configure a wakeup capable channel
4.17.9.1.5.1. IcuChannelWakeupInfo
Item |
|
---|---|
Name |
IcuChannelWakeupInfo |
Description |
If the wakeup-capability is true the wakeup source referenced is transmitted to the ECU State Manager (EcuM) . |
Multiplicity-Configuration-Class |
– |
Post-Build Time |
VARIANT-POST-BUILD |
Pre-Compile Time |
VARIANT-PRE-COMPILE |
Origin |
AUTOSAR_ECUC |
Post-build-variant-multiplicity |
true |
Post-Build-Variant-Value |
true |
Value-Configuration-Class |
– |
Post-Build-Time |
VARIANT-POST-BUILD |
Pre-Compile-Time |
VARIANT-PRE-COMPILE |
4.17.9.2. IcuGeneral
Configuration of general ICU parameters.
4.17.9.2.1. IcuDevErrorDetect
Item |
|
---|---|
Name |
IcuDevErrorDetect |
Description |
Switches the development error detection and notification on or off. |
Origin |
AUTOSAR_ECUC |
Post-build-variant-multiplicity |
false |
Post-Build-Variant-Value |
false |
Value-Configuration-Class |
– |
Post-Build-Time |
VARIANT-POST-BUILD |
Pre-Compile-Time |
VARIANT-PRE-COMPILE |
Default-value |
false |
4.17.9.2.2. IcuIrqType
Item |
|
---|---|
Name |
IcuIrqType |
Description |
Type of Isr function: |
Origin |
Texas Instruments |
Post-build-variant-multiplicity |
false |
Post-Build-Variant-Value |
false |
Value-Configuration-Class |
– |
Pre-Compile-Time |
VARIANT-PRE-COMPILE |
Post-Build-Time |
VARIANT-POST-BUILD |
Default-value |
ICU_ISR_CAT1 |
Range |
ICU_ISR_VOID |
4.17.9.2.3. IcuDeviceVariant
Item |
|
---|---|
Name |
IcuDeviceVariant |
Description |
Select SOC variant |
Origin |
Texas Instruments |
Post-build-variant-multiplicity |
false |
Post-Build-Variant-Value |
false |
Value-Configuration-Class |
– |
Pre-Compile-Time |
VARIANT-PRE-COMPILE |
Post-Build-Time |
VARIANT-POST-BUILD |
Default-value |
AM263Px |
Range |
AM263Px |
4.17.9.3. IcuOptionalApis
This container contains all configuration switches for configuring optional API services of the ICU driver.
4.17.9.3.1. IcuDeInitApi
Item |
|
---|---|
Name |
IcuDeInitApi |
Description |
Adds / removes the service Icu_DeInit() from the code. |
Origin |
AUTOSAR_ECUC |
Post-build-variant-multiplicity |
false |
Post-Build-Variant-Value |
false |
Value-Configuration-Class |
– |
Post-Build-Time |
VARIANT-POST-BUILD |
Pre-Compile-Time |
VARIANT-PRE-COMPILE |
Default-value |
false |
4.17.9.3.2. IcuDisableWakeupApi
Item |
|
---|---|
Name |
IcuDisableWakeupApi |
Description |
Adds / removes the service Icu_DisableWakeup() from the code. |
Origin |
AUTOSAR_ECUC |
Post-build-variant-multiplicity |
false |
Post-Build-Variant-Value |
false |
Value-Configuration-Class |
– |
Post-Build-Time |
VARIANT-POST-BUILD |
Pre-Compile-Time |
VARIANT-PRE-COMPILE |
Default-value |
false |
4.17.9.3.3. IcuEdgeCountApi
Item |
|
---|---|
Name |
IcuEdgeCountApi |
Description |
Adds / removes all services related to the edge counting functionality as listed below, from the code: Icu_ResetEdgeCount(), Icu_EnableEdgeCount(), Icu_DisableEdgeCount(), Icu_GetEdgeNumbers(). |
Origin |
AUTOSAR_ECUC |
Post-build-variant-multiplicity |
false |
Post-Build-Variant-Value |
false |
Value-Configuration-Class |
– |
Post-Build-Time |
VARIANT-POST-BUILD |
Pre-Compile-Time |
VARIANT-PRE-COMPILE |
Default-value |
false |
4.17.9.3.4. IcuEdgeDetectApi
Item |
|
---|---|
Name |
IcuEdgeDetectApi |
Description |
Adds / removes the services related to the edge detection functionality, from the code: |
Origin |
AUTOSAR_ECUC |
Post-build-variant-multiplicity |
false |
Post-Build-Variant-Value |
false |
Value-Configuration-Class |
– |
Post-Build-Time |
VARIANT-POST-BUILD |
Pre-Compile-Time |
VARIANT-PRE-COMPILE |
Default-value |
false |
4.17.9.3.5. IcuEnableWakeupApi
Item |
|
---|---|
Name |
IcuEnableWakeupApi |
Description |
Adds / removes the service Icu_EnableWakeup() from the code. |
Origin |
AUTOSAR_ECUC |
Post-build-variant-multiplicity |
false |
Post-Build-Variant-Value |
false |
Value-Configuration-Class |
– |
Post-Build-Time |
VARIANT-POST-BUILD |
Pre-Compile-Time |
VARIANT-PRE-COMPILE |
Default-value |
false |
4.17.9.3.6. IcuGetDutyCycleValuesApi
Item |
|
---|---|
Name |
IcuGetDutyCycleValuesApi |
Description |
Adds / removes the service Icu_GetDutyCycleValues() from the code. |
Origin |
AUTOSAR_ECUC |
Post-build-variant-multiplicity |
false |
Post-Build-Variant-Value |
false |
Value-Configuration-Class |
– |
Post-Build-Time |
VARIANT-POST-BUILD |
Pre-Compile-Time |
VARIANT-PRE-COMPILE |
Default-value |
false |
4.17.9.3.7. IcuGetInputStateApi
Item |
|
---|---|
Name |
IcuGetInputStateApi |
Description |
Adds / removes the service Icu_GetInputState() from the code. |
Origin |
AUTOSAR_ECUC |
Post-build-variant-multiplicity |
false |
Post-Build-Variant-Value |
false |
Value-Configuration-Class |
– |
Post-Build-Time |
VARIANT-POST-BUILD |
Pre-Compile-Time |
VARIANT-PRE-COMPILE |
Default-value |
false |
4.17.9.3.8. IcuGetTimeElapsedApi
Item |
|
---|---|
Name |
IcuGetTimeElapsedApi |
Description |
Adds / removes the service Icu_GetTimeElapsed() from the code. |
Origin |
AUTOSAR_ECUC |
Post-build-variant-multiplicity |
false |
Post-Build-Variant-Value |
false |
Value-Configuration-Class |
– |
Post-Build-Time |
VARIANT-POST-BUILD |
Pre-Compile-Time |
VARIANT-PRE-COMPILE |
Default-value |
false |
4.17.9.3.9. IcuGetVersionInfoApi
Item |
|
---|---|
Name |
IcuGetVersionInfoApi |
Description |
Adds / removes the service Icu_GetVersionInfo() from the code. |
Origin |
AUTOSAR_ECUC |
Post-build-variant-multiplicity |
false |
Post-Build-Variant-Value |
false |
Value-Configuration-Class |
– |
Post-Build-Time |
VARIANT-POST-BUILD |
Pre-Compile-Time |
VARIANT-PRE-COMPILE |
Default-value |
false |
4.17.9.3.10. IcuSetModeApi
Item |
|
---|---|
Name |
IcuSetModeApi |
Description |
Adds / removes the service Icu_SetMode() from the code. |
Origin |
AUTOSAR_ECUC |
Post-build-variant-multiplicity |
false |
Post-Build-Variant-Value |
false |
Value-Configuration-Class |
– |
Post-Build-Time |
VARIANT-POST-BUILD |
Pre-Compile-Time |
VARIANT-PRE-COMPILE |
Default-value |
false |
4.17.9.3.11. IcuSignalMeasurementApi
Item |
|
---|---|
Name |
IcuSignalMeasurementApi |
Description |
Adds / removes the services Icu_StartSignalMeasurement() and Icu_StopSignalMeasurement() from the code. |
Origin |
AUTOSAR_ECUC |
Post-build-variant-multiplicity |
false |
Post-Build-Variant-Value |
false |
Value-Configuration-Class |
– |
Post-Build-Time |
VARIANT-POST-BUILD |
Pre-Compile-Time |
VARIANT-PRE-COMPILE |
Default-value |
false |
4.17.9.3.12. IcuTimestampApi
Item |
|
---|---|
Name |
IcuTimestampApi |
Description |
Adds / removes all services related to the timestamping functionality as listed below from the code: Icu_StartTimestamp(), Icu_StopTimestamp(), Icu_GetTimestampIndex(). |
Origin |
AUTOSAR_ECUC |
Post-build-variant-multiplicity |
false |
Post-Build-Variant-Value |
false |
Value-Configuration-Class |
– |
Post-Build-Time |
VARIANT-POST-BUILD |
Pre-Compile-Time |
VARIANT-PRE-COMPILE |
Default-value |
false |
By default Signal measurement mode is selected but if user want to change it to some other mode so in that case following operation they need to perform:
Change the configuration from the EB tresos tool.
So in case of icu, timestamp mode and edge detection mode also involve interupt callback to be registered. So by default we have given callback name in our application, with that name you can configure callback also in EB tresos.
For Edge detection mode callback name is: Icu_SignalNotification_Channel1.
For Timestamp mode callback name is : Icu_TimeStampNotification_Channel1Except this rest of the parameters can be configured as provided in EB plugin.
IsrCallback:
Mode |
CallBack |
---|---|
Signal Measurement Mode |
NA |
Edge Detection Mode |
Icu_SignalNotification_Channel1 |
TimeStamp Mode |
Icu_TimeStampNotification_Channel1 |
Edge Count Mode |
NA |
The following section details on the un-supported features and additional features added.
4.17.9.4. Variance / Deviation from the specification
APIs (listed below) related to wakeup capability are not supported as the hardware does not support.
Controlling Wakeup interrupts
Icu_SetMode()
Icu_DisableWakeup()
Icu_EnableWakeup()
Icu_CheckWakeup()
4.17.10. Examples
4.17.10.1. Overview
Icu Example
Initialize clock using Mcu_Init()
Initialize port using Port_Init()
Configure Icu interrupt using Icu_InterruptConfig()
Initialize Pwm using Pwm_Init()
Get Icu Version using Icu_GetVersionInfo()
Initialize Icu using Icu_Init()
For Signal measurement
Start the measurement of signals using Icu_StartSignalMeasurement()
Stop the measurement of signals using Icu_StopSignalMeasurement()
Read the elapsed Signal Low Time for the given channel using Icu_GetTimeElapsed()
Read the active time and period time for the ICU Channel and calculate duty cycle.
4.17.10.2. Setup required to run example
None
4.17.10.3. How to run examples
4.17.10.3.1. Build and Running the Example Application
Please follow steps detailed in section to build library or example.
ECAP based application name - icu_app
This application uses the PWM (Enhanced Pulse Width Module) to provide input to ECAP instance. The ECAP module (with ICU driver) will capture the signals provided as input.
There is one example application provided: icu_app. Please refer to below directory structures.
Config files for icu_app are located along with other applications configs at / mcal_sitara_mcu/mcal/examples/config/Icu_Cfg and Icu_PBcfg can also be found as this location.
IcuApp.c and IcuApp.h: Shall implement the start-up code sequence and register interrupts and also shall implement the example application that demonstrates the use of the driver.
4.17.10.3.2. Flow of the example application
In the IcuApp.c , following steps are there:
Firstly the pin mux is initialize
UART is enabled.
After that EPWM is enabled , since the output of EPWM is used as an input to our ICU.
After that the ICU is initialize
So by default we have configured ICU in signal measurement mode, but if the user want to change then they need to change the configuration accordingly.
By default we are using EPWM0 for our input to ICU.
And we are taking ECAP0( ICU 0\ :sup:
TH
instance ) for the demonstration of our example.So now when we execute our example with default configuration we will be getting active time, period time and duty cycle as part of the signal measurement.
4.17.10.4. Sample Log
IcuApp: Sample Application - STARTS !!!
ICU_APP: ICU MCAL Version Info
---------------------
ICU_APP: Vendor ID: 44
ICU_APP: Module ID: 122
ICU_APP: SW Major Version: 10
ICU_APP: SW Minor Version: 0
ICU_APP: SW Patch Version: 0
ICU_APP: Variant - Post Build being used !!!
ICU_APP: Signal Measurement Mode!
ICU_APP: elapsed time (Period) is 998 us
ICU_APP: Active Time is 499
ICU_APP: Period Time is 998
ICU_APP: Duty Cycle is 0.500000
ICU_APP: elapsed time read is 0 us
ICU_APP: elapsed time (Period) is 998 us
ICU_APP: Active Time is 499
ICU_APP: Period Time is 998
ICU_APP: Duty Cycle is 0.500000
All tests have passed
4.17.10.5. File Structure
📦AM263Px
┣ 📂build
┣ 📂mcal
┃ ┣ 📂examples
┃ ┃ ┣ 📂Icu
┃ ┃ ┃ ┣ 📂soc
┃ ┃ ┃ ┣ 📜IcuApp.c : Contains Icu test example
┃ ┃ ┃ ┣ 📜IcuApp.h : Contains Icu test example header file
┃ ┃ ┃ ┗ 📜Makefile
┃ ┣ 📂examples_config
┃ ┃ ┣ 📂Icu_Demo_Cfg
┃ ┃ ┃ ┗ 📂soc
┃ ┃ ┃ ┃ ┣ 📂am263px
┃ ┃ ┃ ┃ ┃ ┗ 📂r5f0_0
┃ ┃ ┃ ┃ ┃ ┃ ┣ 📂include
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗📜Icu_Cfg.h : Contains the configuration parameters
┃ ┃ ┃ ┃ ┃ ┃ ┗ 📂src
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┣📜Icu_Cfg.c : Contains all Pre-Compile Configured parameters
┃ ┃ ┃ ┃ ┃ ┃ ┃ ┗ 📜Icu_PBcfg.c : contains all Post build configured parameters
┃ 📂mcal_config
┃ 📂mcal_docs
┗ 📜README.txt